cfcosta / minitest-firemock

Makes your MiniTest mocks more resilient.
31 stars 1 forks source link

Variable Arity #6

Closed plukevdh closed 9 years ago

plukevdh commented 9 years ago

Variable method arity, like the following fails the expectation match:

def variable_arity(opt={})

Fails with MockExpectationError:variable_arityexpects -1 arguments, given 1 when argument provide, fails with MockExpectationError:variable_arityexpects -1 arguments, given 0 when left out.

This is because UnboundMethod (returned by @const.instance_method(:method_name) here: https://github.com/cfcosta/minitest-firemock/blob/master/lib/minitest/fire_mock.rb#L12) returns -n-1 for arguments where n equals the number of required arguments. See method arity under http://ruby-doc.org/core-2.2.0/UnboundMethod.html

cfcosta commented 9 years ago

Oh, that's great!

cfcosta commented 9 years ago

By the way, I'll release the new version tomorrow with this change.

plukevdh commented 9 years ago

:+1: