|
70 | 70 | hours: 1, minutes: 45 |
71 | 71 | ) |
72 | 72 |
|
73 | | - expect { click_on "Submit" }.not_to change(CaseContact, :count) |
74 | | - |
75 | | - expect(page).to have_text("Medium type can't be blank") |
| 73 | + expect do |
| 74 | + click_on "Submit" |
| 75 | + expect(page).to have_text("Medium type can't be blank") |
| 76 | + end.not_to change(CaseContact, :count) |
76 | 77 |
|
77 | 78 | expect(page).to have_field("case_contact_duration_hours", with: 1) |
78 | 79 | expect(page).to have_field("case_contact_duration_minutes", with: 45) |
|
83 | 84 |
|
84 | 85 | describe "contact types" do |
85 | 86 | # TODO: Fix this test |
86 | | - xit "requires a contact type" do |
| 87 | + it "requires a contact type" do |
87 | 88 | subject |
88 | 89 |
|
89 | 90 | fill_in_contact_details(contact_types: nil) |
90 | 91 |
|
91 | | - expect { click_on "Submit" }.to not_change(CaseContact.active, :count) |
92 | | - expect(page).to have_text("Contact Type must be selected") |
| 92 | + expect do |
| 93 | + click_on "Submit" |
| 94 | + expect(page).to have_text("Contact Type must be selected") |
| 95 | + end.to not_change(CaseContact.active, :count) |
| 96 | + |
93 | 97 | check contact_types.first.name |
94 | | - expect { click_on "Submit" }.to change(CaseContact.active, :count).by(1) |
| 98 | + expect do |
| 99 | + click_on "Submit" |
| 100 | + expect(page).to have_text("Case contact successfully created.") |
| 101 | + end.to change(CaseContact.active, :count).by(1) |
95 | 102 | end |
96 | 103 |
|
97 | 104 | it "does not display empty contact groups or hidden contact types" do |
|
180 | 187 |
|
181 | 188 | context "when org has no contact topics" do |
182 | 189 | # TODO: Fix this test |
183 | | - xit "allows entering contact notes" do |
| 190 | + it "allows entering contact notes" do |
184 | 191 | expect(casa_org.contact_topics.size).to eq 0 |
185 | 192 | subject |
186 | 193 |
|
|
190 | 197 |
|
191 | 198 | expect { |
192 | 199 | click_on "Submit" |
| 200 | + expect(page).to have_text("Case contact successfully created.") |
193 | 201 | }.to change(CaseContact.active, :count).by(1) |
194 | 202 |
|
195 | 203 | case_contact = CaseContact.active.last |
|
268 | 276 | fill_in volunteer_address_input, with: "123 Example St" |
269 | 277 | uncheck reimbursement_checkbox |
270 | 278 |
|
271 | | - expect { click_on "Submit" }.to change(CaseContact.active, :count).by(1) |
| 279 | + expect { |
| 280 | + click_on "Submit" |
| 281 | + expect(page).to have_text("Case contact successfully created.") |
| 282 | + }.to change(CaseContact.active, :count).by(1) |
272 | 283 | case_contact = CaseContact.active.last |
273 | 284 |
|
274 | 285 | expect(case_contact.want_driving_reimbursement).to be false |
275 | 286 | expect(case_contact.miles_driven).to be_zero |
276 | 287 | end |
277 | 288 |
|
278 | | - xit "saves mileage and address information" do # TODO make test not flaky |
| 289 | + it "saves mileage and address information" do # TODO make test not flaky |
279 | 290 | subject |
280 | 291 | fill_in_contact_details contact_types: %w[School] |
281 | 292 |
|
|
284 | 295 | fill_in miles_driven_input, with: 50 |
285 | 296 | fill_in volunteer_address_input, with: "123 Example St" |
286 | 297 |
|
287 | | - expect { click_on "Submit" }.to change(CaseContact.active, :count).by(1) |
| 298 | + expect { |
| 299 | + click_on "Submit" |
| 300 | + expect(page).to have_text("Case contact successfully created.") |
| 301 | + }.to change(CaseContact.active, :count).by(1) |
288 | 302 | case_contact = CaseContact.active.last |
289 | 303 |
|
290 | 304 | expect(case_contact.want_driving_reimbursement).to be true |
|
310 | 324 |
|
311 | 325 | check reimbursement_checkbox |
312 | 326 |
|
313 | | - expect { click_on "Submit" }.not_to change(CaseContact.active, :count) |
314 | | - expect(page).to have_text("Must enter a valid mailing address for the reimbursement") |
| 327 | + expect { |
| 328 | + click_on "Submit" |
| 329 | + expect(page).to have_text("Must enter a valid mailing address for the reimbursement") |
| 330 | + }.not_to change(CaseContact.active, :count) |
315 | 331 | expect(page).to have_text("Must enter miles driven to receive driving reimbursement") |
316 | 332 | end |
317 | 333 |
|
|
391 | 407 | ) |
392 | 408 |
|
393 | 409 | check "Create Another" |
394 | | - expect { click_on "Submit" } |
| 410 | + expect { |
| 411 | + click_on "Submit" |
| 412 | + expect(page).to have_text "Case contact successfully created." |
| 413 | + } |
395 | 414 | .to change(CaseContact, :count).by(1) |
396 | 415 | # .to change(CaseContact.active, :count).by(1) |
397 | 416 | # .and change(CaseContact.started, :count).by(1) |
|
441 | 460 | it "redirects to the new CaseContact form with the same cases selected" do |
442 | 461 | expect { |
443 | 462 | visit new_case_contact_path(casa_case, {draft_case_ids:}) |
| 463 | + expect(page).to have_content("Record New Case Contact") |
444 | 464 | }.to change(CaseContact.started, :count).by(1) |
445 | 465 | this_case_contact = CaseContact.started.last |
446 | 466 |
|
|
452 | 472 |
|
453 | 473 | expect { |
454 | 474 | click_on "Submit" |
| 475 | + expect(page).to have_text "Case contacts successfully created." |
455 | 476 | }.to change(CaseContact.active, :count).by(2) |
456 | 477 |
|
457 | 478 | expect(page).to have_text "New Case Contact" |
|
516 | 537 |
|
517 | 538 | expect { |
518 | 539 | click_on "Submit" |
| 540 | + expect(page).to have_text "Case contact successfully created." |
519 | 541 | }.to change(CaseContact.active, :count).by(1) |
520 | 542 | contact = CaseContact.active.last |
521 | 543 | expect(contact.casa_case_id).to eq casa_case.id |
|
0 commit comments