提交 d9b732fc 编写于 作者: P Piotr Sarnacki

Fix tests in railties

上级 4eb0d580
......@@ -90,7 +90,7 @@ class Engine < ::Rails::Engine
env = Rack::MockRequest.env_for("/bukkits")
response = Rails.application.call(env)
assert_equal ["HELLO WORLD"], response[2]
assert_equal rack_body(["HELLO WORLD"]), rack_body(response[2])
end
test "it provides routes as default endpoint" do
......@@ -117,7 +117,7 @@ class Engine < ::Rails::Engine
env = Rack::MockRequest.env_for("/bukkits/foo")
response = Rails.application.call(env)
assert_equal ["foo"], response[2]
assert_equal rack_body(["foo"]), rack_body(response[2])
end
test "engine can load its own plugins" do
......@@ -357,15 +357,15 @@ def bar
env = Rack::MockRequest.env_for("/foo")
response = Rails.application.call(env)
assert_equal ["Something... Something... Something..."], response[2]
assert_equal rack_body(["Something... Something... Something..."]), rack_body(response[2])
env = Rack::MockRequest.env_for("/foo/show")
response = Rails.application.call(env)
assert_equal ["/foo"], response[2]
assert_equal rack_body(["/foo"]), rack_body(response[2])
env = Rack::MockRequest.env_for("/foo/bar")
response = Rails.application.call(env)
assert_equal ["It's a bar."], response[2]
assert_equal rack_body(["It's a bar."]), rack_body(response[2])
end
test "isolated engine should include only its own routes and helpers" do
......@@ -466,23 +466,23 @@ class MyMailer < ActionMailer::Base
env = Rack::MockRequest.env_for("/bukkits/from_app")
response = AppTemplate::Application.call(env)
assert_equal ["false"], response[2]
assert_equal rack_body(["false"]), rack_body(response[2])
env = Rack::MockRequest.env_for("/bukkits/foo/show")
response = AppTemplate::Application.call(env)
assert_equal ["/bukkits/foo"], response[2]
assert_equal rack_body(["/bukkits/foo"]), rack_body(response[2])
env = Rack::MockRequest.env_for("/bukkits/foo")
response = AppTemplate::Application.call(env)
assert_equal ["Helped."], response[2]
assert_equal rack_body(["Helped."]), rack_body(response[2])
env = Rack::MockRequest.env_for("/bukkits/routes_helpers_in_view")
response = AppTemplate::Application.call(env)
assert_equal ["/bukkits/foo, /bar"], response[2]
assert_equal rack_body(["/bukkits/foo, /bar"]), rack_body(response[2])
env = Rack::MockRequest.env_for("/bukkits/polymorphic_path_without_namespace")
response = AppTemplate::Application.call(env)
assert_equal ["/bukkits/posts/1"], response[2]
assert_equal rack_body(["/bukkits/posts/1"]), rack_body(response[2])
end
test "isolated engine should avoid namespace in names if that's possible" do
......
......@@ -21,10 +21,10 @@ def app
test "Railtie provides railtie_name" do
begin
class ::Foo < Rails::Railtie ; end
assert_equal "foo", ::Foo.railtie_name
class ::FooBarBaz < Rails::Railtie ; end
assert_equal "foo_bar_baz", ::FooBarBaz.railtie_name
ensure
Object.send(:remove_const, :"Foo")
Object.send(:remove_const, :"FooBarBaz")
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册