aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/route_inspect_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test/application/route_inspect_test.rb')
-rw-r--r--railties/test/application/route_inspect_test.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/railties/test/application/route_inspect_test.rb b/railties/test/application/route_inspect_test.rb
index 78980705ed..130d4e52f8 100644
--- a/railties/test/application/route_inspect_test.rb
+++ b/railties/test/application/route_inspect_test.rb
@@ -1,6 +1,7 @@
require 'test/unit'
require 'rails/application/route_inspector'
require 'action_controller'
+require 'rails/engine'
module ApplicationTests
class RouteInspectTest < Test::Unit::TestCase
@@ -9,6 +10,35 @@ module ApplicationTests
@inspector = Rails::Application::RouteInspector.new
end
+ def test_displaying_routes_for_engines
+ ENV["ENGINES"] = "true"
+
+ engine = Class.new(Rails::Engine) do
+ def self.to_s
+ "Blog::Engine"
+ end
+ end
+ engine.routes.draw do
+ get '/cart', :to => 'cart#show'
+ end
+
+ @set.draw do
+ get '/custom/assets', :to => 'custom_assets#show'
+ mount engine => "/blog", :as => "blog"
+ end
+
+ output = @inspector.format @set.routes
+ expected = [
+ "custom_assets GET /custom/assets(.:format) custom_assets#show",
+ " blog /blog Blog::Engine",
+ "\nRoutes for Blog::Engine:",
+ "cart GET /cart(.:format) cart#show"
+ ]
+ assert_equal expected, output
+ ensure
+ ENV["ENGINES"] = nil
+ end
+
def test_cart_inspect
@set.draw do
get '/cart', :to => 'cart#show'