From 7a3ebef424f3e7db0a48ae35885c446d79b7d971 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 17 Oct 2009 22:42:55 -0700 Subject: Revactor tests can sleep more easily Since we export "rainbows.model" to Rack now, we don't have to worry about setting the "SLEEP_CLASS" env for the application. --- t/sleep.ru | 13 +++++++++---- t/t3002-revactor-graceful.sh | 2 +- t/t3003-revactor-reopen-logs.sh | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/t/sleep.ru b/t/sleep.ru index 66b29af..8b3499b 100644 --- a/t/sleep.ru +++ b/t/sleep.ru @@ -1,11 +1,16 @@ use Rack::ContentLength use Rack::ContentType -sleep_class = ENV['SLEEP_CLASS'] -sleep_class = sleep_class ? Object.const_get(sleep_class) : Kernel -$stderr.puts "sleep_class=#{sleep_class.inspect}" + run lambda { |env| nr = 1 env["PATH_INFO"] =~ %r{/([\d\.]+)\z} and nr = $1.to_f - sleep_class.sleep(nr) + + (case env['rainbows.model'] + when :Revactor + Actor + else + Kernel + end).sleep(nr) + [ 200, {}, [ "Hello\n" ] ] } diff --git a/t/t3002-revactor-graceful.sh b/t/t3002-revactor-graceful.sh index 2a766be..67c6ba3 100755 --- a/t/t3002-revactor-graceful.sh +++ b/t/t3002-revactor-graceful.sh @@ -17,7 +17,7 @@ Rainbows! do end EOF -SLEEP_CLASS=Actor rainbows -D sleep.ru -c $unicorn_config +rainbows -D sleep.ru -c $unicorn_config wait_for_pid $pid for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}"