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

Renaming hook_rails option to enable_rails_extensions

This commit is contained in:
Jon Hinson 2012-03-26 18:05:33 -05:00
parent cd423f9cdc
commit f15ceb93c5
3 changed files with 7 additions and 7 deletions

View file

@ -16,7 +16,7 @@ module Sidekiq
:require => '.', :require => '.',
:environment => nil, :environment => nil,
:timeout => 5, :timeout => 5,
:hook_rails => true, :enable_rails_extensions => true,
} }
def self.options def self.options

View file

@ -1,6 +1,6 @@
module Sidekiq module Sidekiq
def self.hook_rails! def self.hook_rails!
return unless Sidekiq.options[:hook_rails] return unless Sidekiq.options[:enable_rails_extensions]
if defined?(ActiveRecord) if defined?(ActiveRecord)
ActiveRecord::Base.extend(Sidekiq::Extensions::ActiveRecord) ActiveRecord::Base.extend(Sidekiq::Extensions::ActiveRecord)
ActiveRecord::Base.send(:include, Sidekiq::Extensions::ActiveRecord) ActiveRecord::Base.send(:include, Sidekiq::Extensions::ActiveRecord)

View file

@ -11,16 +11,16 @@ class TestExtensionConfiguration < MiniTest::Unit::TestCase
Sidekiq.options = @options Sidekiq.options = @options
end end
it 'should set hook_rails option to true by default' do it 'should set enable_rails_extensions option to true by default' do
assert_equal true, Sidekiq.options[:hook_rails] assert_equal true, Sidekiq.options[:enable_rails_extensions]
end end
it 'should extend ActiveRecord and ActiveMailer if hook_rails is true' do it 'should extend ActiveRecord and ActiveMailer if enable_rails_extensions is true' do
assert_equal ActionMailer::Base, Sidekiq.hook_rails! assert_equal ActionMailer::Base, Sidekiq.hook_rails!
end end
it 'should not extend ActiveRecord and ActiveMailer if hook_rails is false' do it 'should not extend ActiveRecord and ActiveMailer if enable_rails_extensions is false' do
Sidekiq.options = { :hook_rails => false } Sidekiq.options = { :enable_rails_extensions => false }
assert_equal nil, Sidekiq.hook_rails! assert_equal nil, Sidekiq.hook_rails!
end end