Browse Source

validation spec changes

pull/372/head
MadeTech Dushan 3 years ago committed by baarkerlounger
parent
commit
b53c2a473f
  1. 70
      spec/features/form/validations_spec.rb

70
spec/features/form/validations_spec.rb

@ -124,51 +124,51 @@ RSpec.describe "validations" do
let(:income_over_soft_limit) { 750 } let(:income_over_soft_limit) { 750 }
let(:income_under_soft_limit) { 700 } let(:income_under_soft_limit) { 700 }
it "prompts the user to confirm the value is correct on an interruption screen", js: true do it "prompts the user to confirm the value is correct with an interruption screen" do
visit("/logs/#{case_log.id}/net-income") visit("/logs/#{case_log.id}/net-income")
fill_in("case-log-earnings-field", with: income_over_soft_limit) fill_in("case-log-earnings-field", with: income_over_soft_limit)
choose("case-log-incfreq-0-field", allow_label_click: true) choose("case-log-incfreq-0-field", allow_label_click: true)
click_button("Save and continue") click_button("Save and continue")
expect(page).to have_current_path("/logs/#{case_log.id}/net-income-value-check") expect(page).to have_current_path("/logs/#{case_log.id}/net-income-value-check")
expect(page).to have_content("Is the value correct?") expect(page).to have_content("Is the value correct?")
check("case-log-net-income-soft-validation-yes-field", allow_label_click: true) check("case-log-net-income-value-check-yes-field", allow_label_click: true)
click_button("Save and continue") click_button("Save and continue")
expect(page).to have_current_path("/logs/#{case_log.id}/net-income-uc-proportion") expect(page).to have_current_path("/logs/#{case_log.id}/net-income-uc-proportion")
end end
xit "does not require confirming the value if the value is amended" do # it "does not require confirming the value if the value is amended" do
visit("/logs/#{case_log.id}/net-income") # visit("/logs/#{case_log.id}/net-income")
fill_in("case-log-earnings-field", with: income_over_soft_limit) # fill_in("case-log-earnings-field", with: income_over_soft_limit)
choose("case-log-incfreq-0-field", allow_label_click: true) # choose("case-log-incfreq-0-field", allow_label_click: true)
click_button("Save and continue") # click_button("Save and continue")
fill_in("case-log-earnings-field", with: income_under_soft_limit) # fill_in("case-log-earnings-field", with: income_under_soft_limit)
click_button("Save and continue") # click_button("Save and continue")
expect(page).to have_current_path("/logs/#{case_log.id}/net-income-uc-proportion") # expect(page).to have_current_path("/logs/#{case_log.id}/net-income-uc-proportion")
case_log.reload # case_log.reload
expect(case_log.override_net_income_validation).to be_nil # expect(case_log.net_income_value_check).to be_nil
end # end
xit "clears the confirmation question if the amount was amended and the page is returned to using the back button", js: true do # it "clears the confirmation question if the amount was amended and the page is returned to using the back button", js: true do
visit("/logs/#{case_log.id}/net-income") # visit("/logs/#{case_log.id}/net-income")
fill_in("case-log-earnings-field", with: income_over_soft_limit) # fill_in("case-log-earnings-field", with: income_over_soft_limit)
choose("case-log-incfreq-0-field", allow_label_click: true) # choose("case-log-incfreq-0-field", allow_label_click: true)
click_button("Save and continue") # click_button("Save and continue")
fill_in("case-log-earnings-field", with: income_under_soft_limit) # fill_in("case-log-earnings-field", with: income_under_soft_limit)
click_button("Save and continue") # click_button("Save and continue")
click_link(text: "Back") # click_link(text: "Back")
expect(page).to have_no_content("Are you sure this is correct?") # expect(page).to have_no_content("Are you sure this is correct?")
end # end
xit "does not clear the confirmation question if the page is returned to using the back button and the amount is still over the soft limit", js: true do # it "does not clear the confirmation question if the page is returned to using the back button and the amount is still over the soft limit", js: true do
visit("/logs/#{case_log.id}/net-income") # visit("/logs/#{case_log.id}/net-income")
fill_in("case-log-earnings-field", with: income_over_soft_limit) # fill_in("case-log-earnings-field", with: income_over_soft_limit)
choose("case-log-incfreq-0-field", allow_label_click: true) # choose("case-log-incfreq-0-field", allow_label_click: true)
click_button("Save and continue") # click_button("Save and continue")
check("case-log-override-net-income-validation-override-net-income-validation-field", allow_label_click: true) # check("case-log-override-net-income-validation-override-net-income-validation-field", allow_label_click: true)
click_button("Save and continue") # click_button("Save and continue")
click_link(text: "Back") # click_link(text: "Back")
expect(page).to have_content("Are you sure this is correct?") # expect(page).to have_content("Are you sure this is correct?")
end # end
end end
end end

Loading…
Cancel
Save