[rspec-users] Deprecating the mocking framework?

Scott Taylor mailing_lists at railsnewbie.com
Mon Sep 3 06:28:28 EDT 2007


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)
>
> 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



More information about the rspec-users mailing list