mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-28 01:53:25 +00:00
Adding reset password stuff
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user