aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorclaudiob <claudiob@users.noreply.github.com>2018-02-11 11:29:58 -0800
committerclaudiob <claudiob@users.noreply.github.com>2018-02-11 11:37:21 -0800
commit24284fd3d4c4f857e54181c58feea81f819d6c0c (patch)
tree652d5c9dca6265710ce4f141ff41652a8eca3ff9 /railties/test
parenta2a752d1026346e3a348682551dfc952f7cf3a58 (diff)
downloadrails-24284fd3d4c4f857e54181c58feea81f819d6c0c.tar.gz
rails-24284fd3d4c4f857e54181c58feea81f819d6c0c.tar.bz2
rails-24284fd3d4c4f857e54181c58feea81f819d6c0c.zip
Respect --force option for config/master.key
This is similar to #30700 which ensures the `--quiet` option of `rails new` is respected by the `MasterKeyGenerator` (missing from #30067). Before this commit, running `rails new app --force` would still prompt the user what to do with the conflict in `config/master.key`: ``` … identical config/locales/en.yml conflict config/master.key Overwrite /Users/claudiob/Desktop/pizza/config/master.key? (enter "h" for help) [Ynaqdh] ``` After this commit, `config/master.key` is overwritten: ``` … identical config/locales/en.yml force config/master.key append .gitignore ``` The newly added test generates an app and then generates it again with `--force`. Without this commit, the test would just wait forever for user input.
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/generators/app_generator_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 60b9ff1317..14246edf38 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -638,6 +638,12 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_empty output
end
+ def test_force_option
+ run_generator [File.join(destination_root, "myapp")]
+ output = run_generator [File.join(destination_root, "myapp"), "--force"]
+ assert_match(/force/, output)
+ end
+
def test_application_name_with_spaces
path = File.join(destination_root, "foo bar")