Its usage was removed in 7d116c9 but I forgot to remove it
The other changes come from running bundle install, it looks like they
were supposed to be removed in d9e79ce
In #43487 we missed adding a changelog so that's been added here. In
addition, since this isn't a new framework default unless you are
creating a new application (and only in dev and test environments by
default) it can be easy to miss this new option. I've updated the
message to mention the option following DHH's suggestion on the original
PR.
When running tests that does not initialize rails (e.g. `rake test` under
active_model), it used to just cut off the leading "/" from absolte paths and
report something like
rails test Users/a_matsuda/rails/activemodel/test/cases/api_test.rb:40
that cannot be executed.
because Hash#transform_values! takes no argument and so raises when delegating
with the given arguments.
{}.with_indifferent_access.transform_values!(1) { p :hello }
=> wrong number of arguments (given 1, expected 0) (ArgumentError)
These helpers are called from both test class definition and test execution,
so we're defining them as both class and instance methods on AR::TestCase.
Defining methods on toplevel changes the behavior of all Ruby Objects which of
course includes the test target, and thus that will spoil the meaning of the
whole testing. This is something that testing libraries or helpers should never
do.
These methods are just called from testing methods, so we can just move them
under AR::TestCase as its instance methods.
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.