post user_forgot_password_path, :params => { :email => user.email }
end
end
- assert_response :redirect
assert_redirected_to login_path
assert_match(/^If your email address exists/, flash[:notice])
email = ActionMailer::Base.deliveries.first
end
end
# Be paranoid about revealing there was no match
- assert_response :redirect
assert_redirected_to login_path
assert_match(/^If your email address exists/, flash[:notice])
post user_forgot_password_path, :params => { :email => user.email.upcase }
end
end
- assert_response :redirect
assert_redirected_to login_path
assert_match(/^If your email address exists/, flash[:notice])
email = ActionMailer::Base.deliveries.first
end
end
# Be paranoid about revealing there was no match
- assert_response :redirect
assert_redirected_to login_path
assert_match(/^If your email address exists/, flash[:notice])
post user_forgot_password_path, :params => { :email => third_user.email }
end
end
- assert_response :redirect
assert_redirected_to login_path
assert_match(/^If your email address exists/, flash[:notice])
email = ActionMailer::Base.deliveries.first
post user_forgot_password_path, :params => { :email => third_user.email.upcase }
end
end
- assert_response :redirect
assert_redirected_to login_path
assert_match(/^If your email address exists/, flash[:notice])
email = ActionMailer::Base.deliveries.first
# Test a request with a bogus token
get user_reset_password_path, :params => { :token => "made_up_token" }
- assert_response :redirect
assert_redirected_to :action => :new
# Create a valid token for a user
# Test setting a new password
post user_reset_password_path, :params => { :token => token, :user => { :pass_crypt => "new_password", :pass_crypt_confirmation => "new_password" } }
- assert_response :redirect
assert_redirected_to root_path
assert_equal user.id, session[:user]
user.reload