if @user.save
redirect_to :action => "confirm"
else
.....
test
user = User.new(:email => "blad@mail.com",
:password => "12345",
:name => "you")
post :create
user.should_receive(:save).and_return(true)
response.should redirect_to('confirm')
the error
1) UsersController GET create should save redirect to confirm
Failure/Error: response.should redirect_to(:action => 'confirm')
Expected response to be a <:redirect>, but was <200>.
Expected block to return true value.
Since there are no params in post, it goes to the else section of you controller, where you render a action, and response code for render is 200. So the test fails saying that you expected a redirect but got render.
You have to send params along with call to post.
Since there are no params in post, it goes to the else section of you
controller, where you render a action, and response code for render is 200.
So the test fails saying that you expected a redirect but got render.
Can you give me an example that how to send the param to the post. I
am pretty new with testing controller in rails