Skip to content

Commit

Permalink
Merge pull request #28368 from y-yagi/add_test_for_secrets_command
Browse files Browse the repository at this point in the history
Add secrets edit test
  • Loading branch information
kaspth committed Mar 15, 2017
2 parents bd3f0e7 + 7b4fb25 commit f38de5a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions railties/test/commands/secrets_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,21 @@ def teardown
assert_match "No $EDITOR to open decrypted secrets in", run_edit_command(editor: "")
end

test "edit secrets" do
run_setup_command

# Run twice to ensure encrypted secrets can be reread after first edit pass.
2.times do
assert_match(/external_api_key: 1466aac22e6a869134be3d09b9e89232fc2c2289…/, run_edit_command)
end
end

private
def run_edit_command(editor: "cat")
Dir.chdir(app_path) { `EDITOR="#{editor}" bin/rails secrets:edit` }
end

def run_setup_command
Dir.chdir(app_path) { `bin/rails secrets:setup` }
end
end

0 comments on commit f38de5a

Please sign in to comment.