[Rspec-devel] define_instance_method, stub_with, and mock_with

Jay Levitt lists-rspec at shopwatch.org
Mon Sep 4 18:23:05 EDT 2006

David Chelimsky wrote:
>> Also, FWIW, it sounds like Mocha is likely to become included in (or at
>> least used by) Rails core:
>> http://rubyforge.org/pipermail/mocha-developer/2006-September/000017.html
> I think it is very relevant. I've been playing around w/ using Mocha
> and Stubba from rspec. Haven't gotten it to work the way I want to
> yet, but if we can tap into a solid mock framework that someone else
> is maintaining, why not? The catch would be that the syntax for mocha
> is slightly different - using "expects" instead of "should_receive".
> But a simple search and replace should fix that - no? There are a
> couple of others, like "returns" instead of "and_return", etc.

So would you propose wrapping and aliasing the mocha methods, or trying 
to convice James to include those aliases for rspec use?

> What is important to me is that whatever mock framework we use is
> seamlessly integrated, auto-verified, etc. If mocha works its way into
> rails, it will implicitly become somewhat of a standard. And while
> rspec's expectation API and context/specify DSL offer something that
> feels different from test/unit, the mock framework really doesn't
> offer anything worthy of maintaining yet another framework.

I completely agree.  I'd rather see rspec stick to the things that make 
it unique.  But then, I almost always wish people working on a library 
would simply merge it with that other library, and that so rarely 
happens...  I'm a big fan of integration.

Personally, I think that while mocha may not have picked the verbs you'd 
pick for rspec, the overall syntax blends nicely with rspec, and I'd 
rather see rspec's mocks be cut-and-paste compatible with the many 
examples of mocking that are likely to pop up if it gets included in core.

And I am simply loving:

   setup do


> Any other opinions?
> David
> _______________________________________________
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel

More information about the Rspec-devel mailing list