aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/commands
diff options
context:
space:
mode:
authorChristos Zisopoulos <christos@mac.com>2018-12-26 00:03:20 +0100
committerChristos Zisopoulos <christos@mac.com>2018-12-26 00:03:20 +0100
commita39aa99c8145e6782bffa1effd4f3678cab6b794 (patch)
tree85092f6e8a284e0a585ed9da6a0cb8e6e28e1c0c /railties/test/commands
parent6a8519ca899db1b107bc3be8310e49196f341372 (diff)
downloadrails-a39aa99c8145e6782bffa1effd4f3678cab6b794.tar.gz
rails-a39aa99c8145e6782bffa1effd4f3678cab6b794.tar.bz2
rails-a39aa99c8145e6782bffa1effd4f3678cab6b794.zip
Don't load app environment when editing credentials
This avoids missing key exceptions caused by code that tries to read the credentials before they have been added to the encrypted file, for example when editing the credentials for a new environment.
Diffstat (limited to 'railties/test/commands')
-rw-r--r--railties/test/commands/credentials_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/railties/test/commands/credentials_test.rb b/railties/test/commands/credentials_test.rb
index 7842b0db61..26ffe3070c 100644
--- a/railties/test/commands/credentials_test.rb
+++ b/railties/test/commands/credentials_test.rb
@@ -63,6 +63,14 @@ class Rails::Command::CredentialsCommandTest < ActiveSupport::TestCase
end
end
+ test "edit command does not raise when an initializer tries to acces non-existent credentials" do
+ app_file "config/initializers/raise_when_loaded.rb", <<-RUBY
+ Rails.application.credentials.missing_key!
+ RUBY
+
+ assert_match(/access_key_id: 123/, run_edit_command(environment: "qa"))
+ end
+
test "show credentials" do
assert_match(/access_key_id: 123/, run_show_command)
end