diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-04-03 20:00:33 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-04-03 20:00:33 +0000 |
commit | cfe42ba1b19c5ee96a268dbb85cece16c0cc354b (patch) | |
tree | 778bbb91a17aadf6d89ec3613951bf6073022ff9 | |
parent | 940cf0cacdd2abe235063f82a1b54523a6976a1b (diff) | |
download | rails-cfe42ba1b19c5ee96a268dbb85cece16c0cc354b.tar.gz rails-cfe42ba1b19c5ee96a268dbb85cece16c0cc354b.tar.bz2 rails-cfe42ba1b19c5ee96a268dbb85cece16c0cc354b.zip |
Update fcgi dispatcher test cases. Closes #11471 [guillaume]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9220 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | railties/test/fcgi_dispatcher_test.rb | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/railties/test/fcgi_dispatcher_test.rb b/railties/test/fcgi_dispatcher_test.rb index 7e84402a21..6134211022 100644 --- a/railties/test/fcgi_dispatcher_test.rb +++ b/railties/test/fcgi_dispatcher_test.rb @@ -59,11 +59,12 @@ class RailsFCGIHandlerTest < Test::Unit::TestCase @handler.process! end - def test_restart_handler + def test_restart_handler_outside_request @handler.expects(:dispatcher_log).with(:info, "asked to restart ASAP") + @handler.expects(:restart!).once @handler.send(:restart_handler, nil) - assert_equal :restart, @handler.when_ready + assert_equal nil, @handler.when_ready end def test_install_signal_handler_should_log_on_bad_signal @@ -131,7 +132,7 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase def test_interrupted_via_HUP_when_not_in_request cgi = mock FCGI.expects(:each_cgi).once.yields(cgi) - @handler.expects(:gc_countdown).returns { Process.kill 'HUP', $$ } + @handler.expects(:gc_countdown).returns(lambda { Process.kill 'HUP', $$ } ) @handler.expects(:reload!).once @handler.expects(:close_connection).never @@ -144,7 +145,7 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase def test_interrupted_via_HUP_when_in_request cgi = mock FCGI.expects(:each_cgi).once.yields(cgi) - Dispatcher.expects(:dispatch).with(cgi).returns { Process.kill 'HUP', $$ } + Dispatcher.expects(:dispatch).with(cgi).returns( lambda { Process.kill 'HUP', $$ } ) @handler.expects(:reload!).once @handler.expects(:close_connection).never @@ -157,7 +158,7 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase def test_interrupted_via_USR1_when_not_in_request cgi = mock FCGI.expects(:each_cgi).once.yields(cgi) - @handler.expects(:gc_countdown).returns { Process.kill 'USR1', $$ } + @handler.expects(:gc_countdown).returns( lambda { Process.kill 'USR1', $$ } ) @handler.expects(:exit_handler).never @handler.expects(:reload!).never @@ -171,7 +172,7 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase def test_interrupted_via_USR1_when_in_request cgi = mock FCGI.expects(:each_cgi).once.yields(cgi) - Dispatcher.expects(:dispatch).with(cgi).returns { Process.kill 'USR1', $$ } + Dispatcher.expects(:dispatch).with(cgi).returns( lambda { Process.kill 'USR1', $$ } ) @handler.expects(:reload!).never @handler.expects(:close_connection).with(cgi).once @@ -181,10 +182,25 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase assert_equal :exit, @handler.when_ready end + def test_restart_via_USR2_when_in_request + cgi = mock + FCGI.expects(:each_cgi).once.yields(cgi) + @handler.expects(:gc_countdown).returns( lambda { Process.kill 'USR2', $$ } ) + @handler.expects(:exit_handler).never + + @handler.expects(:reload!).never + @handler.expects(:close_connection).with(cgi).once + @handler.expects(:exit).never + @handler.expects(:restart!).once + + @handler.process! + assert_equal :restart, @handler.when_ready + end + def test_interrupted_via_TERM cgi = mock FCGI.expects(:each_cgi).once.yields(cgi) - Dispatcher.expects(:dispatch).with(cgi).returns { Process.kill 'TERM', $$ } + Dispatcher.expects(:dispatch).with(cgi).returns(lambda { Process.kill 'TERM', $$ }) @handler.expects(:reload!).never @handler.expects(:close_connection).never |