diff options
author | Matthew Draper <matthew@trebex.net> | 2017-09-04 02:25:26 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2017-09-04 20:19:39 +0930 |
commit | 802ce8a2392d3f749e665d4f9e54790cf613aaf9 (patch) | |
tree | c918e029aabc60a84afe7714030e35e81dffc0ec /railties/test/commands | |
parent | 07bac9ef93d98a1e31cd5b2ce2aabc1e57816604 (diff) | |
download | rails-802ce8a2392d3f749e665d4f9e54790cf613aaf9.tar.gz rails-802ce8a2392d3f749e665d4f9e54790cf613aaf9.tar.bz2 rails-802ce8a2392d3f749e665d4f9e54790cf613aaf9.zip |
Run in-app rails commands via fork+load where possible
While this avoids shell argument parsing, we still pass through
everything in our stack.
Diffstat (limited to 'railties/test/commands')
-rw-r--r-- | railties/test/commands/secrets_test.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/railties/test/commands/secrets_test.rb b/railties/test/commands/secrets_test.rb index a1213a57f8..66a81826e3 100644 --- a/railties/test/commands/secrets_test.rb +++ b/railties/test/commands/secrets_test.rb @@ -1,11 +1,12 @@ # frozen_string_literal: true require "isolation/abstract_unit" +require "env_helpers" require "rails/command" require "rails/commands/secrets/secrets_command" class Rails::Command::SecretsCommandTest < ActiveSupport::TestCase - include ActiveSupport::Testing::Isolation + include ActiveSupport::Testing::Isolation, EnvHelpers def setup build_app @@ -36,14 +37,16 @@ class Rails::Command::SecretsCommandTest < ActiveSupport::TestCase private def run_edit_command(editor: "cat") - Dir.chdir(app_path) { `EDITOR="#{editor}" bin/rails secrets:edit` } + switch_env("EDITOR", editor) do + rails "secrets:edit" + end end def run_show_command - Dir.chdir(app_path) { `bin/rails secrets:show` } + rails "secrets:show" end def run_setup_command - Dir.chdir(app_path) { `bin/rails secrets:setup` } + rails "secrets:setup" end end |