test/test_helper.rb in resque-retry-0.2.2 vs test/test_helper.rb in resque-retry-1.0.0.a

- old
+ new

@@ -1,23 +1,25 @@ dir = File.dirname(File.expand_path(__FILE__)) $LOAD_PATH.unshift dir + '/../lib' $TESTING = true -gem 'minitest' +require 'rubygems' require 'minitest/unit' require 'minitest/pride' require 'rack/test' -require 'simplecov' +require 'mocha' -SimpleCov.start do - add_filter "/test/" +if RUBY_ENGINE == 'ruby' && RUBY_VERSION >= '1.9' + require 'simplecov' + SimpleCov.start do + add_filter '/test/' + end end require 'resque-retry' require dir + '/test_jobs' - # 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 '' @@ -27,19 +29,15 @@ # 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 + exit_code = MiniTest::Unit.new.run(ARGV) pid = `ps -e -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) + `kill -9 #{pid}` exit exit_code end puts "Starting redis for testing at localhost:9736..." `redis-server #{dir}/redis-test.conf`