diff options
Diffstat (limited to 'actionpack/test/controller/cgi_test.rb')
-rwxr-xr-x | actionpack/test/controller/cgi_test.rb | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/actionpack/test/controller/cgi_test.rb b/actionpack/test/controller/cgi_test.rb index f0f3a4b826..1b1ded4615 100755 --- a/actionpack/test/controller/cgi_test.rb +++ b/actionpack/test/controller/cgi_test.rb @@ -115,35 +115,37 @@ class CgiRequestNeedsRewoundTest < BaseCgiTest end end -class CgiResponseTest < BaseCgiTest - def setup - super - @fake_cgi.expects(:header).returns("HTTP/1.0 200 OK\nContent-Type: text/html\n") - @response = ActionController::CgiResponse.new(@fake_cgi) - @output = StringIO.new('') - end - - def test_simple_output - @response.body = "Hello, World!" +uses_mocha 'CGI Response' do + class CgiResponseTest < BaseCgiTest + def setup + super + @fake_cgi.expects(:header).returns("HTTP/1.0 200 OK\nContent-Type: text/html\n") + @response = ActionController::CgiResponse.new(@fake_cgi) + @output = StringIO.new('') + end - @response.out(@output) - assert_equal "HTTP/1.0 200 OK\nContent-Type: text/html\nHello, World!", @output.string - end + def test_simple_output + @response.body = "Hello, World!" - def test_head_request - @fake_cgi.env_table['REQUEST_METHOD'] = 'HEAD' - @response.body = "Hello, World!" + @response.out(@output) + assert_equal "HTTP/1.0 200 OK\nContent-Type: text/html\nHello, World!", @output.string + end - @response.out(@output) - assert_equal "HTTP/1.0 200 OK\nContent-Type: text/html\n", @output.string - end + def test_head_request + @fake_cgi.env_table['REQUEST_METHOD'] = 'HEAD' + @response.body = "Hello, World!" - def test_streaming_block - @response.body = Proc.new do |response, output| - 5.times { |n| output.write(n) } + @response.out(@output) + assert_equal "HTTP/1.0 200 OK\nContent-Type: text/html\n", @output.string end - @response.out(@output) - assert_equal "HTTP/1.0 200 OK\nContent-Type: text/html\n01234", @output.string + def test_streaming_block + @response.body = Proc.new do |response, output| + 5.times { |n| output.write(n) } + end + + @response.out(@output) + assert_equal "HTTP/1.0 200 OK\nContent-Type: text/html\n01234", @output.string + end end end |