From 7ebe1f9f06045cbdfa80d26a13a2720a6e3290eb Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 3 Apr 2023 11:48:08 +0100 Subject: [PATCH] Fix some uprn tests --- spec/factories/lettings_log.rb | 8 ++++++-- spec/models/form/sales/pages/address_spec.rb | 4 ++-- spec/models/form/sales/pages/uprn_spec.rb | 2 +- .../models/form/sales/questions/uprn_confirmation_spec.rb | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/spec/factories/lettings_log.rb b/spec/factories/lettings_log.rb index ce2b1cee7..26f4da140 100644 --- a/spec/factories/lettings_log.rb +++ b/spec/factories/lettings_log.rb @@ -60,8 +60,8 @@ FactoryBot.define do illness { 1 } preg_occ { 2 } startertenancy { 1 } - tenancylength { nil } - tenancy { 1 } + tenancylength { 2 } + tenancy { 4 } ppostcode_full { Faker::Address.postcode } rsnvac { 6 } unittype_gn { 7 } @@ -142,6 +142,10 @@ FactoryBot.define do declaration { 1 } first_time_property_let_as_social_housing { 0 } referral { 2 } + uprn_known { 0 } + joint { 3 } + address_line1 { "fake address" } + town_or_city { "London" } end trait :export do tenancycode { "987654" } diff --git a/spec/models/form/sales/pages/address_spec.rb b/spec/models/form/sales/pages/address_spec.rb index 43a054a1e..a90328e3e 100644 --- a/spec/models/form/sales/pages/address_spec.rb +++ b/spec/models/form/sales/pages/address_spec.rb @@ -42,7 +42,7 @@ RSpec.describe Form::Sales::Pages::Address, type: :model do context "when uprn_confirmed != 1" do let(:log) do - create(:sales_log, uprn_known: 1, uprn_confirmed: 0) + create(:sales_log, uprn_known: 1, uprn: "12345", uprn_confirmed: 0) end it "returns true" do @@ -62,7 +62,7 @@ RSpec.describe Form::Sales::Pages::Address, type: :model do context "when uprn_confirmed == 1 && uprn_known != 0" do let(:log) do - create(:sales_log, uprn_known: 1, uprn_confirmed: 1) + create(:sales_log, uprn_known: 1, uprn: "12345", uprn_confirmed: 1) end it "returns true" do diff --git a/spec/models/form/sales/pages/uprn_spec.rb b/spec/models/form/sales/pages/uprn_spec.rb index 37fa0f329..64671e9ce 100644 --- a/spec/models/form/sales/pages/uprn_spec.rb +++ b/spec/models/form/sales/pages/uprn_spec.rb @@ -45,7 +45,7 @@ RSpec.describe Form::Sales::Pages::Uprn, type: :model do end context "when uprn_known == 1" do - let(:log) { create(:sales_log, uprn_known: 1) } + let(:log) { create(:sales_log, uprn_known: 1, uprn: "12345") } it "returns true" do expect(page.routed_to?(log)).to eq(true) diff --git a/spec/models/form/sales/questions/uprn_confirmation_spec.rb b/spec/models/form/sales/questions/uprn_confirmation_spec.rb index 60111cc42..2bb986fcd 100644 --- a/spec/models/form/sales/questions/uprn_confirmation_spec.rb +++ b/spec/models/form/sales/questions/uprn_confirmation_spec.rb @@ -72,7 +72,7 @@ RSpec.describe Form::Sales::Questions::UprnConfirmation, type: :model do end context "when uprn_known == 1 && uprn_confirmed == nil" do - let(:log) { create(:sales_log, uprn_known: 1, uprn_confirmed: nil) } + let(:log) { create(:sales_log, uprn_known: 1, uprn: "12345", uprn_confirmed: nil) } it "returns false" do expect(question.hidden_in_check_answers?(log)).to eq(false) @@ -80,7 +80,7 @@ RSpec.describe Form::Sales::Questions::UprnConfirmation, type: :model do end context "when uprn_known != 1 && uprn_confirmed == 1" do - let(:log) { create(:sales_log, uprn_known: 1, uprn_confirmed: 1) } + let(:log) { create(:sales_log, uprn_known: 1, uprn: "12345", uprn_confirmed: 1) } it "returns true" do expect(question.hidden_in_check_answers?(log)).to eq(true)