From ea464b142e197aa1f64097e98c8dc433b969ebf9 Mon Sep 17 00:00:00 2001 From: Peter Wagenet Date: Thu, 5 Feb 2009 22:46:03 -0500 Subject: [PATCH] Fixed FCGI tests --- railties/test/fcgi_dispatcher_test.rb | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/railties/test/fcgi_dispatcher_test.rb b/railties/test/fcgi_dispatcher_test.rb index c469c5d..dc6ffad 100644 --- a/railties/test/fcgi_dispatcher_test.rb +++ b/railties/test/fcgi_dispatcher_test.rb @@ -9,7 +9,7 @@ class RailsFCGIHandlerTest < Test::Unit::TestCase @log = StringIO.new @handler = RailsFCGIHandler.new(@log) end - + def test_process_restart cgi = mock FCGI.stubs(:each_cgi).yields(cgi) @@ -129,7 +129,7 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase signal ? Process.kill(signal, $$) : old_gc_countdown end end - + def setup @log = StringIO.new @handler = RailsFCGIHandler.new(@log) @@ -180,7 +180,7 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase end def test_interrupted_via_TERM - cgi = mock + cgi = mock("cgi", :id => 1, :env_table => "env", :stdinput => "in", :stdoutput => "out") FCGI.expects(:each_cgi).once.yields(cgi) ::Rack::Handler::FastCGI.expects(:serve).once.returns('TERM') @@ -200,7 +200,7 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase end def test_runtime_error_in_dispatcher - cgi = mock + cgi = mock("cgi", :id => 1, :env_table => "env", :stdinput => "in", :stdoutput => "out") error = RuntimeError.new('foo') FCGI.expects(:each_cgi).once.yields(cgi) ::Rack::Handler::FastCGI.expects(:serve).once.raises(error) @@ -216,7 +216,7 @@ class RailsFCGIHandlerSignalsTest < Test::Unit::TestCase end def test_signal_exception_in_dispatcher - cgi = mock + cgi = mock("cgi", :id => 1, :env_table => "env", :stdinput => "in", :stdoutput => "out") error = SignalException.new('USR2') FCGI.expects(:each_cgi).once.yields(cgi) ::Rack::Handler::FastCGI.expects(:serve).once.raises(error) @@ -247,7 +247,7 @@ class RailsFCGIHandlerPeriodicGCTest < Test::Unit::TestCase @handler = RailsFCGIHandler.new(@log, 10) assert_equal 10, @handler.gc_request_period - cgi = mock + cgi = stub("cgi", :id => 1, :env_table => "env", :stdinput => "in", :stdoutput => "out") FCGI.expects(:each_cgi).times(10).yields(cgi) Dispatcher.expects(:new).times(10) -- 1.5.5 From 0370a0e8106686b25d80b4ed6f9780a0bd7cb963 Mon Sep 17 00:00:00 2001 From: Peter Wagenet Date: Thu, 5 Feb 2009 15:28:13 -0500 Subject: [PATCH] Fixed FCGI handling --- railties/lib/fcgi_handler.rb | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/railties/lib/fcgi_handler.rb b/railties/lib/fcgi_handler.rb index 1256ef2..53f555d 100644 --- a/railties/lib/fcgi_handler.rb +++ b/railties/lib/fcgi_handler.rb @@ -1,3 +1,4 @@ +FCGI_PURE_RUBY = true require 'fcgi' require 'logger' require 'dispatcher' @@ -98,6 +99,7 @@ class RailsFCGIHandler with_signal_handler 'USR1' do begin + cgi = FCGI::Request.new(cgi.id, cgi.env_table, cgi.stdinput, cgi.stdoutput) ::Rack::Handler::FastCGI.serve(cgi, Dispatcher.new) rescue SignalException, SystemExit raise -- 1.5.5