提交 3c181f66 编写于 作者: T Thiago Pradi

Removing old helper that was necessary for compatibility with Ruby 1.8.x

上级 48a0995c
......@@ -57,19 +57,6 @@ def env
FIXTURE_LOAD_PATH = File.join(File.dirname(__FILE__), 'fixtures')
module RackTestUtils
def body_to_string(body)
if body.respond_to?(:each)
str = ""
body.each {|s| str << s }
str
else
body
end
end
extend self
end
SharedTestRoutes = ActionDispatch::Routing::RouteSet.new
module ActionDispatch
......
......@@ -18,8 +18,6 @@ def call(env)
end
class TestMiddleware < ActiveSupport::TestCase
include RackTestUtils
def setup
@app = Rack::Builder.new do
use MetalTest::MetalMiddleware
......@@ -31,14 +29,14 @@ def setup
env = Rack::MockRequest.env_for("/authed")
response = @app.call(env)
assert_equal "Hello World", body_to_string(response[2])
assert_equal ["Hello World"], response[2]
end
test "it can return a response using the normal AC::Metal techniques" do
env = Rack::MockRequest.env_for("/")
response = @app.call(env)
assert_equal "Not authed!", body_to_string(response[2])
assert_equal ["Not authed!"], response[2]
assert_equal 401, response[0]
end
end
......
......@@ -75,7 +75,7 @@ def setup
test "middleware that is 'use'd is called as part of the Rack application" do
result = @app.call(env_for("/"))
assert_equal "Hello World", RackTestUtils.body_to_string(result[2])
assert_equal ["Hello World"], result[2]
assert_equal "Success", result[1]["Middleware-Test"]
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册