aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/messages/rotation_configuration.rb5
-rw-r--r--activesupport/test/messages/rotation_configuration_test.rb32
2 files changed, 8 insertions, 29 deletions
diff --git a/activesupport/lib/active_support/messages/rotation_configuration.rb b/activesupport/lib/active_support/messages/rotation_configuration.rb
index 233703b558..bd50d6d348 100644
--- a/activesupport/lib/active_support/messages/rotation_configuration.rb
+++ b/activesupport/lib/active_support/messages/rotation_configuration.rb
@@ -9,15 +9,12 @@ module ActiveSupport
@signed, @encrypted = [], []
end
- def rotate(kind = nil, *args)
+ def rotate(kind, *args)
case kind
when :signed
@signed << args
when :encrypted
@encrypted << args
- else
- rotate :signed, args
- rotate :encrypted, args
end
end
end
diff --git a/activesupport/test/messages/rotation_configuration_test.rb b/activesupport/test/messages/rotation_configuration_test.rb
index 41d938e119..2f6824ed21 100644
--- a/activesupport/test/messages/rotation_configuration_test.rb
+++ b/activesupport/test/messages/rotation_configuration_test.rb
@@ -9,35 +9,17 @@ class MessagesRotationConfiguration < ActiveSupport::TestCase
end
def test_signed_configurations
- @config.rotate :signed, secret: "older secret", salt: "salt", digest: "SHA1"
- @config.rotate :signed, secret: "old secret", salt: "salt", digest: "SHA256"
+ @config.rotate :signed, "older secret", salt: "salt", digest: "SHA1"
+ @config.rotate :signed, "old secret", salt: "salt", digest: "SHA256"
- assert_equal [{
- secret: "older secret", salt: "salt", digest: "SHA1"
- }, {
- secret: "old secret", salt: "salt", digest: "SHA256"
- }], @config.signed
+ assert_equal [
+ [ "older secret", salt: "salt", digest: "SHA1" ],
+ [ "old secret", salt: "salt", digest: "SHA256" ] ], @config.signed
end
def test_encrypted_configurations
- @config.rotate :encrypted, raw_key: "old raw key", cipher: "aes-256-gcm"
+ @config.rotate :encrypted, "old raw key", cipher: "aes-256-gcm"
- assert_equal [{
- raw_key: "old raw key", cipher: "aes-256-gcm"
- }], @config.encrypted
- end
-
- def test_rotate_without_kind
- @config.rotate secret: "older secret", salt: "salt", digest: "SHA1"
- @config.rotate raw_key: "old raw key", cipher: "aes-256-gcm"
-
- expected = [{
- secret: "older secret", salt: "salt", digest: "SHA1"
- }, {
- raw_key: "old raw key", cipher: "aes-256-gcm"
- }]
-
- assert_equal expected, @config.encrypted
- assert_equal expected, @config.signed
+ assert_equal [ [ "old raw key", cipher: "aes-256-gcm" ] ], @config.encrypted
end
end