Skip to content
  • Jonathan Hefner's avatar
    c103a432
    Refactor message metadata tests · c103a432
    Jonathan Hefner authored
    Prior to this commit, there were several places to potentially add a new
    message metadata test:
    
    * `SharedMessageMetadataTests` module
    * `MessageEncryptorMetadataTest` class
      (includes `SharedMessageMetadataTests`)
    * `MessageEncryptorMetadataMarshalTest` class
      (subclasses `MessageEncryptorMetadataTest`)
    * `MessageEncryptorMetadataJSONTest` class
      (subclasses `MessageEncryptorMetadataTest`)
    * `MessageEncryptorMetadataJsonWithMarshalFallbackTest` class
      (subclasses `MessageEncryptorMetadataTest`)
    * `MessageVerifierMetadataTest` class
      (includes `SharedMessageMetadataTests`)
    * `MessageVerifierMetadataMarshalTest` class
      (subclasses `MessageVerifierMetadataTest`)
    * `MessageVerifierMetadataJsonWithMarshalFallbackTest` class
      (subclasses `MessageVerifierMetadataTest`)
    * `MessageVerifierMetadataJsonTest` class
      (subclasses `MessageVerifierMetadataTest`)
    * `MessageVerifierMetadataCustomJSONTest` class
      (subclasses `MessageVerifierMetadataTest`)
    * `MessageEncryptorMetadataNullSerializerTest` class
      (subclasses `MessageVerifierMetadataTest`)
    
    This commit refactors the message metadata tests, reducing the list to:
    
    * `MessageMetadataTests` module
    * `MessageEncryptorMetadataTest` class (includes `MessageMetadataTests`)
    * `MessageVerifierMetadataTest` class (includes `MessageMetadataTests`)
    
    This makes it easier to add new tests, as well as new testing scenarios
    (e.g. new encryptor / verifier configurations).
    
    Additionally, this commit fixes two tests that were ineffective:
    
    * The `test_passing_expires_in_less_than_a_second_is_not_expired` test
      (which is now simply a part of the "message expires with :expires_in"
      test) did not use the `with_usec: true` option.  Therefore, the time
      resulting from `travel 0.5.seconds` was truncated, effectively
      traveling 0 seconds.
    * The `test_verify_with_use_standard_json_time_format_as_false` test
      (which is now named "expiration works with
      ActiveSupport.use_standard_json_time_format = false") did not specify
      an expiration time.  Therefore, the conditional branch that it was
      supposed to test was never exercised.
    c103a432
    Refactor message metadata tests
    Jonathan Hefner authored
    Prior to this commit, there were several places to potentially add a new
    message metadata test:
    
    * `SharedMessageMetadataTests` module
    * `MessageEncryptorMetadataTest` class
      (includes `SharedMessageMetadataTests`)
    * `MessageEncryptorMetadataMarshalTest` class
      (subclasses `MessageEncryptorMetadataTest`)
    * `MessageEncryptorMetadataJSONTest` class
      (subclasses `MessageEncryptorMetadataTest`)
    * `MessageEncryptorMetadataJsonWithMarshalFallbackTest` class
      (subclasses `MessageEncryptorMetadataTest`)
    * `MessageVerifierMetadataTest` class
      (includes `SharedMessageMetadataTests`)
    * `MessageVerifierMetadataMarshalTest` class
      (subclasses `MessageVerifierMetadataTest`)
    * `MessageVerifierMetadataJsonWithMarshalFallbackTest` class
      (subclasses `MessageVerifierMetadataTest`)
    * `MessageVerifierMetadataJsonTest` class
      (subclasses `MessageVerifierMetadataTest`)
    * `MessageVerifierMetadataCustomJSONTest` class
      (subclasses `MessageVerifierMetadataTest`)
    * `MessageEncryptorMetadataNullSerializerTest` class
      (subclasses `MessageVerifierMetadataTest`)
    
    This commit refactors the message metadata tests, reducing the list to:
    
    * `MessageMetadataTests` module
    * `MessageEncryptorMetadataTest` class (includes `MessageMetadataTests`)
    * `MessageVerifierMetadataTest` class (includes `MessageMetadataTests`)
    
    This makes it easier to add new tests, as well as new testing scenarios
    (e.g. new encryptor / verifier configurations).
    
    Additionally, this commit fixes two tests that were ineffective:
    
    * The `test_passing_expires_in_less_than_a_second_is_not_expired` test
      (which is now simply a part of the "message expires with :expires_in"
      test) did not use the `with_usec: true` option.  Therefore, the time
      resulting from `travel 0.5.seconds` was truncated, effectively
      traveling 0 seconds.
    * The `test_verify_with_use_standard_json_time_format_as_false` test
      (which is now named "expiration works with
      ActiveSupport.use_standard_json_time_format = false") did not specify
      an expiration time.  Therefore, the conditional branch that it was
      supposed to test was never exercised.
Loading