diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2017-09-14 20:14:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-14 20:14:26 +0200 |
commit | 43fbfb483ff72c69f6630fd110f44ae7802bdabc (patch) | |
tree | 0274147578ee48f0fee61ab027c1e568333250ad /railties/test/commands/credentials_test.rb | |
parent | cffa32f95d2934cfafc22958f35552ee6e7c195e (diff) | |
parent | d5d41c82810f96ee7ab5a34aeb75b46fe407a596 (diff) | |
download | rails-43fbfb483ff72c69f6630fd110f44ae7802bdabc.tar.gz rails-43fbfb483ff72c69f6630fd110f44ae7802bdabc.tar.bz2 rails-43fbfb483ff72c69f6630fd110f44ae7802bdabc.zip |
Merge pull request #30581 from y-yagi/do_not_add_master_key_twice_to_gitignore
Make master key added to gitignore the same value as when creating appplication
Diffstat (limited to 'railties/test/commands/credentials_test.rb')
-rw-r--r-- | railties/test/commands/credentials_test.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/railties/test/commands/credentials_test.rb b/railties/test/commands/credentials_test.rb new file mode 100644 index 0000000000..fe52c306d2 --- /dev/null +++ b/railties/test/commands/credentials_test.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require "isolation/abstract_unit" +require "env_helpers" +require "rails/command" +require "rails/commands/credentials/credentials_command" + +class Rails::Command::CredentialsCommandTest < ActiveSupport::TestCase + include ActiveSupport::Testing::Isolation, EnvHelpers + + setup { build_app } + + teardown { teardown_app } + + test "edit command does not add master key to gitignore when already exist" do + run_edit_command + + Dir.chdir(app_path) do + gitignore = File.read(".gitignore") + assert_equal 1, gitignore.scan(%r|config/master\.key|).length + end + end + + private + def run_edit_command(editor: "cat") + switch_env("EDITOR", editor) do + rails "credentials:edit" + end + end +end |