提交 c46c80b5 编写于 作者: K Kasper Timm Hansen 提交者: GitHub

Merge pull request #30609 from y-yagi/add_tests_for_credentials_command

Add tests for credentials command
......@@ -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 @@ def run_edit_command(editor: "cat")
rails "credentials:edit"
end
end
def run_show_command
rails "credentials:show"
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册