aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2017-09-17 13:42:23 +0200
committerGitHub <noreply@github.com>2017-09-17 13:42:23 +0200
commitc46c80b5298ff6d600597cb0edae88680f1fac7c (patch)
treefad1a65a072bdd409bfb9268073ec64adb2d7ae8 /railties/test
parentbf206dc2fc66f844c561329ca2fd9c0418d3ff90 (diff)
parent8a331566bfe05ccc85f25805693aa892cec449a5 (diff)
downloadrails-c46c80b5298ff6d600597cb0edae88680f1fac7c.tar.gz
rails-c46c80b5298ff6d600597cb0edae88680f1fac7c.tar.bz2
rails-c46c80b5298ff6d600597cb0edae88680f1fac7c.zip
Merge pull request #30609 from y-yagi/add_tests_for_credentials_command
Add tests for credentials command
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/commands/credentials_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/railties/test/commands/credentials_test.rb b/railties/test/commands/credentials_test.rb
index fe52c306d2..743fb5f788 100644
--- a/railties/test/commands/credentials_test.rb
+++ b/railties/test/commands/credentials_test.rb
@@ -12,6 +12,21 @@ class Rails::Command::CredentialsCommandTest < ActiveSupport::TestCase
teardown { teardown_app }
+ test "edit without editor gives hint" do
+ assert_match "No $EDITOR to open credentials in", run_edit_command(editor: "")
+ end
+
+ test "edit credentials" do
+ # Run twice to ensure credentials can be reread after first edit pass.
+ 2.times do
+ assert_match(/access_key_id: 123/, run_edit_command)
+ end
+ end
+
+ test "show credentials" do
+ assert_match(/access_key_id: 123/, run_show_command)
+ end
+
test "edit command does not add master key to gitignore when already exist" do
run_edit_command
@@ -27,4 +42,8 @@ class Rails::Command::CredentialsCommandTest < ActiveSupport::TestCase
rails "credentials:edit"
end
end
+
+ def run_show_command
+ rails "credentials:show"
+ end
end