soveran / ohm

Object-Hash Mapping for Redis
http://ohm.keyvalue.org
MIT License
1.4k stars 167 forks source link

Mock redis #204

Closed u2 closed 8 years ago

u2 commented 8 years ago

Can you help me? I wanted to find a gem like https://github.com/guilleiguaran/fakeredis or https://github.com/brigade/mock_redis, but they are designed for redis-rb, I could not find any available gem. So if I want to mock a redis for ohm, how to do?

Thanks a lot.

soveran commented 8 years ago

Hello @u2, I'd love to help you! I usually run all the tests against a real Redis instance running locally. Is there a reason why that approach won't work for you?

u2 commented 8 years ago

I have thought it over, real Redis instance is not a problem.I just had be influenced by my habit.Thank you.

soveran commented 8 years ago

No problem :-) I'll close this issue, but if at any point you need my help just let me know.

allanxavierm commented 8 years ago

@soveran My test environments doesn't have redis installed, so in that case how can I mock Ohm.

soveran commented 8 years ago

Hello @allanxavierm, can you tell me more about your test environment? Is there a reason why you can't install Redis in there?

r4do commented 8 years ago

Hi @soveran, I have similar problem - can't use real redis instance on my ci server because there are very important data in redis. So if I'll corrupt them, I'll have big problems with that data. Any advices how can I mock redis for Ohm?

soveran commented 8 years ago

Where do you run your CI environment? I ask because usually you can start a redis-server instance (without your production data) and run the tests against it. Maybe we can find a solution for your CI server.

r4do commented 8 years ago

It's my production server. Running second redis instance makes problem to start it.

scalp42 commented 7 years ago

Same issue here, hoping there's a way to pass a different driver to the connection like this:

Redis.new(db: 0, timeout: 2.0, driver: Redis::Connection::Memory)