Browse Source

Add some tests

pull/72/head
baarkerlounger 4 years ago
parent
commit
9e29053c8e
  1. 16
      spec/features/case_log_spec.rb
  2. 9
      spec/fixtures/forms/test_form.json

16
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 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!(: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_over_soft_limit) { 750 }
let(:income_under_soft_limit) { 700 }
it "prompts the user to confirm the value is correct" do it "prompts the user to confirm the value is correct" do
visit("/case_logs/#{case_log.id}/net_income") visit("/case_logs/#{case_log.id}/net_income")
fill_in("case-log-net-income-field", with: income_over_soft_limit) fill_in("case-log-net-income-field", with: income_over_soft_limit)
choose("case-log-net-income-frequency-weekly-field", allow_label_click: true) choose("case-log-net-income-frequency-weekly-field", allow_label_click: true)
click_button("Save and continue") click_button("Save and continue")
expect(page).to have_current_path("/case_logs/#{case_log.id}/net_income") check("case-log-override-net-income-validation-override-net-income-validation-field", allow_label_click: true)
expect(page).to have_unchecked_field("case-log-override-net-income-validation-override-net-income-validation-field") 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 end
end end

9
spec/fixtures/forms/test_form.json vendored

@ -328,6 +328,15 @@
"2": "Yearly" "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": { "net_income_uc_proportion": {

Loading…
Cancel
Save