Hello,
I'm using edge Rails and I have the following code in my users
controller, with the respective test:
def update
@user = User.find(params[:id])
if @user.update_attributes(params[:user])
flash[:notice] = t :user_successfully_updated
end
respond_with(@user)
end
test "should not update user if modifications are invalid" do
put :update, :id => users(:foo).id, :user => {:name => nil}
assert !assigns(:user).valid?
assert_redirected_to edit_user_url(users(:foo))
end
The last assertion fails, saying the response is a 200 instead of a
redirect. From the information I found online about reponds_to, it
seems that a redirection to the edit action should have been done,
given that the object is invalid, but that isn't the case in this
test. Am I missing something obvious here?
Thanks in advance,
Andre
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.