mirror of
https://github.com/mastodon/mastodon.git
synced 2026-04-25 07:56:08 -05:00
Merge 075396542e into 28284b8452
This commit is contained in:
commit
35cb883717
|
|
@ -52,11 +52,17 @@ RSpec.describe RequestPool do
|
|||
end
|
||||
|
||||
it 'closes the connections' do
|
||||
subject.with('http://example.com') do |http_client|
|
||||
http_client.get('/').flush
|
||||
notifications = capture_notifications('with.request_pool') do
|
||||
subject.with('http://example.com') do |http_client|
|
||||
http_client.get('/').flush
|
||||
end
|
||||
end
|
||||
|
||||
expect { reaper_observes_idle_timeout }.to change(subject, :size).from(1).to(0)
|
||||
|
||||
expect(notifications.size).to eq(1)
|
||||
expect(notifications.first.payload[:host]).to eq('http://example.com')
|
||||
expect(notifications.first.payload[:miss]).to be(true)
|
||||
end
|
||||
|
||||
def reaper_observes_idle_timeout
|
||||
|
|
|
|||
|
|
@ -36,14 +36,12 @@ RSpec.describe Setting do
|
|||
|
||||
context 'when the setting has been saved to database' do
|
||||
it 'returns the value from database' do
|
||||
callback = double
|
||||
allow(callback).to receive(:call)
|
||||
|
||||
ActiveSupport::Notifications.subscribed callback, 'sql.active_record' do
|
||||
notifications = capture_notifications('sql.active_record') do
|
||||
expect(described_class[key]).to eq 42
|
||||
end
|
||||
|
||||
expect(callback).to have_received(:call)
|
||||
expect(notifications.size).to eq(1)
|
||||
expect(notifications.first.payload[:name]).to eq('Setting Load')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -62,12 +60,11 @@ RSpec.describe Setting do
|
|||
end
|
||||
|
||||
it 'does not query the database' do
|
||||
callback = double
|
||||
allow(callback).to receive(:call)
|
||||
ActiveSupport::Notifications.subscribed callback, 'sql.active_record' do
|
||||
notifications = capture_notifications('sql.active_record') do
|
||||
described_class[key]
|
||||
end
|
||||
expect(callback).to_not have_received(:call)
|
||||
|
||||
expect(notifications).to be_empty
|
||||
end
|
||||
|
||||
it 'returns the cached value' do
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ RSpec.configure do |config|
|
|||
config.include Devise::Test::IntegrationHelpers, type: :request
|
||||
config.include ActionMailer::TestHelper
|
||||
config.include Paperclip::Shoulda::Matchers
|
||||
config.include ActiveSupport::Testing::NotificationAssertions
|
||||
config.include ActiveSupport::Testing::TimeHelpers
|
||||
config.include Chewy::Rspec::Helpers
|
||||
config.include Redisable
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user