-
-
Notifications
You must be signed in to change notification settings - Fork 528
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
Open
Budmin
wants to merge
17
commits into
rubyforgood:main
Choose a base branch
from
Budmin:6600_volunteer_emailsave
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Issue 6600: skip email confirmation when saving new volunteer email, due to how CASA orgs work #6639
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
6fa1255
disabled devise reconfirmable setting
Budmin d3e41c7
email confirmation is only skipped when updating volunteers
Budmin 57eeec6
update to tests
Budmin 4886255
Merge branch 'main' of https://github.com/Budmin/casa into 6600_volun…
Budmin f0005f0
linting fixes
Budmin bf4d85a
fix spelling error
compwron 1bcadee
Merge branch 'main' into 6600_volunteer_emailsave
68c9c3e
Merge branch 'rubyforgood:main' into 6600_volunteer_emailsave
Budmin ae6418f
disabled devise reconfirmable setting
Budmin 5581bce
email confirmation is only skipped when updating volunteers
Budmin 57ba5a5
update to tests
Budmin 18473a9
linting fixes
Budmin 3adea83
fix spelling error
compwron 69a0351
Merge branch '6600_volunteer_emailsave' of https://github.com/Budmin/…
Budmin b1183ad
Merge branch 'main' into 6600_volunteer_emailsave
compwron 6a700fd
Update app/controllers/volunteers_controller.rb
compwron d71c35c
Update spec/system/volunteers/edit_spec.rb
compwron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -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 = "[email protected]" | ||
|
|
||
| patch volunteer_path(volunteer), params: { | ||
| volunteer: {email: "[email protected]"} | ||
| volunteer: {email: new_email} | ||
| } | ||
| expect(response).to have_http_status(:redirect) | ||
|
|
||
| volunteer.reload | ||
| expect(volunteer.unconfirmed_email).to eq("[email protected]") | ||
| 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 | ||
| end | ||
|
|
||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -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,26 @@ | |
| .to match("Click here to confirm your email") | ||
| end | ||
|
|
||
|
compwron marked this conversation as resolved.
|
||
| it "succesfully displays the new email once the user confirms" do | ||
| it "updates volunteer email and tracks old emails" 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 = "[email protected]" | ||
|
|
||
| sign_in admin | ||
| visit edit_volunteer_path(volunteer) | ||
|
|
||
| fill_in "Email", with: "[email protected]" | ||
| 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: "[email protected]") | ||
| 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 +737,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 | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example’s description says no confirmation email is sent, but it no longer asserts anything about mail delivery. Add an expectation that the mail delivery count does not change (or remains 0) when updating a volunteer email so the test actually verifies the intended behavior.