On Mon, Jan 17, 2011 at 7:14 PM, Rob Watson <rfwat...@gmail.com> wrote:
> Hi list
>
> I find that Redis repeatedly returns inconsistent and unexpected values for 
> keys in my test environment. So every time I
> run a suite of specs, a few of them fail, seemingly randomly. The specs are 
> usually very simple, and often just testing
> the contents of simple string keys in Redis. The results *seem* like they 
> might come from a different object or instance
> variable of the same type/name: so they're always seemingly valid values, but 
> don't actually relate to the spec currently
> being performed. So the spec fails.
> [snip]
> Anybody experienced anything similar?

This happened to me but before I setup redis to use a different
database for my test environment.

I have a specific redis.yml that contains this:

development:
  url: redis://localhost:6769/0

test:
  url: redis://localhost:6769/1

In that way, databases are keep separated from each other.

It is also important that you flush all the keys of your redis
instance between tests. Similar to what RSpec does for your database,
you need to perform it for redis.

I do it using a before(:each) { $redis.flushall }

Just to ensure integrity and no leftover from my previous test.

Will be great if you can show a little bit about your specs (exact
spec code) and configuration so we can try replicate. Sometimes the
error is there, but hidden somewhere else.
-- 
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to