Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: fa08bd4122
Fetching contributors…

Cannot retrieve contributors at this time

21 lines (18 sloc) 0.641 kB
# RAILS_ROOT/lib/redis_test_setup.rb
module RedisTestSetup
def start_redis!(rails_root, env)
dir_temp = File.expand_path(File.join(rails_root, 'log'))
dir_conf = File.expand_path(File.join(rails_root, 'config'))
cwd = Dir.getwd
Dir.chdir(rails_root)
raise "unable to launch redis-server" unless system("redis-server #{dir_conf}/redis-#{env}.conf")
Dir.chdir(cwd)
at_exit do
if (pid = `cat #{dir_temp}/redis-#{env}.pid`.strip) =~ /^\d+$/
`rm -f #{dir_temp}/redis-cucumber-#{env}.rdb`
`rm -f #{dir_temp}/redis-#{env}.pid`
Process.kill("KILL", pid.to_i)
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.