1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Fix leaky global state

This commit is contained in:
Mike Perham 2015-07-13 21:51:53 -07:00
parent 513334445c
commit 846e661de4

View file

@ -70,11 +70,15 @@ class TestSidekiq < Sidekiq::Test
describe 'error handling' do
it 'deals with user-specified error handlers which raise errors' do
output = capture_logging do
Sidekiq.error_handlers << proc {|x, hash|
raise 'boom'
}
cli = Sidekiq::CLI.new
cli.handle_exception(RuntimeError.new("hello"))
begin
Sidekiq.error_handlers << proc {|x, hash|
raise 'boom'
}
cli = Sidekiq::CLI.new
cli.handle_exception(RuntimeError.new("hello"))
ensure
Sidekiq.error_handlers.pop
end
end
assert_includes output, "boom"
assert_includes output, "ERROR"