0
require 'abstract_unit'
0
+require 'action_controller'
0
-module ActionController; module Routing; module Routes; end end end
0
class RailsFCGIHandlerTest < Test::Unit::TestCase
0
@@ -131,19 +130,11 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase
0
- alias_method :old_dispatch, :dispatch
0
- signal ? Process.kill(signal, $$) : old_dispatch
0
@handler = RailsFCGIHandler.new(@log)
0
+ Dispatcher.stubs(:new).returns(@dispatcher)
0
def test_interrupted_via_HUP_when_not_in_request
0
@@ -159,19 +150,6 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase
0
assert_equal :reload, @handler.when_ready
0
- def test_interrupted_via_HUP_when_in_request
0
- FCGI.expects(:each_cgi).once.yields(cgi)
0
- Dispatcher.expects(:signal).times(2).returns('HUP')
0
- @handler.expects(:reload!).once
0
- @handler.expects(:close_connection).never
0
- @handler.expects(:exit).never
0
- assert_equal :reload, @handler.when_ready
0
def test_interrupted_via_USR1_when_not_in_request
0
FCGI.expects(:each_cgi).once.yields(cgi)
0
@@ -186,19 +164,6 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase
0
assert_nil @handler.when_ready
0
- def test_interrupted_via_USR1_when_in_request
0
- FCGI.expects(:each_cgi).once.yields(cgi)
0
- Dispatcher.expects(:signal).times(2).returns('USR1')
0
- @handler.expects(:reload!).never
0
- @handler.expects(:close_connection).with(cgi).once
0
- @handler.expects(:exit).never
0
- assert_equal :exit, @handler.when_ready
0
def test_restart_via_USR2_when_in_request
0
FCGI.expects(:each_cgi).once.yields(cgi)
0
@@ -217,7 +182,7 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase
0
def test_interrupted_via_TERM
0
FCGI.expects(:each_cgi).once.yields(cgi)
0
-
Dispatcher.expects(:signal).times(2).returns('TERM')
0
+
::Rack::Handler::FastCGI.expects(:serve).once.returns('TERM')
0
@handler.expects(:reload!).never
0
@handler.expects(:close_connection).never
0
@@ -238,7 +203,7 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase
0
error = RuntimeError.new('foo')
0
FCGI.expects(:each_cgi).once.yields(cgi)
0
-
Dispatcher.expects(:dispatch).once.with(cgi).raises(error)
0
+
::Rack::Handler::FastCGI.expects(:serve).once.raises(error)
0
@handler.expects(:dispatcher_error).with(error, regexp_matches(/^unhandled/))
0
@@ -254,7 +219,7 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase
0
error = SignalException.new('USR2')
0
FCGI.expects(:each_cgi).once.yields(cgi)
0
-
Dispatcher.expects(:dispatch).once.with(cgi).raises(error)
0
+
::Rack::Handler::FastCGI.expects(:serve).once.raises(error)
0
@handler.expects(:dispatcher_error).with(error, regexp_matches(/^stopping/))
0
@@ -284,7 +249,7 @@ class RailsFCGIHandlerPeriodicGCTest < Test::Unit::TestCase
0
FCGI.expects(:each_cgi).times(10).yields(cgi)
0
- Dispatcher.expects(:
dispatch).times(10).with(cgi)
0
+ Dispatcher.expects(:
new).times(10)
0
@handler.expects(:run_gc!).never
0
9.times { @handler.process! }