-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
What happens when email is already used
- Loading branch information
Showing
2 changed files
with
54 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -260,6 +260,51 @@ | |
expect(page).to have_content("you added a new alert for 24 Bruce Rd, Glenbrook") | ||
end | ||
|
||
it "when via the homepage not registered in the alternate flow but email already used" do | ||
use_ab_test logged_out_alert_flow_order: "create_alert_sign_in" | ||
|
||
create(:geocoded_application, address: "26 Bruce Rd, Glenbrook NSW 2773", lat: -33.772812, lng: 150.624252, lonlat: RGeo::Geographic.spherical_factory(srid: 4326).point(150.624252, -33.772812)) | ||
user = create(:confirmed_user, email: "[email protected]", password: "mypassword") | ||
sign_in user | ||
visit root_path | ||
sign_out user | ||
|
||
visit root_path | ||
fill_in("Street address", with: "24 Bruce Rd, Glenbrook") | ||
within("form") do | ||
click_on("Search") | ||
end | ||
|
||
expect(page).to have_content("Search results") | ||
expect(page).to have_content("Save this search as an email alert") | ||
click_on("Save", match: :first) | ||
|
||
expect(page).to have_content("You'll receive email alerts when new applications match this search") | ||
click_on("Create an account") | ||
|
||
expect(page).to have_content("Create an account to save this search") | ||
expect(page).to have_content("Applications within 2 km of 24 Bruce Rd, Glenbrook") | ||
|
||
fill_in("Email", with: "[email protected]") | ||
fill_in("Create a password", with: "mypassword") | ||
click_on("Create account and save") | ||
|
||
expect(page).to have_content("You already have an account with that email address") | ||
fill_in("Email", with: "[email protected]") | ||
fill_in("Create a password", with: "mypassword") | ||
click_on("Create account and save") | ||
|
||
open_email("[email protected]") | ||
expect(current_email).to have_subject("PlanningAlerts: Confirmation instructions") | ||
expect(current_email.default_part_body.to_s).to include("Thanks for getting onboard!") | ||
|
||
click_email_link_matching(/confirmation/) | ||
|
||
expect(page).to have_content("Your email address has been successfully confirmed") | ||
expect(page).to have_content("you are now logged in") | ||
expect(page).to have_content("you added a new alert for 24 Bruce Rd, Glenbrook") | ||
end | ||
|
||
it "when via the homepage but not yet have an account" do | ||
create(:geocoded_application, address: "26 Bruce Rd, Glenbrook NSW 2773", lat: -33.772812, lng: 150.624252, lonlat: RGeo::Geographic.spherical_factory(srid: 4326).point(150.624252, -33.772812)) | ||
|
||
|