diff --git a/spec/features/case_log_spec.rb b/spec/features/case_log_spec.rb index 809200363..a64d7baf1 100644 --- a/spec/features/case_log_spec.rb +++ b/spec/features/case_log_spec.rb @@ -381,14 +381,26 @@ RSpec.describe "Test Features" do context "given a weekly net income that is above the expected amount for the given economic status but below the hard max" do let!(:case_log){ FactoryBot.create(:case_log, :in_progress, person_1_economic_status: "Full-time - 30 hours or more") } let(:income_over_soft_limit) { 750 } + let(:income_under_soft_limit) { 700 } it "prompts the user to confirm the value is correct" do visit("/case_logs/#{case_log.id}/net_income") fill_in("case-log-net-income-field", with: income_over_soft_limit) choose("case-log-net-income-frequency-weekly-field", allow_label_click: true) click_button("Save and continue") - expect(page).to have_current_path("/case_logs/#{case_log.id}/net_income") - expect(page).to have_unchecked_field("case-log-override-net-income-validation-override-net-income-validation-field") + check("case-log-override-net-income-validation-override-net-income-validation-field", allow_label_click: true) + click_button("Save and continue") + expect(page).to have_current_path("/case_logs/#{case_log.id}/net_income_uc_proportion") + end + + it "does not require confirming the value if the value is amended" do + visit("/case_logs/#{case_log.id}/net_income") + fill_in("case-log-net-income-field", with: income_over_soft_limit) + choose("case-log-net-income-frequency-weekly-field", allow_label_click: true) + click_button("Save and continue") + fill_in("case-log-net-income-field", with: income_under_soft_limit) + click_button("Save and continue") + expect(page).to have_current_path("/case_logs/#{case_log.id}/net_income_uc_proportion") end end end diff --git a/spec/fixtures/forms/test_form.json b/spec/fixtures/forms/test_form.json index 35590cb3e..2bcd34aaa 100644 --- a/spec/fixtures/forms/test_form.json +++ b/spec/fixtures/forms/test_form.json @@ -328,6 +328,15 @@ "2": "Yearly" } } + }, + "soft_validations": { + "override_net_income_validation": { + "check_answer_label": "Net income confirmed?", + "type": "validation_override", + "answer_options": { + "override_net_income_validation": "Yes" + } + } } }, "net_income_uc_proportion": {