1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activesupport/lib/active_support/testing
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
..
assertions.rb added tests for assert_no_difference with multiple expressions 2018-07-08 15:15:16 +02:00
autorun.rb [Active Support] rubocop -a --only Layout/EmptyLineAfterMagicComment 2017-07-11 13:12:32 +09:00
constant_lookup.rb [Active Support] require_relative => require 2017-10-21 22:48:27 +09:00
declarative.rb [Active Support] rubocop -a --only Layout/EmptyLineAfterMagicComment 2017-07-11 13:12:32 +09:00
deprecation.rb Remove unused require "active_support/core_ext/regexp" 2018-07-29 14:51:00 +09:00
file_fixtures.rb [Active Support] rubocop -a --only Layout/EmptyLineAfterMagicComment 2017-07-11 13:12:32 +09:00
isolation.rb Ruby 2.4: take advantage of String#unpack1 2018-03-01 22:42:51 -08:00
method_call_assertions.rb assert_called_with should require args argument 2018-10-25 21:29:39 +03:00
parallelization.rb Ensure we always cleanup the databases 2018-09-05 14:43:14 -04:00
setup_and_teardown.rb SetupAndTeardown has few caveats that breaks libraries: 2018-04-27 01:36:27 -04:00
stream.rb Fix Style/RedundantReturn offenses 2018-04-21 13:23:42 -04:00
tagged_logging.rb [Active Support] rubocop -a --only Layout/EmptyLineAfterMagicComment 2017-07-11 13:12:32 +09:00
time_helpers.rb Oxford comma [ci skip] 2018-09-10 23:51:26 +02:00