diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2019-01-19 16:39:18 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2019-01-19 16:39:18 +0900 |
commit | 82e986670389aef7a61c860bacd347c60ff0b25c (patch) | |
tree | 3a56728be6945def8210e0024bc4317f635c7a9b /railties/test/generators | |
parent | 3c6cfdf7adf4848976b7f425b1811d447b130f6a (diff) | |
download | rails-82e986670389aef7a61c860bacd347c60ff0b25c.tar.gz rails-82e986670389aef7a61c860bacd347c60ff0b25c.tar.bz2 rails-82e986670389aef7a61c860bacd347c60ff0b25c.zip |
Don't add `RAILS_ENV` in generate action
In the case of generator, `RAILS_ENV` is interpreted as an argument as it
is. Avoid this because it will result unintended by the user.
Fixes #34979.
Diffstat (limited to 'railties/test/generators')
-rw-r--r-- | railties/test/generators/actions_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index 4932100ea2..44d4e92256 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -320,6 +320,12 @@ class ActionsTest < Rails::Generators::TestCase assert_no_file "app/models/my_model.rb" end + def test_generate_should_run_command_without_env + assert_called_with(generator, :run, ["rails generate model MyModel name:string", verbose: false]) do + action :generate, "model", "MyModel", "name:string" + end + end + def test_rake_should_run_rake_command_with_default_env assert_called_with(generator, :run, ["rake log:clear RAILS_ENV=development", verbose: false]) do with_rails_env nil do |