2012-03-26 16:37:38 -04:00
|
|
|
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
|
|
|
|
|
2012-03-26 19:05:33 -04:00
|
|
|
it 'should set enable_rails_extensions option to true by default' do
|
|
|
|
assert_equal true, Sidekiq.options[:enable_rails_extensions]
|
2012-03-26 16:37:38 -04:00
|
|
|
end
|
|
|
|
|
2012-03-26 19:05:33 -04:00
|
|
|
it 'should extend ActiveRecord and ActiveMailer if enable_rails_extensions is true' do
|
2012-03-26 16:37:38 -04:00
|
|
|
assert_equal ActionMailer::Base, Sidekiq.hook_rails!
|
|
|
|
end
|
|
|
|
|
2012-03-26 19:05:33 -04:00
|
|
|
it 'should not extend ActiveRecord and ActiveMailer if enable_rails_extensions is false' do
|
|
|
|
Sidekiq.options = { :enable_rails_extensions => false }
|
2012-03-26 16:37:38 -04:00
|
|
|
assert_equal nil, Sidekiq.hook_rails!
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|