|
16 | 16 | fill_in "Display name", with: "Jane Doe" |
17 | 17 | fill_in "Date of birth", with: Date.new(1995, 5, 15) |
18 | 18 |
|
19 | | - expect { |
20 | | - click_on "Create Volunteer" |
21 | | - }.to change(Volunteer, :count).by(1) |
| 19 | + click_on "Create Volunteer" |
| 20 | + |
| 21 | + expect(page).to have_selector(".notice", text: "New volunteer created successfully") |
22 | 22 |
|
23 | 23 | volunteer = Volunteer.find_by(email: "new_volunteer@example.com") |
24 | 24 | expect(volunteer).to be_present |
|
41 | 41 |
|
42 | 42 | click_on "Create Volunteer" |
43 | 43 |
|
| 44 | + expect(page).to have_selector(".notice", text: "New volunteer created successfully") |
| 45 | + |
44 | 46 | volunteer = Volunteer.find_by(email: "volunteer_with_token@example.com") |
45 | 47 | expect(volunteer.invitation_created_at).to be_present |
46 | 48 | expect(volunteer.invitation_accepted_at).to be_nil |
|
77 | 79 |
|
78 | 80 | click_on "Set my password" |
79 | 81 |
|
| 82 | + expect(page).to have_selector(".notice", text: "Your password was set successfully. You are now signed in") |
| 83 | + expect(page).to have_text("My Cases") |
| 84 | + |
80 | 85 | volunteer.reload |
81 | 86 | expect(volunteer.invitation_accepted_at).not_to be_nil |
82 | | - |
83 | | - # Should be redirected to dashboard after accepting invitation |
84 | | - expect(page).to have_text("My Cases") |
85 | 87 | end |
86 | 88 |
|
87 | 89 | it "shows error when passwords don't match" do |
|
137 | 139 | it "allows admin to resend invitation to volunteer who hasn't accepted" do |
138 | 140 | visit edit_volunteer_path(volunteer) |
139 | 141 |
|
140 | | - expect { |
141 | | - click_on "Resend Invitation" |
142 | | - }.to change { ActionMailer::Base.deliveries.count }.by(1) |
| 142 | + click_on "Resend Invitation" |
143 | 143 |
|
144 | 144 | expect(page).to have_text "Invitation sent" |
145 | 145 |
|
|
172 | 172 | fill_in "Display name", with: "Supervisor's Volunteer" |
173 | 173 | fill_in "Date of birth", with: Date.new(1992, 3, 20) |
174 | 174 |
|
175 | | - expect { |
176 | | - click_on "Create Volunteer" |
177 | | - }.to change(Volunteer, :count).by(1) |
| 175 | + click_on "Create Volunteer" |
| 176 | + |
| 177 | + expect(page).to have_selector(".notice", text: "New volunteer created successfully") |
178 | 178 |
|
179 | 179 | volunteer = Volunteer.find_by(email: "supervisor_volunteer@example.com") |
180 | 180 | expect(volunteer).to be_present |
|
0 commit comments