stubs/expectations hide false positives
Created by: se3000
Mocks and stubs don't alert you when mocking/stubbing a method that the object doesn't respond to. This can cover up places in the code where methods are being called that are no longer defined. In my experience, it is unrealistic to rely on integration tests to catch this kind of error... Mocks and stubs are written far more frequently than integration tests.
I recently wrote https://github.com/se3000/better_receive as an add on to RSpec to cover this case and have gotten good results and heard many appreciative stories from the people that use it.
Is this a feature you would pull in if I wrote a pull request for it?
Options I've considered:
- an alternate syntax for mocks/stubs with this assertion (ex:
foo.better_receive :bar
) - and/or a config setting that makes this assertion the default when mocking/stubbing