Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions spec/system/case_contacts/edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@

click_on "Submit"

case_contact.reload
expect(page).to have_text "Case contact created at #{case_contact.created_at.strftime("%-I:%-M %p on %m-%e-%Y")}, was successfully updated."
case_contact.reload
expect(case_contact.casa_case_id).to eq casa_case.id
expect(case_contact.duration_minutes).to eq 105
expect(case_contact.medium_type).to eq "letter"
expect(case_contact.contact_made).to be true
end

# TODO: Fix this test
xit "admin successfully edits case contact with mileage reimbursement" do
it "admin successfully edits case contact with mileage reimbursement" do
visit edit_case_contact_path(case_contact)

complete_details_page(case_numbers: [], contact_types: [], contact_made: true, medium: "In Person", hours: 1, minutes: 45, occurred_on: "04/04/2020")
complete_notes_page
fill_in_expenses_page(miles: 10, want_reimbursement: true, address: "123 str")

click_on "Submit"
case_contact.reload
expect(page).to have_text "Case contact created at #{case_contact.created_at.strftime("%-I:%-M %p on %m-%e-%Y")}, was successfully updated."
case_contact.reload
volunteer.address&.reload
expect(case_contact.casa_case.volunteers[0]).to eq volunteer
expect(volunteer.address&.content).to eq "123 str"
expect(case_contact.casa_case_id).to eq casa_case.id
Expand All @@ -63,14 +63,10 @@
visit edit_case_contact_path(case_contact)

complete_details_page(case_numbers: [], contact_types: [], contact_made: true, medium: "In Person", hours: 1, minutes: 45, occurred_on: "04/04/2020")
complete_notes_page

check "Request travel or other reimbursement"
expect(page).to have_field("case_contact_volunteer_address", disabled: true)
expect(page).to have_text("There are two or more volunteers assigned to this case and you are trying to set the address for both of them. This is not currently possible.")

click_on "Submit"
expect(case_contact.reload.volunteer_address).to be_blank
end

context "when user is part of a different organization" do
Expand Down Expand Up @@ -112,8 +108,9 @@
fill_in_expenses_page(miles: 50, want_reimbursement: true, address: "123 Form St")
click_on "Submit"

case_contact.reload
expect(page).to have_text "Case contact created at #{case_contact.created_at.strftime("%-I:%-M %p on %m-%e-%Y")}, was successfully updated."
case_contact.reload
case_contact.contact_topic_answers&.reload
expect(case_contact.duration_minutes).to eq 65
expect(case_contact.medium_type).to eq "letter"
expect(case_contact.contact_made).to be true
Expand All @@ -128,7 +125,7 @@
expect(case_contact.volunteer_address).to eq "123 Form St"
end

xit "is successful with mileage reimbursement on" do # TODO make test not flaky
it "is successful with mileage reimbursement on" do
visit edit_case_contact_path(case_contact)

complete_details_page(contact_made: true, medium: "In Person", hours: 1, minutes: 45, occurred_on: "04/04/2020")
Expand All @@ -137,9 +134,9 @@

click_on "Submit"

expect(page).to have_text "Case contact created at #{case_contact.created_at.strftime("%-I:%-M %p on %m-%e-%Y")}, was successfully updated."
case_contact.reload
volunteer.reload
expect(page).to have_text "Case contact created at #{case_contact.created_at.strftime("%-I:%-M %p on %m-%e-%Y")}, was successfully updated."
expect(volunteer.address.content).to eq "123 str"
expect(case_contact.casa_case_id).to eq casa_case.id
expect(case_contact.duration_minutes).to eq 105
Expand Down