Wrap CGIResponse, LegacyRouteSet, Route, RouteSet and RouteLoading tests inside mocha block.

This commit is contained in:
Joshua Peek 2008-06-07 23:42:05 -05:00
parent ceb5b6dbb1
commit d5539958a8
2 changed files with 1751 additions and 1778 deletions

View File

@ -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!"
@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) }
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\n01234", @output.string
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
@response.out(@output)
assert_equal "HTTP/1.0 200 OK\nContent-Type: text/html\n01234", @output.string
end
end
end

File diff suppressed because it is too large Load Diff