Skip to content

Commit

Permalink
Fix tests in railties
Browse files Browse the repository at this point in the history
  • Loading branch information
drogus committed Dec 18, 2010
1 parent 4eb0d58 commit d9b732f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions railties/test/railties/engine_test.rb
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions railties/test/railties/railtie_test.rb
Expand Up @@ -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

Expand Down

0 comments on commit d9b732f

Please sign in to comment.