1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activesupport/test/messages/rotation_configuration_test.rb
Michael Grosser 203998c916
allow running each test with pure ruby path/to/test.rb
also:
 - makes test dependencies obvious
 - makes tests runnable from within subfolders
2019-12-18 08:49:19 -06:00

25 lines
802 B
Ruby

# frozen_string_literal: true
require_relative "../abstract_unit"
require "active_support/messages/rotation_configuration"
class MessagesRotationConfiguration < ActiveSupport::TestCase
def setup
@config = ActiveSupport::Messages::RotationConfiguration.new
end
def test_signed_configurations
@config.rotate :signed, "older secret", salt: "salt", digest: "SHA1"
@config.rotate :signed, "old secret", salt: "salt", digest: "SHA256"
assert_equal [
[ "older secret", salt: "salt", digest: "SHA1" ],
[ "old secret", salt: "salt", digest: "SHA256" ] ], @config.signed
end
def test_encrypted_configurations
@config.rotate :encrypted, "old raw key", cipher: "aes-256-gcm"
assert_equal [ [ "old raw key", cipher: "aes-256-gcm" ] ], @config.encrypted
end
end