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

Mock Redis connection for testing environment #5

Closed
amedrz opened this issue Dec 10, 2013 · 7 comments
Closed

Mock Redis connection for testing environment #5

amedrz opened this issue Dec 10, 2013 · 7 comments

Comments

@amedrz
Copy link

amedrz commented Dec 10, 2013

Hi guys, I just noticed that Redis isn't being stubbed when running the specs from my app.

Then I realized that folks from the sidekiq-unique-jobs gem ran into the same isssue:

mhenrixon/sidekiq-unique-jobs#18

Shall we do something similar here? just give me the call.

Thanks!

@kosmatov
Copy link
Owner

I think that is bad idea to run functional tests with stubbed environment. Just create unit tests if you need and run them separately.

@amedrz
Copy link
Author

amedrz commented Jan 27, 2014

@kosmatov would you recommend to have Redis up while running specs instead? I'm not sure about that since Sidekiq itself has helpers to mock Redis calls in unit tests

https://github.com/mperham/sidekiq/wiki/Testing#wiki-testing-worker-queueing-fake

@kosmatov
Copy link
Owner

Oh, ok, I understand what you want. I'll see how fake! realized in Sidekiq and write required code. I don't like how it realized in sidekiq-unique-jobs because it's violates DI principle.

@amedrz
Copy link
Author

amedrz commented Feb 3, 2014

Ok thanks. Currently I have to add this to the spec files of my workers that use sidekiq-benchmark

before { Sidekiq.stub(:redis).and_return(MockRedis.new) }

Workers using just sidekiq or sidekiq-unique-jobs don't need that.

@doomspork
Copy link

👍 I'm all for this feature!

@kosmatov
Copy link
Owner

@amedrz
Copy link
Author

amedrz commented Feb 20, 2014

👍

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