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/cache/behaviors
bogdanvlviv 9d0cf52096
assert_called_with should require args argument
There are two main reasons why `assert_called_with` should require
`args` argument:

1) If we want to assert that some method should be called and we don't
   need to check with which arguments it should be called then we should use
   `assert_called`.

2) `assert_called_with` without `args` argument doesn't assert anything!
   ```ruby
   assert_called_with(@object, :increment) do
      @object.decrement
   end
   ```
   It causes false assertions in tests that could cause regressions in the project.

I found this bug by working on
[minitest-mock_expectations](https://github.com/bogdanvlviv/minitest-mock_expectations) gem.
This gem is an extension for minitest that provides almost the same method call
assertions.
I was wondering whether you would consider adding "minitest-mock_expectations"
to `rails/rails` instead of private `ActiveSupport::Testing::MethodCallAssertions` module.
If yes, I'll send a patch - a970ecc42c
2018-10-25 21:29:39 +03:00
..
autoloading_cache_behavior.rb [Active Support] rubocop -a --only Layout/EmptyLineAfterMagicComment 2017-07-11 13:12:32 +09:00
cache_delete_matched_behavior.rb Allow rubocop check more files 2018-04-19 23:25:39 +03:00
cache_increment_decrement_behavior.rb Built-in Redis cache store 2017-11-13 19:45:47 -07:00
cache_instrumentation_behavior.rb assert_called_with should require args argument 2018-10-25 21:29:39 +03:00
cache_store_behavior.rb Array with single item correctly uses cache_key 2018-10-05 19:24:49 -04:00
cache_store_version_behavior.rb Allow rubocop check more files 2018-04-19 23:25:39 +03:00
connection_pool_behavior.rb Fix test: threads being nil in ensure 2018-04-30 17:32:37 +02:00
encoded_key_cache_behavior.rb Enable Performance/UnfreezeString cop 2018-09-23 08:56:55 +09:00
failure_safety_behavior.rb Allow rubocop check more files 2018-04-19 23:25:39 +03:00
local_cache_behavior.rb Fix Cache read_multi with local_cache return values. 2018-03-21 14:16:00 +08:00