Merge pull request #48556 from skipkayhil/hm-fix-encrypted-config-hash

Fix EncryptedConfiguration not behaving like Hash
This commit is contained in:
Guillermo Iguaran 2023-06-22 01:16:02 -07:00 committed by GitHub
commit 06da26afba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

@ -1,3 +1,8 @@
* Fix `EncryptedConfiguration` returning incorrect values for some `Hash`
methods
*Hartley McGuire*
* Don't show secrets for `MessageEncryptor#inspect`.
Before:

@ -92,7 +92,7 @@ def deep_transform(hash)
end
def options
@options ||= ActiveSupport::InheritableOptions.new(deep_transform(config))
@options ||= deep_transform(config)
end
def deserialize(content)

@ -45,6 +45,7 @@ class EncryptedConfigurationTest < ActiveSupport::TestCase
assert_not @credentials.something.bad
assert_equal "bar", @credentials.dig(:something, :nested, :foo)
assert_equal "bar", @credentials.something.nested.foo
assert_equal [:something], @credentials.keys
assert_equal [:good, :bad, :nested], @credentials.something.keys
assert_equal ({ good: true, bad: false, nested: { foo: "bar" } }), @credentials.something
end