|
140 | 140 |
|
141 | 141 | fill_in "Email", with: "newemail@example.com" |
142 | 142 | click_on "Submit" |
143 | | - volunteer.reload |
| 143 | + |
| 144 | + expect(page).to have_text "Volunteer was successfully updated. Confirmation Email Sent." |
| 145 | + expect(page).to have_field("Email", with: old_email) |
| 146 | + expect(volunteer.reload.unconfirmed_email).to eq("newemail@example.com") |
144 | 147 |
|
145 | 148 | expect(ActionMailer::Base.deliveries.count).to eq(1) |
146 | 149 | expect(ActionMailer::Base.deliveries.first).to be_a(Mail::Message) |
147 | 150 | expect(ActionMailer::Base.deliveries.first.body.encoded) |
148 | 151 | .to match("Click here to confirm your email") |
149 | | - |
150 | | - expect(page).to have_text "Volunteer was successfully updated. Confirmation Email Sent." |
151 | | - expect(page).to have_field("Email", with: old_email) |
152 | | - expect(volunteer.unconfirmed_email).to eq("newemail@example.com") |
153 | 152 | end |
154 | 153 |
|
155 | 154 | it "succesfully displays the new email once the user confirms" do |
|
481 | 480 | uncheck "with_cc" |
482 | 481 | click_on "Send Reminder" |
483 | 482 |
|
| 483 | + expect(page).to have_content("Reminder sent to volunteer") |
| 484 | + |
484 | 485 | expect(ActionMailer::Base.deliveries.count).to eq(1) |
485 | 486 | expect(ActionMailer::Base.deliveries.first.cc).to be_empty |
486 | 487 | end |
|
496 | 497 | check "with_cc" |
497 | 498 | click_on "Send Reminder" |
498 | 499 |
|
| 500 | + expect(page).to have_content("Reminder sent to volunteer") |
| 501 | + |
499 | 502 | expect(ActionMailer::Base.deliveries.count).to eq(1) |
500 | 503 | expect(ActionMailer::Base.deliveries.first.cc).to include(volunteer.supervisor.email) |
501 | 504 | end |
|
511 | 514 | check "with_cc" |
512 | 515 | click_on "Send Reminder" |
513 | 516 |
|
| 517 | + expect(page).to have_content("Reminder sent to volunteer") |
| 518 | + |
514 | 519 | expect(ActionMailer::Base.deliveries.count).to eq(1) |
515 | 520 | expect(ActionMailer::Base.deliveries.first.cc).to be_empty |
516 | 521 | end |
|
530 | 535 |
|
531 | 536 | click_on "Send Reminder" |
532 | 537 |
|
| 538 | + expect(page).to have_content("Reminder sent to volunteer") |
| 539 | + |
533 | 540 | expect(ActionMailer::Base.deliveries.count).to eq(1) |
534 | 541 | end |
535 | 542 |
|
|
543 | 550 | check "with_cc" |
544 | 551 | click_on "Send Reminder" |
545 | 552 |
|
| 553 | + expect(page).to have_content("Reminder sent to volunteer") |
| 554 | + |
546 | 555 | expect(ActionMailer::Base.deliveries.count).to eq(1) |
547 | 556 | expect(ActionMailer::Base.deliveries.first.cc).to include(volunteer.supervisor.email) |
548 | 557 | expect(ActionMailer::Base.deliveries.first.cc).to include(admin.email) |
|
0 commit comments