A
Alex Young
There are a couple of bits of functionality I rather like in Mocha, but
I can't see how to do the same (if it's at all possible) in FlexMock.
First, Mocha does this:
Mocha::Configuration.prevent :stubbing_non_existent_method
which gives a nice error when your API changes. This is remarkably
handy, and as I say, I can't see if this functionality is available in
FlexMock.
Secondly, a mocked method on a partial mock in Mocha will call the
underlying method if you don't supply a return value. I can see how this
might not be a good idea all the time, but I frequently find myself
making my tests more complicated, more verbose, or more coupled to the
innards of the class I'm testing, without better coverage, because I'm
having to work around not having a simple way to do this. Again,
FlexMock *may* be able to do this, but if it does, I can't see how
without going through an
#and_return{ mess_with_privates } incantation.
Am I just Doing It Wrong(tm)?
I can't see how to do the same (if it's at all possible) in FlexMock.
First, Mocha does this:
Mocha::Configuration.prevent :stubbing_non_existent_method
which gives a nice error when your API changes. This is remarkably
handy, and as I say, I can't see if this functionality is available in
FlexMock.
Secondly, a mocked method on a partial mock in Mocha will call the
underlying method if you don't supply a return value. I can see how this
might not be a good idea all the time, but I frequently find myself
making my tests more complicated, more verbose, or more coupled to the
innards of the class I'm testing, without better coverage, because I'm
having to work around not having a simple way to do this. Again,
FlexMock *may* be able to do this, but if it does, I can't see how
without going through an
#and_return{ mess_with_privates } incantation.
Am I just Doing It Wrong(tm)?