Frameworks such as rspec support "Quiet" mocks which allow you to do one expectation per test. This (some would argue) gives a cleaner more BDD style test suite.
Basically the feature I'm after is a QuietMock object which verifies only the expectations that have been set and not the ones that haven't (stubbing them instead). To quote rspec's null_object (http://rspec.rubyforge.org/documentation/mocks/mocks.html):
it "instructs the mock to ignore (quietly consume) any messages it hasn’t been told to expect – and return itself".
Currently to achieve a one expectation per test you have to stub out all the behaviours you AREN'T testing which can become just as messy as the monolithic test.
Thanks in advance.
Log in to post a comment.