Mocha and Bacon

0 views
Skip to first unread message

Pedro Belo

unread,
Oct 14, 2009, 9:27:04 PM10/14/09
to mocha-developer
Hey guys,

I wrapped up a tiny Rubygem to setup Mocha and Bacon together.

It just initializes Bacon and deals with the nasty "empty
specification" error when you have a spec using Mocha alone to assert
something.

http://github.com/pedro/baconmocha

Thanks,
Pedro

James Mead

unread,
Oct 15, 2009, 4:25:47 AM10/15/09
to mocha-d...@googlegroups.com
2009/10/15 Pedro Belo <pedr...@gmail.com>:

Thanks, Pedro.

I notice that you've had to monkey-patch
Mocha::Expectation#initialize. This is not part of Mocha's API and so
this integration is potentially brittle.

I you define a custom AssertionCounter and pass an instance of it into
Mocha::API#mocha_verify, I think you could avoid this problem. See
Mocha::Integration::TestUnit::AssertionCounter &
Mocha::Integration::TestUnit::RubyVersion186AndAbove for an example.

I don't know much about the inner workings of Bacon, but I've sketched
out what I mean here [1]. Note that I haven't tested this.

Cheers, James.

[1] http://gist.github.com/210776

Pedro Belo

unread,
Oct 15, 2009, 1:32:18 PM10/15/09
to mocha-developer
Hi James,

Thanks, that's excellent feedback. I'll work on that asap :)

Pedro

On Oct 15, 1:25 am, James Mead <jamesmea...@gmail.com> wrote:
> 2009/10/15 Pedro Belo <pedrob...@gmail.com>:

Pedro Belo

unread,
Oct 24, 2009, 10:42:37 PM10/24/09
to mocha-developer
Just a follow-up:

Turns out that Bacon is raising an Empty spec exception before running
the @after lambdas. I wrote a patch to it and sent it to Chris - so as
soon as it is applied (if it is applied, heh) baconmocha will work
with the elegant solution proposed by James.

James Mead

unread,
Oct 26, 2009, 8:55:29 AM10/26/09
to mocha-d...@googlegroups.com
2009/10/25 Pedro Belo <pedr...@gmail.com>:

> Just a follow-up:
>
> Turns out that Bacon is raising an Empty spec exception before running
> the @after lambdas. I wrote a patch to it and sent it to Chris - so as
> soon as it is applied (if it is applied, heh) baconmocha will work
> with the elegant solution proposed by James.

Hi Pedro,

Many thanks for your work on this. I hope you get the patch to Bacon accepted.

Cheers, James.

Reply all
Reply to author
Forward
0 new messages