Sha256: 7ffc7f3c941feec6ad71166a0a3ba48cc3a2e02391f20fa9223ce6ad0571d847

Contents?: true

Size: 859 Bytes

Versions: 6

Compression:

Stored size: 859 Bytes

Contents

dir = File.dirname(File.expand_path(__FILE__))
$LOAD_PATH.unshift dir + '/../lib'

require 'rubygems'
require 'test/unit'
require 'related'

#
# make sure we can run redis
#

if !system("which redis-server")
  puts '', "** can't find `redis-server` in your path"
  puts "** try running `sudo rake install`"
  abort ''
end


#
# start our own redis when the tests start,
# kill it when they end
#

at_exit do
  next if $!

  if defined?(MiniTest)
    exit_code = MiniTest::Unit.new.run(ARGV)
  else
    exit_code = Test::Unit::AutoRunner.run
  end

  pid = `ps -A -o pid,command | grep [r]edis-test`.split(" ")[0]
  puts "Killing test redis server..."
  `rm -f #{dir}/dump.rdb`
  Process.kill("KILL", pid.to_i)
  exit exit_code
end

puts "Starting redis for testing at localhost:9736..."
`redis-server #{dir}/redis-test.conf`
Related.redis = 'localhost:9736'

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
related-0.5.0 test/test_helper.rb
related-0.4.0 test/test_helper.rb
related-0.3.1 test/test_helper.rb
related-0.3.0 test/test_helper.rb
related-0.2.1 test/test_helper.rb
related-0.2 test/test_helper.rb