diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-08-15 14:48:53 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-15 14:48:53 +0900 |
commit | 111643b8a36bcb0e24eee91cd66a4e983d4b64be (patch) | |
tree | b838ed010c1de2ca5cbfe8405cb2c85a312bd709 /activesupport/test | |
parent | f7a4b875df66a88be306ec7fd11e870ad92e0e95 (diff) | |
parent | 88439585edbb49ecacce72a4277992f212dbbc75 (diff) | |
download | rails-111643b8a36bcb0e24eee91cd66a4e983d4b64be.tar.gz rails-111643b8a36bcb0e24eee91cd66a4e983d4b64be.tar.bz2 rails-111643b8a36bcb0e24eee91cd66a4e983d4b64be.zip |
Merge pull request #33612 from bogdanvlviv/test-assert_called
Test `assert_called` and `assert_called_with`
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/testing/method_call_assertions_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activesupport/test/testing/method_call_assertions_test.rb b/activesupport/test/testing/method_call_assertions_test.rb index 0500e47def..5cdeb683e3 100644 --- a/activesupport/test/testing/method_call_assertions_test.rb +++ b/activesupport/test/testing/method_call_assertions_test.rb @@ -36,6 +36,8 @@ class MethodCallAssertionsTest < ActiveSupport::TestCase assert_called(@object, :increment, returns: 10) do assert_equal 10, @object.increment end + + assert_equal 1, @object.increment end def test_assert_called_failure @@ -70,6 +72,14 @@ class MethodCallAssertionsTest < ActiveSupport::TestCase end end + def test_assert_called_with_arguments_and_returns + assert_called_with(@object, :<<, [ 2 ], returns: 10) do + assert_equal(10, @object << 2) + end + + assert_nil(@object << 2) + end + def test_assert_called_with_failure assert_raises(MockExpectationError) do assert_called_with(@object, :<<, [ 4567 ]) do |