Browse Source

Move test values to the factory

pull/38/head
Kat 4 years ago
parent
commit
a8c27784c4
  1. 2
      spec/factories/case_log.rb
  2. 4
      spec/features/case_log_spec.rb
  3. 2
      spec/helpers/tasklist_helper_spec.rb

2
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 }

4
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

2
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

Loading…
Cancel
Save