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

LoadError: cannot load such file -- mock_redis #60

Closed
Jeehut opened this issue Nov 14, 2014 · 4 comments
Closed

LoadError: cannot load such file -- mock_redis #60

Jeehut opened this issue Nov 14, 2014 · 4 comments

Comments

@Jeehut
Copy link

Jeehut commented Nov 14, 2014

I am receiving the following error when running my tests (MiniTest via rake test command):
LoadError: cannot load such file -- mock_redis

Some excerpts of how I use sidekiq-unique-jobs:

Gemfile:

# Use sidekiq for background tasks
gem 'sidekiq'

# Use sidekiq enhancement for unique jobs
gem 'sidekiq-unique-jobs'

Worker:

class MyWorker
  include Sidekiq::Worker
  sidekiq_options queue: :my_queue, unique: true, 
                  unique_job_expiration: 24 * 60 * 60

  def perform(user_id)
    # some code
  end
end

test_helper:

require 'sidekiq/testing'
Sidekiq::Testing.fake!

I'm not sure if I'm doing something wrong here or if there is an issue with the combination of Rails 4.1.4, most current sidekiq and sidekiq-unique-jobs gems. Can anybody help me or fix this issue?

I think it is an issue because if I remove this gem from the project then all tests succeed.
Thanks for your help! :)

@jamesbowles
Copy link
Contributor

Hi @Dschee

You need to add mock_redis to your Gemfile:

gem 'mock_redis', '~> 0.13.2'

that should fix your problem.

@mhenrixon
Copy link
Owner

Yeah, sorry about that. People complained about having mock_redis in their production environments

@Jeehut
Copy link
Author

Jeehut commented Nov 18, 2014

Thanks, @jamesbowles, that helped. But why do I need to install one more gem for using this one in the first place?

@mhenrixon
Copy link
Owner

If you want to test uniqueness in your app this is the easiest way to do it. If you don't want to use that gem check our test suite for how to test against real redis.

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

3 participants