aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-01-06 04:51:44 -0200
committerRafael França <rafaelmfranca@gmail.com>2016-01-06 04:51:44 -0200
commit0ff3e9466a4f476ee2e56d9e2b40acce01924683 (patch)
tree2a76dae2f2b948f3b7cf43c817d03e041b714ef9 /railties/lib
parentc6bdaf1282e44c2aca8611b900bd1a7f55cd3d12 (diff)
parent229064cf3a4da96ad3e30114d99288bf6660ed58 (diff)
downloadrails-0ff3e9466a4f476ee2e56d9e2b40acce01924683.tar.gz
rails-0ff3e9466a4f476ee2e56d9e2b40acce01924683.tar.bz2
rails-0ff3e9466a4f476ee2e56d9e2b40acce01924683.zip
Merge pull request #22939 from y-yagi/make_generated_controller_test_file_work_correctly
make generated controller test work correctly
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/generators/named_base.rb4
-rw-r--r--railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb2
2 files changed, 5 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/named_base.rb b/railties/lib/rails/generators/named_base.rb
index 658d883883..efbf51ddfb 100644
--- a/railties/lib/rails/generators/named_base.rb
+++ b/railties/lib/rails/generators/named_base.rb
@@ -161,6 +161,10 @@ module Rails
@route_url ||= class_path.collect {|dname| "/" + dname }.join + "/" + plural_file_name
end
+ def url_helper_prefix
+ @url_helper_prefix ||= (class_path + [file_name]).join('_')
+ end
+
# Tries to retrieve the application name or simply return application.
def application_name
if defined?(Rails) && Rails.application
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 4f2ceb8589..ff41fef9e9 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
@@ -13,7 +13,7 @@ class <%= class_name %>ControllerTest < ActionDispatch::IntegrationTest
<% else -%>
<% actions.each do |action| -%>
test "should get <%= action %>" do
- get <%= file_name %>_<%= action %>_url
+ get <%= url_helper_prefix %>_<%= action %>_url
assert_response :success
end