cheers Tom. That worked. I'll go dig in the rspec source...

On 04/12/2007, Tom Stuart <[EMAIL PROTECTED]> wrote:
>
> On 4 Dec 2007, at 15:41, Andy Goundry wrote:
> > I've created the following spec test to simply ensure that the
> > Account model receives a call to :new, but the spec is failing as it
> > also receives a call to :save! and it isn't expecting it. I am using
> > "@account = mock_model(Account)". If i replace this with "@account =
> > mock('account', :null_object => true)" the test passes, but i'm not
> > sure that's really what i want. I'm pretty sure i need to us
> > mock_model in this instance.
>
> mock_model doesn't do anything magic -- it just creates a mock (with a
> conveniently-chosen name) and stubs out a few useful methods for you.
> In your case you need to stub out #save! too, so that you don't get
> the failure: @account = mock_model(Account, :save! => true).
>
> Cheers,
> -Tom
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to