Hi,
I have a trouble of testing controller with redirect to the confirm
page
I dont understand why i can pass the render the template new but not
to
redirect the confirm
please help
in browser the link is
http://0.0.0.0:3000/register_confirm
def create
@user = User.new(params[:user])
if @user.save
redirect_to :action => "confirm"
else
render "new"
end
end
Test file
it "should save redirect to confirm" do
User.any_instance.stubs(:valid?).returns(true)
post ''create''
assigns[:user].should_not be_new_record
response.should redirect_to(''confirm'')
end
it "should not save redirect to new" do
User.any_instance.stubs(:valid?).returns(false)
post ''create''
assigns[:user].should be_new_record
response.should render_template(''new'')
end
error
1) UsersController GET create should save redirect to confirm
Failure/Error: response.should redirect_to(''confirm'')
Expected response to be a <:redirect>, but was <200>.
Expected block to return true value.
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.