mocha issues

0 views
Skip to first unread message

Chris Price

unread,
Feb 7, 2012, 12:36:19 PM2/7/12
to puppe...@googlegroups.com
Hi all,

Just an FYI, Patrick and I discovered a pretty major bug in mocha versions 0.10.2 and 0.10.3 that will cause false positives on your rspec runs.  The Jenkins machines seem to be mostly running 0.9.12, which is not affected by this bug--so hopefully we're not at risk of errors being masked by this.  However, you might want to check and see what version you are running locally... I caused some build failures on Friday because the specs appeared to run fine locally with 0.10.3 but failed when Jenkins ran them.

Patrick put together a repro case and submitted it to the mocha developers, so hopefully this will be fixed in an upcoming release.

Thanks
Chris

R.I.Pienaar

unread,
Feb 7, 2012, 12:42:07 PM2/7/12
to puppe...@googlegroups.com
hey,

do you have details of what the problem is?

thanks

> --
> You received this message because you are subscribed to the Google
> Groups "Puppet Developers" group.
> To post to this group, send email to puppe...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-dev+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-dev?hl=en.
>

Chris Price

unread,
Feb 10, 2012, 1:25:50 PM2/10/12
to puppe...@googlegroups.com
Patrick could probably explain it better than I, as he did more investigating into repro cases.  I believe that the gist of it is that if you call "expects" for the same method more than once, all of the expectations except for the very first one will just be ignored and result in false positives.  So:

foo.expects(:bar) # this one will work properly
foo.expects(:bar) # this one will be ignored and will never cause a failure.

Is that about right, Patrick?

Patrick Carlisle

unread,
Feb 10, 2012, 6:21:16 PM2/10/12
to puppe...@googlegroups.com
https://github.com/floehopper/mocha/issues/65

Fixed in 0.10.4

Basically if you set an expectation on the same instance of something (usually happens with a class or module method) in multiple tests, the expectation would only be checked in the first test.
Reply all
Reply to author
Forward
0 new messages