mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Wrap CGIResponse, LegacyRouteSet, Route, RouteSet and RouteLoading tests inside mocha block.
This commit is contained in:
parent
ceb5b6dbb1
commit
d5539958a8
2 changed files with 1751 additions and 1778 deletions
|
@ -115,35 +115,37 @@ class CgiRequestNeedsRewoundTest < BaseCgiTest
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class CgiResponseTest < BaseCgiTest
|
uses_mocha 'CGI Response' do
|
||||||
def setup
|
class CgiResponseTest < BaseCgiTest
|
||||||
super
|
def setup
|
||||||
@fake_cgi.expects(:header).returns("HTTP/1.0 200 OK\nContent-Type: text/html\n")
|
super
|
||||||
@response = ActionController::CgiResponse.new(@fake_cgi)
|
@fake_cgi.expects(:header).returns("HTTP/1.0 200 OK\nContent-Type: text/html\n")
|
||||||
@output = StringIO.new('')
|
@response = ActionController::CgiResponse.new(@fake_cgi)
|
||||||
end
|
@output = StringIO.new('')
|
||||||
|
|
||||||
def test_simple_output
|
|
||||||
@response.body = "Hello, World!"
|
|
||||||
|
|
||||||
@response.out(@output)
|
|
||||||
assert_equal "HTTP/1.0 200 OK\nContent-Type: text/html\nHello, World!", @output.string
|
|
||||||
end
|
|
||||||
|
|
||||||
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\n", @output.string
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_streaming_block
|
|
||||||
@response.body = Proc.new do |response, output|
|
|
||||||
5.times { |n| output.write(n) }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@response.out(@output)
|
def test_simple_output
|
||||||
assert_equal "HTTP/1.0 200 OK\nContent-Type: text/html\n01234", @output.string
|
@response.body = "Hello, World!"
|
||||||
|
|
||||||
|
@response.out(@output)
|
||||||
|
assert_equal "HTTP/1.0 200 OK\nContent-Type: text/html\nHello, World!", @output.string
|
||||||
|
end
|
||||||
|
|
||||||
|
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\n", @output.string
|
||||||
|
end
|
||||||
|
|
||||||
|
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
|
||||||
end
|
end
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue