-
-
Notifications
You must be signed in to change notification settings - Fork 522
Issue 6600: skip email confirmation when saving new volunteer email, due to how CASA orgs work #6639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Issue 6600: skip email confirmation when saving new volunteer email, due to how CASA orgs work #6639
Changes from 15 commits
6fa1255
d3e41c7
57eeec6
4886255
f0005f0
bf4d85a
1bcadee
68c9c3e
ae6418f
5581bce
57ba5a5
18473a9
3adea83
69a0351
b1183ad
6a700fd
d71c35c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -239,18 +239,19 @@ | |
| expect(volunteer.phone_number).to eq "15463457898" | ||
| end | ||
|
|
||
| it "sends the volunteer a confirmation email upon email change" do | ||
| it "updates the volunteer email without sending a confirmation email" do | ||
| old_email = volunteer.email | ||
| new_email = "newemail@example.com" | ||
|
|
||
| patch volunteer_path(volunteer), params: { | ||
| volunteer: {email: "newemail@gmail.com"} | ||
| volunteer: {email: new_email} | ||
| } | ||
| expect(response).to have_http_status(:redirect) | ||
|
|
||
| volunteer.reload | ||
| expect(volunteer.unconfirmed_email).to eq("newemail@gmail.com") | ||
| expect(ActionMailer::Base.deliveries.count).to eq(1) | ||
| expect(ActionMailer::Base.deliveries.first).to be_a(Mail::Message) | ||
| expect(ActionMailer::Base.deliveries.first.body.encoded) | ||
| .to match("Click here to confirm your email") | ||
| expect(volunteer.email).to eq(new_email) | ||
| expect(volunteer.old_emails).to eq([old_email]) | ||
| expect(volunteer.unconfirmed_email).to eq(nil) | ||
| end | ||
|
Comment on lines
+242
to
255
|
||
| end | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ | |
| fill_in "volunteer_display_name", with: "Kamisato Ayato" | ||
| fill_in "volunteer_phone_number", with: "+14163248967" | ||
| fill_in "volunteer_date_of_birth", with: Date.new(1998, 7, 1) | ||
| click_on "Submit" | ||
| click_on "Update" | ||
|
|
||
| expect(page).to have_text "Volunteer was successfully updated." | ||
| end | ||
|
|
@@ -31,7 +31,7 @@ | |
| visit edit_volunteer_path(volunteer) | ||
|
|
||
| fill_in "volunteer_phone_number", with: "+141632489" | ||
| click_on "Submit" | ||
| click_on "Update" | ||
| expect(page).to have_text "Phone number must be 10 digits or 12 digits including country code (+1)" | ||
| end | ||
|
|
||
|
|
@@ -44,7 +44,7 @@ | |
| visit edit_volunteer_path(volunteer) | ||
|
|
||
| fill_in "volunteer_phone_number", with: "+141632180923" | ||
| click_on "Submit" | ||
| click_on "Update" | ||
|
|
||
| expect(page).to have_text "Phone number must be 10 digits or 12 digits including country code (+1)" | ||
| end | ||
|
|
@@ -58,7 +58,7 @@ | |
| visit edit_volunteer_path(volunteer) | ||
|
|
||
| fill_in "volunteer_phone_number", with: "+141632u809o" | ||
| click_on "Submit" | ||
| click_on "Update" | ||
|
|
||
| expect(page).to have_text "Phone number must be 10 digits or 12 digits including country code (+1)" | ||
| end | ||
|
|
@@ -72,7 +72,7 @@ | |
| visit edit_volunteer_path(volunteer) | ||
|
|
||
| fill_in "volunteer_phone_number", with: "+24163218092" | ||
| click_on "Submit" | ||
| click_on "Update" | ||
|
|
||
| expect(page).to have_text "Phone number must be 10 digits or 12 digits including country code (+1)" | ||
| end | ||
|
|
@@ -86,7 +86,7 @@ | |
| visit edit_volunteer_path(volunteer) | ||
|
|
||
| fill_in "volunteer_date_of_birth", with: 5.days.from_now | ||
| click_on "Submit" | ||
| click_on "Update" | ||
|
|
||
| expect(page).to have_text "Date of birth must be in the past." | ||
| end | ||
|
|
@@ -104,7 +104,7 @@ | |
| fill_in "volunteer_display_name", with: "Kamisato Ayato" | ||
| fill_in "volunteer_email", with: admin.email | ||
| fill_in "volunteer_display_name", with: "Mickey Mouse" | ||
| click_on "Submit" | ||
| click_on "Update" | ||
|
|
||
| expect(page).to have_text "already been taken" | ||
| end | ||
|
|
@@ -120,7 +120,7 @@ | |
|
|
||
| fill_in "volunteer_email", with: "" | ||
| fill_in "volunteer_display_name", with: "" | ||
| click_on "Submit" | ||
| click_on "Update" | ||
|
|
||
| expect(page).to have_text "can't be blank" | ||
| end | ||
|
|
@@ -129,7 +129,7 @@ | |
|
|
||
| describe "updating a volunteer's email" do | ||
| context "with a valid email" do | ||
| it "sends volunteer a confirmation email and does not change the displayed email" do | ||
| it "updates volunteer email without sending a confirmation email" do | ||
| organization = create(:casa_org) | ||
| admin = create(:casa_admin, casa_org: organization) | ||
| volunteer = create(:volunteer, :with_assigned_supervisor, casa_org: organization) | ||
|
|
@@ -151,25 +151,22 @@ | |
| .to match("Click here to confirm your email") | ||
| end | ||
|
Comment on lines
148
to
152
|
||
|
|
||
|
compwron marked this conversation as resolved.
|
||
| it "succesfully displays the new email once the user confirms" do | ||
| organization = create(:casa_org) | ||
| admin = create(:casa_admin, casa_org: organization) | ||
| volunteer = create(:volunteer, :with_assigned_supervisor, casa_org: organization) | ||
| old_email = volunteer.email | ||
| new_email = "newemail@example.com" | ||
|
|
||
| sign_in admin | ||
| visit edit_volunteer_path(volunteer) | ||
|
|
||
| fill_in "Email", with: "newemail@example.com" | ||
| click_on "Submit" | ||
| volunteer.reload | ||
| volunteer.confirm | ||
| fill_in "Email", with: new_email | ||
| click_on "Update" | ||
|
|
||
| visit edit_volunteer_path(volunteer) | ||
| volunteer.reload | ||
|
|
||
| expect(page).to have_field("Email", with: "newemail@example.com") | ||
| expect(page).not_to have_field("Email", with: old_email) | ||
| expect(page).to have_text "Volunteer was successfully updated." | ||
| expect(page).to have_field("Email", with: new_email) | ||
| expect(volunteer.email).to eq(new_email) | ||
| expect(volunteer.old_emails).to eq([old_email]) | ||
| expect(volunteer.unconfirmed_email).to eq(nil) | ||
| end | ||
| end | ||
| end | ||
|
|
@@ -736,7 +733,7 @@ | |
| visit edit_volunteer_path(volunteer) | ||
|
|
||
| fill_in "volunteer_address_attributes_content", with: "123 Main St" | ||
| click_on "Submit" | ||
| click_on "Update" | ||
| expect(page).to have_text "Volunteer was successfully updated." | ||
| expect(page).to have_selector("input[value='123 Main St']") | ||
| end | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.