From a8c27784c4400d2952b7bbd1eefd81fe3998eba1 Mon Sep 17 00:00:00 2001 From: Kat Date: Thu, 7 Oct 2021 13:07:29 +0100 Subject: [PATCH] Move test values to the factory --- spec/factories/case_log.rb | 2 ++ spec/features/case_log_spec.rb | 4 ---- spec/helpers/tasklist_helper_spec.rb | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/spec/factories/case_log.rb b/spec/factories/case_log.rb index e2f132c53..d55408242 100644 --- a/spec/factories/case_log.rb +++ b/spec/factories/case_log.rb @@ -5,6 +5,8 @@ FactoryBot.define do status { 0 } tenant_code { "TH356" } postcode { "SW2 6HI" } + previous_postcode { "P0 5ST" } + tenant_age { "12" } end trait :submitted do status { 1 } diff --git a/spec/features/case_log_spec.rb b/spec/features/case_log_spec.rb index 20de280c7..238897c94 100644 --- a/spec/features/case_log_spec.rb +++ b/spec/features/case_log_spec.rb @@ -138,15 +138,11 @@ RSpec.describe "Test Features" do end it "displays number answers in inputs if they are already saved" do - fill_in_number_question(id, "previous_postcode", "P0 5ST") - visit("/case_logs/#{id}/previous_postcode") expect(page).to have_field("case-log-previous-postcode-field", with: "P0 5ST") end it "displays text answers in inputs if they are already saved" do - fill_in_number_question(id, "tenant_age", "12") - visit("/case_logs/#{id}/tenant_age") expect(page).to have_field("case-log-tenant-age-field", with: "12") end diff --git a/spec/helpers/tasklist_helper_spec.rb b/spec/helpers/tasklist_helper_spec.rb index b8fbaae0f..ec07092f6 100644 --- a/spec/helpers/tasklist_helper_spec.rb +++ b/spec/helpers/tasklist_helper_spec.rb @@ -73,7 +73,7 @@ RSpec.describe TasklistHelper do it "returns the number of sections in progress" do @form = Form.new(2021, 2022) - expect(get_sections_count(@form, case_log, :in_progress)).to eq(1) + expect(get_sections_count(@form, case_log, :in_progress)).to eq(2) end it "returns 0 for invalid state" do