[rspec-users] Deprecating the mocking framework?

Rodrigo Alvarez Fernández papipo at gmail.com
Mon Sep 3 07:12:21 EDT 2007


On 9/3/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:
>
> On Sep 3, 2007, at 5:19 AM, Rodrigo Alvarez Fernández wrote:
>
> > I would like to know if the mock framework will be deprecated, since I
> > have a pair of feature requests, and I don't know where to request
> > them:
> >
> > 1) Alternative expectations:
> >
> > mock.should_receive(:save).
> >   and_return(false).
> >   or_receive(:save!).
> >   and_raise(ActiveRecord::RecordNotSaved)
> >
> > 2) Chained stubs/expectations
> >
> > mock.stub!(:valid?).and_return(false)
> > mock.stub!(:valid?).and_return(true).after_receiving
> > (:save).and_return(true)
> >

Maybe this can be accomplished with ordered stubs. rSpec mocks support
only ordered expectations, doesn't it?

> > I'm sure that this needs no more explanation :)
>
> Or we could do as flexmock does (and which I find much more readable):
>
> mock.stub!("method1.method2.method3").and_return(true)
>
> Scott
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


-- 
http://papipo.blogspot.com


More information about the rspec-users mailing list