mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Clean up rails hook testing
This commit is contained in:
parent
fb0b09d563
commit
568462eff7
2 changed files with 22 additions and 28 deletions
|
@ -1,28 +0,0 @@
|
|||
require 'helper'
|
||||
require 'sidekiq'
|
||||
|
||||
class TestExtensionConfiguration < MiniTest::Unit::TestCase
|
||||
describe 'sidekiq rails extensions configuration' do
|
||||
before do
|
||||
@options = Sidekiq.options
|
||||
end
|
||||
|
||||
after do
|
||||
Sidekiq.options = @options
|
||||
end
|
||||
|
||||
it 'should set enable_rails_extensions option to true by default' do
|
||||
assert_equal true, Sidekiq.options[:enable_rails_extensions]
|
||||
end
|
||||
|
||||
it 'should extend ActiveRecord and ActiveMailer if enable_rails_extensions is true' do
|
||||
assert_equal ActionMailer::Base, Sidekiq.hook_rails!
|
||||
end
|
||||
|
||||
it 'should not extend ActiveRecord and ActiveMailer if enable_rails_extensions is false' do
|
||||
Sidekiq.options = { :enable_rails_extensions => false }
|
||||
assert_equal nil, Sidekiq.hook_rails!
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -41,6 +41,28 @@ class TestExtensions < MiniTest::Unit::TestCase
|
|||
assert_equal ['default'], Sidekiq::Client.registered_queues
|
||||
assert_equal 1, Sidekiq.redis.llen('queue:default')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'sidekiq rails extensions configuration' do
|
||||
before do
|
||||
@options = Sidekiq.options
|
||||
end
|
||||
|
||||
after do
|
||||
Sidekiq.options = @options
|
||||
end
|
||||
|
||||
it 'should set enable_rails_extensions option to true by default' do
|
||||
assert Sidekiq.options[:enable_rails_extensions]
|
||||
end
|
||||
|
||||
it 'should extend ActiveRecord and ActiveMailer if enable_rails_extensions is true' do
|
||||
assert Sidekiq.hook_rails!
|
||||
end
|
||||
|
||||
it 'should not extend ActiveRecord and ActiveMailer if enable_rails_extensions is false' do
|
||||
Sidekiq.options = { :enable_rails_extensions => false }
|
||||
refute Sidekiq.hook_rails!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue