|
125 | 125 |
|
126 | 126 | fill_in "Email", with: "newemail@example.com" |
127 | 127 | click_on "Submit" |
128 | | - volunteer.reload |
| 128 | + |
| 129 | + expect(page).to have_text "Volunteer was successfully updated. Confirmation Email Sent." |
| 130 | + expect(page).to have_field("Email", with: old_email) |
| 131 | + expect(volunteer.reload.unconfirmed_email).to eq("newemail@example.com") |
129 | 132 |
|
130 | 133 | expect(ActionMailer::Base.deliveries.count).to eq(1) |
131 | 134 | expect(ActionMailer::Base.deliveries.first).to be_a(Mail::Message) |
132 | 135 | expect(ActionMailer::Base.deliveries.first.body.encoded) |
133 | 136 | .to match("Click here to confirm your email") |
134 | | - |
135 | | - expect(page).to have_text "Volunteer was successfully updated. Confirmation Email Sent." |
136 | | - expect(page).to have_field("Email", with: old_email) |
137 | | - expect(volunteer.unconfirmed_email).to eq("newemail@example.com") |
138 | 137 | end |
139 | 138 |
|
140 | 139 | it "succesfully displays the new email once the user confirms" do |
|
442 | 441 | uncheck "with_cc" |
443 | 442 | click_on "Send Reminder" |
444 | 443 |
|
| 444 | + expect(page).to have_content("Reminder sent to volunteer") |
| 445 | + |
445 | 446 | expect(ActionMailer::Base.deliveries.count).to eq(1) |
446 | 447 | expect(ActionMailer::Base.deliveries.first.cc).to be_empty |
447 | 448 | end |
|
456 | 457 | check "with_cc" |
457 | 458 | click_on "Send Reminder" |
458 | 459 |
|
| 460 | + expect(page).to have_content("Reminder sent to volunteer") |
| 461 | + |
459 | 462 | expect(ActionMailer::Base.deliveries.count).to eq(1) |
460 | 463 | expect(ActionMailer::Base.deliveries.first.cc).to include(volunteer.supervisor.email) |
461 | 464 | end |
|
471 | 474 | check "with_cc" |
472 | 475 | click_on "Send Reminder" |
473 | 476 |
|
| 477 | + expect(page).to have_content("Reminder sent to volunteer") |
| 478 | + |
474 | 479 | expect(ActionMailer::Base.deliveries.count).to eq(1) |
475 | 480 | expect(ActionMailer::Base.deliveries.first.cc).to be_empty |
476 | 481 | end |
|
490 | 495 |
|
491 | 496 | click_on "Send Reminder" |
492 | 497 |
|
| 498 | + expect(page).to have_content("Reminder sent to volunteer") |
| 499 | + |
493 | 500 | expect(ActionMailer::Base.deliveries.count).to eq(1) |
494 | 501 | end |
495 | 502 |
|
|
502 | 509 | visit edit_volunteer_path(volunteer) |
503 | 510 | check "with_cc" |
504 | 511 | click_on "Send Reminder" |
| 512 | + |
| 513 | + expect(page).to have_content("Reminder sent to volunteer") |
505 | 514 |
|
506 | 515 | expect(ActionMailer::Base.deliveries.count).to eq(1) |
507 | 516 | expect(ActionMailer::Base.deliveries.first.cc).to include(volunteer.supervisor.email) |
|
0 commit comments