[rspec-users] controller.should_receive(:render) problem

Ruprict glenn.goodrich at gmail.com
Mon Jul 12 05:18:17 EDT 2010


My issue is similar to the one in this post:

(which, btw, I could not reply to...only option was "Reply to Author")
where I have a RESTful controller.  I want create to redirect/render
the new action if the model fails to save with the supplied form
values.  Pretty basic and typical stuff.

In Rails, if I use


then the entered values along with the error_messages on the object
are lost and I can't re-fill the form or list the errors.  If I use

render :action => "new"

then I keep all the request data and can use it to fill in form, etc.

In my spec, if I use


I get an expectation error that render is never called.  This is true
if I remove the .with() as well.

If y'all could let me know either 1) Why my redirect_to vs render
argument is flawed and/or 2) What I am doing wrong in the spec, I'd
appreciate it.


More information about the rspec-users mailing list