wspurgin / rspec-sidekiq

RSpec for Sidekiq
https://github.com/wspurgin/rspec-sidekiq
Other
663 stars 132 forks source link

uninitialized constant RSpec::Sidekiq (NameError) #151

Closed fifiteen82726 closed 6 years ago

fifiteen82726 commented 6 years ago

After I put the following code into /spec/spec_helper.rb, it comes the error

 RSpec::Sidekiq.configure do |config|
    config.clear_all_enqueued_jobs = true # default => true
    config.enable_terminal_colours = true # default => true
    config.warn_when_jobs_not_processed_by_sidekiq = true # default => true
  end

The error contains following

/.bundle/vendor/cache/ruby/2.3.0/gems/rspec-core-3.7.1/lib/rspec/core.rb:179:in `block in const_missing': uninitialized constant RSpec::Sidekiq (NameError)
Did you mean?  Sidekiq

GEM info

rails (4.2.9)
rspec (3.7.0)
      rspec-core (~> 3.7.0)
      rspec-expectations (~> 3.7.0)
      rspec-mocks (~> 3.7.0)
    rspec-core (3.7.1)
      rspec-support (~> 3.7.0)
    rspec-expectations (3.7.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.7.0)
    rspec-json_expectations (2.1.0)
    rspec-mocks (3.7.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.7.0)
    rspec-rails (3.7.2)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 3.7.0)
      rspec-expectations (~> 3.7.0)
      rspec-mocks (~> 3.7.0)
      rspec-support (~> 3.7.0)
    rspec-sidekiq (3.0.3)
      rspec-core (~> 3.0, >= 3.0.0)
      sidekiq (>= 2.4.0)
    rspec-support (3.7.1)
    rspec_junit_formatter (0.2.3)
      builder (< 4)
      rspec-core (>= 2, < 4, != 2.12.0)

Ruby 2.3.0

packrat386 commented 6 years ago

Did you include require 'rspec-sidekiq'?

fifiteen82726 commented 6 years ago

Did you include require 'rspec-sidekiq'?

Hi @packrat386

I found out the problem is not relative to require 'rspec-sidekiq',

According to the WIKI here(https://github.com/philostler/rspec-sidekiq/wiki/FAQ-&-Troubleshooting#how-do-i-disable-it)

It states that

(In case you have rspec 3 or higher you should add it to rails_helper.rb instead)

So I change it into rails_helper.rb, it works.

minhtienvu commented 1 year ago

@fifiteen82726 Thanks for your support. It works for me 💪