Adding reset password stuff

This commit is contained in:
Will Marshall
2014-05-09 14:26:07 +10:00
parent 1297520051
commit 9903e42811
4 changed files with 30 additions and 0 deletions

View File

@@ -19,6 +19,7 @@
%label{for: "email"} Your email
%input.title.input-text{name: "email",
type: "email",
id: "email",
tabindex: 1,
"ng-model" => "spree_user.email"}
.row

View File

@@ -36,6 +36,7 @@ Openfoodnetwork::Application.configure do
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
config.action_mailer.default_url_options = { :host => "test.host" }
end
# Allows us to use _url helpers in Rspec

View File

@@ -53,6 +53,26 @@ feature "Authentication", js: true do
ActionMailer::Base.deliveries.last.subject.should =~ /Welcome to/
end
end
describe "forgetting passwords" do
before do
ActionMailer::Base.deliveries.clear
select_login_tab "Forgot Password?"
end
scenario "failing to reset password" do
fill_in "Your email", with: "notanemail@myemail.com"
click_reset_password_button
page.should have_content "Email address not found"
end
scenario "resetting password" do
fill_in "Your email", with: user.email
click_reset_password_button
page.should have_reset_password
ActionMailer::Base.deliveries.last.subject.should =~ /Password Reset/
end
end
end
describe "as medium" do
before do

View File

@@ -16,6 +16,10 @@ module UIComponentHelper
click_button "Sign up now"
end
def click_reset_password_button
click_button "Reset password"
end
def select_login_tab(text)
within ".login-modal" do
find("a", text: text).click
@@ -34,6 +38,10 @@ module UIComponentHelper
have_selector ".login-modal"
end
def have_reset_password
have_content "An email with instructions on resetting your password has been sent!"
end
def be_logged_in_as(user_or_email)
if user_or_email.is_a? Spree::User
have_content user_or_email.email