diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2015-07-10 23:24:47 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2015-07-10 23:45:42 +0200 |
commit | 46b92c4d1274f7438b4e5e65bacc017693c3ffed (patch) | |
tree | eca778b06b1108295e9f420e9ba013de7d7afed4 /activesupport/lib/active_support/testing | |
parent | 3c5bd78ddbeefe7b1d1b513d9057bd9358d5a5da (diff) | |
download | rails-46b92c4d1274f7438b4e5e65bacc017693c3ffed.tar.gz rails-46b92c4d1274f7438b4e5e65bacc017693c3ffed.tar.bz2 rails-46b92c4d1274f7438b4e5e65bacc017693c3ffed.zip |
Add multiple expected calls to assert_called_with.
Diffstat (limited to 'activesupport/lib/active_support/testing')
-rw-r--r-- | activesupport/lib/active_support/testing/method_call_assertions.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/testing/method_call_assertions.rb b/activesupport/lib/active_support/testing/method_call_assertions.rb index 0d7d62341c..e3cbe40308 100644 --- a/activesupport/lib/active_support/testing/method_call_assertions.rb +++ b/activesupport/lib/active_support/testing/method_call_assertions.rb @@ -15,7 +15,12 @@ module ActiveSupport def assert_called_with(object, method_name, args = [], returns: nil) mock = Minitest::Mock.new - mock.expect(:call, returns, args) + + if args.all? { |arg| arg.is_a?(Array) } + args.each { |arg| mock.expect(:call, returns, arg) } + else + mock.expect(:call, returns, args) + end object.stub(method_name, mock) { yield } |