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
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:
And in test: