FlexMock v. Mocha

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)?
 
B

Brian Candler

Alex Young wrote in post #984436:
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.

Then use Mocha :)

I changed from Flexmock to Mocha several years back. I forget what the
specific functionality was that I needed, but I also found that Mocha
gives much better error messages when tests fail, making it much easier
to trace the problem.

Regards,

Brian
 
A

Alex Young

Yeah, it's looking like a good option right now. For some reason I had
it fixed in my head that Mocha used ObjectSpace, which would have ruled
it out ('cos we're aiming for both JRuby and MRI), but that doesn't seem
to be true.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top