kingpong / perl-Test-Spec

rSpec-like test system for Perl
http://search.cpan.org/dist/Test-Spec/lib/Test/Spec.pm
30 stars 17 forks source link

don't fail with argument expectation when method never called #25

Closed ptolemarch closed 9 years ago

ptolemarch commented 9 years ago

Currently, if you create an expectation that a method will be called any_number() of times, and that when it's called, it should be called with() some particular args, it fails if the method is never called. For example, this code:

Foo::Bar->expects('baz')->any_number->with(arg => $val)->returns($stuff);

If Foo::Bar->baz() never gets called, we see this test failure:

#    Number of arguments don't match expectation.

(I am indebted to @cavemanpi, my pair-programmer, who helped me find and fix this bug.)

andyjones commented 9 years ago

This looks great btw, thanks

Sorry I'm taking so long, having another crack at the other open issue in the hope I can release them both at the same time.

andyjones commented 9 years ago

Thank you! It is in 0.50 which should be on cpan shortly

ptolemarch commented 9 years ago

We were glad to help! Thanks for pulling the change.