Reputation: 789
I test password recovery, but there are errors. Rspec study recently.
code (User Controller)
def forgot
if request.post?
user = User.find_by_email(params[:user][:email])
if user
user.create_reset_code
end
flash[:notice] = t('helpers.notice_email')
render :template => "sessions/new"
end
end
rspec test
it "POST 'reset page'" do
User.should_receive(:find_by_email).with({:email => @user.email})
post :forgot, :user => {"email" => @user.email}
end
What am I doing wrong in the test?
Upvotes: 1
Views: 104