Running the test suite twice gives me this error:
ActiveRecord::RecordNotFound in 'Question catchup algorithm should create a delayed job after requesting a prompt'
Couldn't find Prompt with ID=1937
It happens because Redis isn't flushed before the test finished, so when we run again, bad things happen. I can see 3 ways to fix it.
If you think it's possible, I think mocking redis is the best option. It'll probably make the tests run much faster, in exchange of not breaking if we do something bad with the redis integration.
My second option would be to flush redis after each test (vitorbaptista/pairwise-api@24e9ad9). This is very easy to do, but makes the tests slower. In my machine, without this patch, they take ~290s. WIth it, they take 320s.
We could flush only once, when the tests start running, so the performance hit is lessened. But I still prefer running each time, just to be sure that the tests are independent.
What do you think?
Mocking redis sounds like it may be the best option, though flushing redis wouldn't be horrible either. Our tests aren't very fast to begin with so another 30 seconds would be acceptable at this point in my mind.
Mocking redis is easy enough that might be better than flushing.
We just need to add the mock_redis Gem to :test and :cucumber groups and add $redis = MockRedis.new somewhere (i.e. spec/spec_helper.rb)
I can send another pull request after you review my first one, or you can go ahead and do it. Whatever you prefer.
Is there any place where I can find you and/or other allourideas' developers? IRC or email... I'm working with pairwise and allourideas.org and I have some questions to make, but I feel github issues isn't the right place to ask :P
Vitor, I merged your other pull request. Thanks!
Mock Redis during our tests (fixes #18)