aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2017-11-13 11:35:39 +0100
committerGitHub <noreply@github.com>2017-11-13 11:35:39 +0100
commitd134a9aa92838fd1511eca751777fcf1fdeacd51 (patch)
tree34648be3be03e87e6bc804ff264463659bde6e32 /activesupport/test
parent8f2490b57f488ed60fc6e0a201ccd5e66811ab51 (diff)
parent00f5aca3ef5de2637134c40e2e8b5d3c1d5b1a08 (diff)
downloadrails-d134a9aa92838fd1511eca751777fcf1fdeacd51.tar.gz
rails-d134a9aa92838fd1511eca751777fcf1fdeacd51.tar.bz2
rails-d134a9aa92838fd1511eca751777fcf1fdeacd51.zip
Merge pull request #30893 from y-yagi/verify_credentials_format_before_saving
Verify credentials format before saving
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/encrypted_configuration_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/test/encrypted_configuration_test.rb b/activesupport/test/encrypted_configuration_test.rb
index 471faa8c12..0bc915be82 100644
--- a/activesupport/test/encrypted_configuration_test.rb
+++ b/activesupport/test/encrypted_configuration_test.rb
@@ -51,6 +51,14 @@ class EncryptedConfigurationTest < ActiveSupport::TestCase
assert_equal "things", @credentials[:new]
end
+ test "raise error when writing an invalid format value" do
+ assert_raise(Psych::SyntaxError) do
+ @credentials.change do |config_file|
+ config_file.write "login: *login\n username: dummy"
+ end
+ end
+ end
+
test "raises key error when accessing config via bang method" do
assert_raise(KeyError) { @credentials.something! }
end