aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2018-04-22 03:23:46 -0500
committerGitHub <noreply@github.com>2018-04-22 03:23:46 -0500
commit7316f3696a9a595382c4bf278ac4019a978cce30 (patch)
tree70fd026480d5dc649b98c5735dc51a875f4e603a /railties/test
parente4a0a048836512432b43c7fb623d32de2496a346 (diff)
parent6df0bd156af8e9229dd3069260a469c29a1e0fe3 (diff)
downloadrails-7316f3696a9a595382c4bf278ac4019a978cce30.tar.gz
rails-7316f3696a9a595382c4bf278ac4019a978cce30.tar.bz2
rails-7316f3696a9a595382c4bf278ac4019a978cce30.zip
Merge pull request #31554 from fatkodima/controller_generator_suffix
Gracefully handle extra "controller" when generating controller
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/generators/controller_generator_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/railties/test/generators/controller_generator_test.rb b/railties/test/generators/controller_generator_test.rb
index 91e4a86775..021004c9b8 100644
--- a/railties/test/generators/controller_generator_test.rb
+++ b/railties/test/generators/controller_generator_test.rb
@@ -116,4 +116,26 @@ class ControllerGeneratorTest < Rails::Generators::TestCase
assert_no_match(/namespace :admin/, routes)
end
end
+
+ def test_controller_suffix_is_not_duplicated
+ run_generator ["account_controller"]
+
+ assert_no_file "app/controllers/account_controller_controller.rb"
+ assert_file "app/controllers/account_controller.rb"
+
+ assert_no_file "app/views/account_controller/"
+ assert_file "app/views/account/"
+
+ assert_no_file "test/controllers/account_controller_controller_test.rb"
+ assert_file "test/controllers/account_controller_test.rb"
+
+ assert_no_file "app/helpers/account_controller_helper.rb"
+ assert_file "app/helpers/account_helper.rb"
+
+ assert_no_file "app/assets/javascripts/account_controller.js"
+ assert_file "app/assets/javascripts/account.js"
+
+ assert_no_file "app/assets/stylesheets/account_controller.css"
+ assert_file "app/assets/stylesheets/account.css"
+ end
end