diff options
author | Gannon McGibbon <gannon.mcgibbon@gmail.com> | 2018-12-12 12:22:59 -0500 |
---|---|---|
committer | Gannon McGibbon <gannon.mcgibbon@gmail.com> | 2018-12-12 12:22:59 -0500 |
commit | 886ac1c3087f8ac06bee371af54758fb02760e63 (patch) | |
tree | 699f7a15a2ff28854b2ae089ae69a40f14b423c0 /railties | |
parent | 662f14814eacdc100d0cd511aa05db34119de18a (diff) | |
download | rails-886ac1c3087f8ac06bee371af54758fb02760e63.tar.gz rails-886ac1c3087f8ac06bee371af54758fb02760e63.tar.bz2 rails-886ac1c3087f8ac06bee371af54758fb02760e63.zip |
Remove redundant suffixes on generated helpers.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/CHANGELOG.md | 4 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/helper/helper_generator.rb | 5 | ||||
-rw-r--r-- | railties/test/generators/helper_generator_test.rb | 7 |
3 files changed, 16 insertions, 0 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index d2992dbbdb..a9c70c10c6 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,3 +1,7 @@ +* Remove redundant suffixes on generated helpers. + + *Gannon McGibbon* + * Fix boolean interaction in scaffold system tests. *Gannon McGibbon* diff --git a/railties/lib/rails/generators/rails/helper/helper_generator.rb b/railties/lib/rails/generators/rails/helper/helper_generator.rb index 3837c10ca0..542eb4c9e8 100644 --- a/railties/lib/rails/generators/rails/helper/helper_generator.rb +++ b/railties/lib/rails/generators/rails/helper/helper_generator.rb @@ -10,6 +10,11 @@ module Rails end hook_for :test_framework + + private + def file_name + @_file_name ||= super.sub(/_helper\z/i, "") + end end end end diff --git a/railties/test/generators/helper_generator_test.rb b/railties/test/generators/helper_generator_test.rb index 4cdb6adf82..5d6b6f8f67 100644 --- a/railties/test/generators/helper_generator_test.rb +++ b/railties/test/generators/helper_generator_test.rb @@ -38,4 +38,11 @@ class HelperGeneratorTest < Rails::Generators::TestCase end end end + + def test_helper_suffix_is_not_duplicated + run_generator %w(products_helper) + + assert_no_file "app/helpers/products_helper_helper.rb" + assert_file "app/helpers/products_helper.rb" + end end |