-
Jonathan Hefner authored
This commit factors tests related to `ActiveSupport::Messages::Rotator` into `MessageEncryptorRotatorTest` and `MessageVerifierRotatorTest` classes, with a shared `MessageRotatorTests` module. In particular, this: * Replaces the `test_rotating_serializer` test in the `MessageEncryptorTest` class because it did not actually rotate the serializer. * Removes the `test_on_rotation_is_called_and_returns_modified_messages` test from the `MessageEncryptorWithJsonSerializerTest` class because its only purpose is to override a test of the same name in the `MessageEncryptorTest` parent class, because the expected value must use string keys instead of symbol keys due to the serializer. * Removes the `test_on_rotation_can_be_passed_at_the_constructor_level` test from the `MessageEncryptorWithJsonSerializerTest` class for the same reason as above. * Removes the `test_on_rotation_option_takes_precedence_over_the_one_given_in_constructor` test from the `MessageEncryptorWithJsonSerializerTest` class for the same reason as above. * Removes the `test_on_rotation_is_called_and_verified_returns_message` test from the `JsonSerializeMarshalFallbackMessageVerifierTest` class because it is rotating the secret and digest, and is not specific to the serializer. * Removes the `test_on_rotation_is_called_and_verified_returns_message` test from the `DefaultMarshalSerializerMessageVerifierTest` class for the same reason as above. * Adds thorough test coverage for the `on_rotation` option for both `MessageVerifier` and `MessageEncryptor` (previous test coverage was mostly just for `MessageEncryptor`), including coverage for when the `on_rotation` proc should _not_ be called. * Adds test coverage for rotating the `url_safe` option, for both `MessageVerifier` and `MessageEncryptor`.
Jonathan Hefner authoredThis commit factors tests related to `ActiveSupport::Messages::Rotator` into `MessageEncryptorRotatorTest` and `MessageVerifierRotatorTest` classes, with a shared `MessageRotatorTests` module. In particular, this: * Replaces the `test_rotating_serializer` test in the `MessageEncryptorTest` class because it did not actually rotate the serializer. * Removes the `test_on_rotation_is_called_and_returns_modified_messages` test from the `MessageEncryptorWithJsonSerializerTest` class because its only purpose is to override a test of the same name in the `MessageEncryptorTest` parent class, because the expected value must use string keys instead of symbol keys due to the serializer. * Removes the `test_on_rotation_can_be_passed_at_the_constructor_level` test from the `MessageEncryptorWithJsonSerializerTest` class for the same reason as above. * Removes the `test_on_rotation_option_takes_precedence_over_the_one_given_in_constructor` test from the `MessageEncryptorWithJsonSerializerTest` class for the same reason as above. * Removes the `test_on_rotation_is_called_and_verified_returns_message` test from the `JsonSerializeMarshalFallbackMessageVerifierTest` class because it is rotating the secret and digest, and is not specific to the serializer. * Removes the `test_on_rotation_is_called_and_verified_returns_message` test from the `DefaultMarshalSerializerMessageVerifierTest` class for the same reason as above. * Adds thorough test coverage for the `on_rotation` option for both `MessageVerifier` and `MessageEncryptor` (previous test coverage was mostly just for `MessageEncryptor`), including coverage for when the `on_rotation` proc should _not_ be called. * Adds test coverage for rotating the `url_safe` option, for both `MessageVerifier` and `MessageEncryptor`.
Loading