Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails + Sidekiq will go bezerk after sidekiq-unique-jobs testing check. #128

Closed
antek-drzewiecki opened this issue Oct 13, 2015 · 1 comment

Comments

@antek-drzewiecki
Copy link

When a Testing module is defined in your application namespace or a Testing module in general. Sidekiq-unique-jobs generatesNameErrors, uninitialized constant Sidekiq::Testing in config.rb.

The currently it check if the Testing constant is defined in Sidekiq with .const_defined?. The behaviour of .const_defined? is to check its ancestors if a constant is defined.

Since Sidekiq::Testing is not defined, it will try to look in its ancestors (Module and Object). There Testing is defined so it returns true.

Debug info:

Rails.env
 => "development" 
Object.const_defined? 'Testing'
 => true 
Sidekiq.const_defined? 'Testing'
 => true 
Sidekiq.const_defined? 'Testing', false
 => false 

And in test:

Rails.env
 => "test" 
Object.const_defined? 'Testing'
 => true 
Sidekiq.const_defined? 'Testing'
 => true 
 Sidekiq.const_defined? 'Testing', false
 => true 
@antek-drzewiecki
Copy link
Author

This issue was found in version 3.0.13 but applies to 4.x and 3.x.
Is there any way to patch 3.0.13 with the fix?

Workaround: Dont use any Object or Module named Testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants