Browse Source

Fix some uprn tests

further-bulk-upload-year-fixes
Kat 2 years ago
parent
commit
7ebe1f9f06
  1. 8
      spec/factories/lettings_log.rb
  2. 4
      spec/models/form/sales/pages/address_spec.rb
  3. 2
      spec/models/form/sales/pages/uprn_spec.rb
  4. 4
      spec/models/form/sales/questions/uprn_confirmation_spec.rb

8
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" }

4
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

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

4
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)

Loading…
Cancel
Save