aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/commands
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2019-03-23 09:07:57 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2019-03-23 09:07:57 +0900
commit0e9e59953fa5360750287fe45a102633f7e54f2b (patch)
tree71a8c924a5fbc01e7398320844e7d4e26f15d22d /railties/test/commands
parent56723964ce087990ba5e17e42a29d08a935eb37b (diff)
downloadrails-0e9e59953fa5360750287fe45a102633f7e54f2b.tar.gz
rails-0e9e59953fa5360750287fe45a102633f7e54f2b.tar.bz2
rails-0e9e59953fa5360750287fe45a102633f7e54f2b.zip
Add `secret_key_base` when creating new credential file
Since `secret_key_base` is expected to be included in credential file, `secret_key_base` should be included even if re-create the file. This is the same behavior as creating a new app. When env is specified, it may be unnecessary, so I added it only when not specifying env.
Diffstat (limited to 'railties/test/commands')
-rw-r--r--railties/test/commands/credentials_test.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/railties/test/commands/credentials_test.rb b/railties/test/commands/credentials_test.rb
index 3654e96aed..2f2c50de6c 100644
--- a/railties/test/commands/credentials_test.rb
+++ b/railties/test/commands/credentials_test.rb
@@ -79,6 +79,15 @@ class Rails::Command::CredentialsCommandTest < ActiveSupport::TestCase
assert_match(/access_key_id: 123/, run_edit_command(environment: "qa"))
end
+ test "edit command generate template file when the file does not exist" do
+ FileUtils.rm("#{app_path}/config/credentials.yml.enc")
+ run_edit_command
+
+ output = run_show_command
+ assert_match(/access_key_id: 123/, output)
+ assert_match(/secret_key_base/, output)
+ end
+
test "show credentials" do
assert_match(/access_key_id: 123/, run_show_command)
end
@@ -106,7 +115,9 @@ class Rails::Command::CredentialsCommandTest < ActiveSupport::TestCase
test "show command properly expand environment option" do
run_edit_command(environment: "production")
- assert_match(/access_key_id: 123/, run_show_command(environment: "prod"))
+ output = run_show_command(environment: "prod")
+ assert_match(/access_key_id: 123/, output)
+ assert_no_match(/secret_key_base/, output)
end
private