[rspec-devel] rspec stubbing

Luke Redpath luke at agileevolved.com
Thu Sep 28 05:52:42 EDT 2006

+1 for waiting and branching.

-1 for the partial mocking - I much prefer the stubbing  
functionality. I love using Stubba but thats currently broken with  
the latest RSpec release - I would be one very happy man if RSpec  
rolled in its own Stubba-like functionality. I'd have no objections  
to both though!

As well as being able to stub a method to return a value, it would be  
nice to be able to stub a method with a routine as well:

Foo.stub!(:bar) do
   # do something here!


On 27 Sep 2006, at 04:06, David Chelimsky wrote:

> Hi everyone,
> Brian contributed a patch with some kick-ass stubbing capability last
> week. I've been playing w/ the syntax a bit, with an eye to making it
> more rspec like:
> Story.stub!(:new).with(value)
> I was able to get this to work, but it wasn't exactly what I think we
> need from rspec. I think what we really need is class level mocking -
> just like the existing mocking framework:
> Story.should_receive(:new).and_return(value)
> Person.should_receive(:find).with("1").and_return(value)
> etc.
> Right now there are a ton of other features that we're waiting to
> release until this gets settled. What I'd like to do is to yank the
> stubbing from the trunk so we can release and then add it to a branch
> in which we can play w/ syntax and functionality, moving towards
> including it an 0.6.5 release.
> That work for everyone?
> 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