Skip to content

Commit

Permalink
try create test for miles driven warning
Browse files Browse the repository at this point in the history
  • Loading branch information
FireLemons committed Nov 13, 2023
1 parent 6ae79b4 commit 19e529c
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions spec/system/case_contacts/new_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,33 @@ def index_of(text)
click_on "Submit"

expect(page).to have_current_path(new_case_contact_path) # Submit Blocked
expect(page).to have_text("Date for occurred on is past maximum allowed date of") # Warning Shown
expect(page).to have_text("Date for occurred on is past maximum allowed date of") # Error Shown
end

it "will ask the user for a confirmation when miles driven is greater than zero and will show the user a warning", js: true do
it "will require the user for a confirmation when miles driven is greater than zero and will show the user a warning", js: true do
volunteer = create(:volunteer, :with_casa_cases)
volunteer_casa_case_one = volunteer.casa_cases.first
create_contact_types(volunteer_casa_case_one.casa_org)

sign_in volunteer
visit new_case_contact_path

fill_out_minimum_required_fields_for_case_contact_form

choose "Voice Only"
fill_in "a. Miles Driven", with: "5"

expect(page).to have_text("You requested driving reimbursement for a contact medium that typically does not involve driving. Are you sure that's right?") # Warning Shown
expect(page).to have_text("I'm sure I drove for this contact medium.") # Confirmation Shown

click_on "Submit"

expect(page).to have_current_path(new_case_contact_path) # Submit blocked from confirmation checkbox

check "I'm sure I drove for this contact medium."
click_on "Submit"

expect(page).not_to have_current_path(new_case_contact_path) # Submit lets user pass
end
end

Expand Down

0 comments on commit 19e529c

Please sign in to comment.