diff --git a/spec/features/case_log_spec.rb b/spec/features/case_log_spec.rb index d247d8167..df96ba2ed 100644 --- a/spec/features/case_log_spec.rb +++ b/spec/features/case_log_spec.rb @@ -402,7 +402,7 @@ RSpec.describe "Test Features" do expect(case_log.override_net_income_validation).to be_nil end - it "clears the confirmation question if the page is returned to using the back button" do + it "clears the confirmation question if the amount was amended and the page is returned to using the back button" 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) @@ -412,6 +412,17 @@ RSpec.describe "Test Features" do click_link(text: "Back") expect(page).not_to have_content("Are you sure this is correct?") end + + 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" 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") + check("case-log-override-net-income-validation-override-net-income-validation-field", allow_label_click: true) + click_button("Save and continue") + click_link(text: "Back") + expect(page).to have_content("Are you sure this is correct?") + end end end