diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2018-10-25 16:20:47 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-25 16:20:47 -0400 |
commit | c4fd38a206a82323b14ad41550f04a2258af955a (patch) | |
tree | 009d3e5539acdbf0da3bc08797cbc8442b0e051e | |
parent | a3dcba42e2422eb9c2e77011a39ce72dc934b420 (diff) | |
parent | 9d0cf52096dd6f7cb4b153984630eed97dcd8a8c (diff) | |
download | rails-c4fd38a206a82323b14ad41550f04a2258af955a.tar.gz rails-c4fd38a206a82323b14ad41550f04a2258af955a.tar.bz2 rails-c4fd38a206a82323b14ad41550f04a2258af955a.zip |
Merge pull request #34317 from bogdanvlviv/fix-assert_called_with
`assert_called_with` should require `args` argument
4 files changed, 3 insertions, 15 deletions
diff --git a/activerecord/test/cases/tasks/mysql_rake_test.rb b/activerecord/test/cases/tasks/mysql_rake_test.rb index 4d6dff68f9..552e623fd4 100644 --- a/activerecord/test/cases/tasks/mysql_rake_test.rb +++ b/activerecord/test/cases/tasks/mysql_rake_test.rb @@ -272,7 +272,7 @@ if current_adapter?(:Mysql2Adapter) def test_db_retrieves_collation ActiveRecord::Base.stub(:connection, @connection) do - assert_called_with(@connection, :collation) do + assert_called(@connection, :collation) do ActiveRecord::Tasks::DatabaseTasks.collation @configuration end end diff --git a/activesupport/lib/active_support/testing/method_call_assertions.rb b/activesupport/lib/active_support/testing/method_call_assertions.rb index fdc70e1cd3..eba41aa907 100644 --- a/activesupport/lib/active_support/testing/method_call_assertions.rb +++ b/activesupport/lib/active_support/testing/method_call_assertions.rb @@ -17,7 +17,7 @@ module ActiveSupport assert_equal times, times_called, error end - def assert_called_with(object, method_name, args = [], returns: nil) + def assert_called_with(object, method_name, args, returns: nil) mock = Minitest::Mock.new if args.all? { |arg| arg.is_a?(Array) } diff --git a/activesupport/test/cache/behaviors/cache_instrumentation_behavior.rb b/activesupport/test/cache/behaviors/cache_instrumentation_behavior.rb index 4e8ff60eb3..a4abdd37b9 100644 --- a/activesupport/test/cache/behaviors/cache_instrumentation_behavior.rb +++ b/activesupport/test/cache/behaviors/cache_instrumentation_behavior.rb @@ -2,7 +2,7 @@ module CacheInstrumentationBehavior def test_fetch_multi_uses_write_multi_entries_store_provider_interface - assert_called_with(@cache, :write_multi_entries) do + assert_called(@cache, :write_multi_entries) do @cache.fetch_multi "a", "b", "c" do |key| key * 2 end diff --git a/activesupport/test/testing/method_call_assertions_test.rb b/activesupport/test/testing/method_call_assertions_test.rb index 7438a0490e..669463bd31 100644 --- a/activesupport/test/testing/method_call_assertions_test.rb +++ b/activesupport/test/testing/method_call_assertions_test.rb @@ -60,12 +60,6 @@ class MethodCallAssertionsTest < ActiveSupport::TestCase assert_match(/dang it.\nExpected increment/, error.message) end - def test_assert_called_with - assert_called_with(@object, :increment) do - @object.increment - end - end - def test_assert_called_with_arguments assert_called_with(@object, :<<, [ 2 ]) do @object << 2 @@ -88,12 +82,6 @@ class MethodCallAssertionsTest < ActiveSupport::TestCase end end - def test_assert_called_with_returns - assert_called_with(@object, :increment, returns: 1) do - @object.increment - end - end - def test_assert_called_with_multiple_expected_arguments assert_called_with(@object, :<<, [ [ 1 ], [ 2 ] ]) do @object << 1 |