erikdoe / ocmock

Mock objects for Objective-C
http://ocmock.org
Apache License 2.0
2.16k stars 606 forks source link

Better error message for OCMVerify of some methods on partial mocks. #409

Closed dmaclach closed 4 years ago

dmaclach commented 4 years ago

Fix for #408.

The error message is now:

Selector '%@' can not be verified using OCMVerify(). Use OCMExpect() instead.

erikdoe commented 4 years ago

I have now merged this PR. However, I made the check for adding the hint much tighter; to situations where stubbing the method might help.

The reason is that I didn't want developers seeing the hint and then "randomly" adding stubs in an effort to fix a test, when the stub wouldn't have any impact. My assumption is that a lot of these stubs might then be forgotten.

Please double-check whether this still works for you.

dmaclach commented 4 years ago

Looks good to me. Thanks.

On Sun, May 24, 2020 at 5:01 AM Erik Doernenburg notifications@github.com wrote:

I have now merged this PR. However, made the check for adding the hint much tighter; to situations where stubbing the method might help.

The reason is that I didn't want developers seeing the hint and then "randomly" adding stubs in an effort to fix a test, when the stub wouldn't have any impact. My assumption is that a lot of these stubs might then be forgotten.

Please double-check whether this still works for you.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/erikdoe/ocmock/pull/409#issuecomment-633220624, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACOFSMZVTAPD3ZOCVKSNKDRTEEBLANCNFSM4MPWPV5A .