aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2018-07-01 19:05:01 +0200
committerGitHub <noreply@github.com>2018-07-01 19:05:01 +0200
commit350b7cc9f0c69be529cae1e91294e51d41ea5952 (patch)
treeb2fd9d6395aa8e5414c3bc5108eded9bc7ac4388 /railties/test
parentdca5596f997b863a2de6a0fe1ed2c26a9f027359 (diff)
parent696ca427be70d95401a39384e2e0d2e3074e0d3e (diff)
downloadrails-350b7cc9f0c69be529cae1e91294e51d41ea5952.tar.gz
rails-350b7cc9f0c69be529cae1e91294e51d41ea5952.tar.bz2
rails-350b7cc9f0c69be529cae1e91294e51d41ea5952.zip
Merge pull request #32706 from yhirano55/fix-app-update-when-hyphenated-name-is-given
Fix app:update when hyphenated name is given
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/generators/app_generator_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index d8e9ae3369..b0f958091c 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -438,6 +438,30 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_file "config/application.rb", /\s+config\.load_defaults 5\.1/
end
+ def test_app_update_does_not_change_app_name_when_app_name_is_hyphenated_name
+ app_root = File.join(destination_root, "hyphenated-app")
+ run_generator [app_root, "-d", "postgresql"]
+
+ assert_file "#{app_root}/config/database.yml" do |content|
+ assert_match(/hyphenated_app_development/, content)
+ assert_no_match(/hyphenated-app_development/, content)
+ end
+
+ assert_file "#{app_root}/config/cable.yml" do |content|
+ assert_match(/hyphenated_app/, content)
+ assert_no_match(/hyphenated-app/, content)
+ end
+
+ FileUtils.cd(app_root) do
+ quietly { system("bin/rails app:update") }
+ end
+
+ assert_file "#{app_root}/config/cable.yml" do |content|
+ assert_match(/hyphenated_app/, content)
+ assert_no_match(/hyphenated-app/, content)
+ end
+ end
+
def test_application_names_are_not_singularized
run_generator [File.join(destination_root, "hats")]
assert_file "hats/config/environment.rb", /Rails\.application\.initialize!/