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.