diff options
author | claudiob <claudiob@gmail.com> | 2016-02-20 09:56:35 -0800 |
---|---|---|
committer | claudiob <claudiob@gmail.com> | 2016-02-20 10:01:55 -0800 |
commit | 1a5941e3cfb67056a9468d590f8ae03485f75ccc (patch) | |
tree | a018ded99f6afc44c2d113c2d29e602935ab0251 /railties/test | |
parent | e76891314126b10d5cf57aaf776dfa2a26553ec3 (diff) | |
download | rails-1a5941e3cfb67056a9468d590f8ae03485f75ccc.tar.gz rails-1a5941e3cfb67056a9468d590f8ae03485f75ccc.tar.bz2 rails-1a5941e3cfb67056a9468d590f8ae03485f75ccc.zip |
AppGenerator: Replace 'rake' with 'rails_command'
Since Rails 5.0 is switching the Rails command line from 'rake …'
to 'rails …', it makes sense to also replace the `rake` method in
the Rails templates API.
Based on feedback from @matthewd and @kaspth, I chose to replace
`rake` with `rails_command`, which is less confusing than
the alternatives `rails` or `command` or `rails_run` and is not
Thor-reserved word like `task`.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/actions_test.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index 3300850604..6cc52cb30d 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -239,6 +239,44 @@ class ActionsTest < Rails::Generators::TestCase end end + def test_rails_command_should_run_rails_command_with_default_env + assert_called_with(generator, :run, ["rake log:clear RAILS_ENV=development", verbose: false]) do + with_rails_env nil do + action :rails_command, 'log:clear' + end + end + end + + def test_rails_command_with_env_option_should_run_rails_command_in_env + assert_called_with(generator, :run, ['rake log:clear RAILS_ENV=production', verbose: false]) do + action :rails_command, 'log:clear', env: 'production' + end + end + + def test_rails_command_with_rails_env_variable_should_run_rails_command_in_env + assert_called_with(generator, :run, ['rake log:clear RAILS_ENV=production', verbose: false]) do + with_rails_env "production" do + action :rails_command, 'log:clear' + end + end + end + + def test_env_option_should_win_over_rails_env_variable_when_running_rails + assert_called_with(generator, :run, ['rake log:clear RAILS_ENV=production', verbose: false]) do + with_rails_env "staging" do + action :rails_command, 'log:clear', env: 'production' + end + end + end + + def test_rails_command_with_sudo_option_should_run_rails_command_with_sudo + assert_called_with(generator, :run, ["sudo rake log:clear RAILS_ENV=development", verbose: false]) do + with_rails_env nil do + action :rails_command, 'log:clear', sudo: true + end + end + end + def test_capify_should_run_the_capify_command assert_called_with(generator, :run, ['capify .', verbose: false]) do action :capify! |