mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-20 03:25:17 +01:00
Minor performance improvement for test suite (#4678)
This commit is contained in:
parent
fbe1115114
commit
c66fe2aeba
@ -268,7 +268,7 @@ class Account < ApplicationRecord
|
||||
def generate_keys
|
||||
return unless local?
|
||||
|
||||
keypair = OpenSSL::PKey::RSA.new(Rails.env.test? ? 1024 : 2048)
|
||||
keypair = OpenSSL::PKey::RSA.new(Rails.env.test? ? 512 : 2048)
|
||||
self.private_key = keypair.to_pem
|
||||
self.public_key = keypair.public_key.to_pem
|
||||
end
|
||||
|
@ -50,14 +50,14 @@ describe Api::V1::Accounts::RelationshipsController do
|
||||
json = body_as_json
|
||||
|
||||
expect(json).to be_a Enumerable
|
||||
expect(json.first[:id]).to be simon.id
|
||||
expect(json.first[:id]).to eq simon.id
|
||||
expect(json.first[:following]).to be true
|
||||
expect(json.first[:followed_by]).to be false
|
||||
expect(json.first[:muting]).to be false
|
||||
expect(json.first[:requested]).to be false
|
||||
expect(json.first[:domain_blocking]).to be false
|
||||
|
||||
expect(json.second[:id]).to be lewis.id
|
||||
expect(json.second[:id]).to eq lewis.id
|
||||
expect(json.second[:following]).to be false
|
||||
expect(json.second[:followed_by]).to be true
|
||||
expect(json.second[:muting]).to be false
|
||||
|
@ -1,11 +1,15 @@
|
||||
require 'simplecov'
|
||||
|
||||
GC.disable
|
||||
|
||||
SimpleCov.start 'rails' do
|
||||
add_group 'Services', 'app/services'
|
||||
add_group 'Presenters', 'app/presenters'
|
||||
add_group 'Validators', 'app/validators'
|
||||
end
|
||||
|
||||
gc_counter = -1
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.expect_with :rspec do |expectations|
|
||||
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
||||
@ -22,8 +26,21 @@ RSpec.configure do |config|
|
||||
end
|
||||
|
||||
config.after :suite do
|
||||
gc_counter = 0
|
||||
FileUtils.rm_rf(Dir["#{Rails.root}/spec/test_files/"])
|
||||
end
|
||||
|
||||
config.after :each do
|
||||
gc_counter += 1
|
||||
|
||||
if gc_counter > 19
|
||||
GC.enable
|
||||
GC.start
|
||||
GC.disable
|
||||
|
||||
gc_counter = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def body_as_json
|
||||
|
Loading…
Reference in New Issue
Block a user