From 6a8d91897bae19f5d30f51a2731d9bbf7f41ac2e Mon Sep 17 00:00:00 2001
From: "yuuji.yaginuma" <yuuji.yaginuma@gmail.com>
Date: Tue, 5 May 2015 22:40:16 +0900
Subject: set engine's route in the functional test is generated in the engine

---
 .../generators/test_unit/controller/templates/functional_test.rb    | 6 ++++++
 .../generators/test_unit/scaffold/templates/functional_test.rb      | 3 +++
 2 files changed, 9 insertions(+)

(limited to 'railties/lib')

diff --git a/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb b/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb
index 509bd60564..7106096b60 100644
--- a/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb
+++ b/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb
@@ -2,6 +2,12 @@ require 'test_helper'
 
 <% module_namespacing do -%>
 class <%= class_name %>ControllerTest < ActionController::TestCase
+<% if defined?(ENGINE_ROOT) -%>
+  setup do
+    @routes = Engine.routes
+  end
+
+<% end -%>
 <% if actions.empty? -%>
   # test "the truth" do
   #   assert true
diff --git a/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb b/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb
index 76313575e9..d2799994f1 100644
--- a/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb
+++ b/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb
@@ -4,6 +4,9 @@ require 'test_helper'
 class <%= controller_class_name %>ControllerTest < ActionController::TestCase
   setup do
     @<%= singular_table_name %> = <%= table_name %>(:one)
+<% if defined?(ENGINE_ROOT) -%>
+    @routes = Engine.routes
+<% end -%>
   end
 
   test "should get index" do
-- 
cgit v1.2.3