Test: Running test destroys my local Redis data
Opened this issue · 0 comments
mishina2228 commented
This project uses Redis on localhost:6379
for testing now.
But I use it in the development of other Rails app as well.
I was wondering why the data disappeared for a while, but it was due to the following part:
resque-scheduler/test/delayed_queue_test.rb
Lines 5 to 8 in a9bbbd9
I checked what they are doing in Resque and they have Redis on localhost:9736
for testing.
https://github.com/resque/resque/blob/daf45bbbaf87411d27c0eb1df44ce463746cf5c8/test/test_helper.rb#L32-L33
# start our own redis when the tests start,
# kill it when they end
puts "Starting redis for testing at localhost:9736..."
`redis-server #{$dir}/redis-test.conf`
Resque.redis = 'localhost:9736'
I think it is a good idea to take this same approach.