From 37fab3fe2597d2df1a26dbbc8bf010045c5b62c4 Mon Sep 17 00:00:00 2001
From: Jack <113976590+bibblobcode@users.noreply.github.com>
Date: Mon, 17 Apr 2023 16:54:59 +0100
Subject: [PATCH] [CLDC-2260] Move UPRN Known and UPRN questions to same page
(#1537)
* Set uprn_known to 1 when setting UPRN
* Move fake to dev+test gemfile block
So that we can use factories in local
* Move UPRN known and UPRN questions to single UPRN page
---
Gemfile | 2 +-
app/models/form/lettings/pages/uprn.rb | 5 +-
app/models/form/lettings/pages/uprn_known.rb | 16 ------
app/models/form/lettings/questions/uprn.rb | 13 +++--
.../form/lettings/questions/uprn_known.rb | 2 +
.../subsections/property_information.rb | 1 -
app/models/form/sales/pages/uprn.rb | 1 +
app/models/form/sales/pages/uprn_known.rb | 12 -----
app/models/form/sales/questions/uprn.rb | 13 +++--
app/models/form/sales/questions/uprn_known.rb | 8 +++
.../sales/subsections/property_information.rb | 1 -
app/models/log.rb | 1 +
.../form/lettings/pages/uprn_known_spec.rb | 51 -------------------
spec/models/form/lettings/pages/uprn_spec.rb | 10 +---
.../lettings/questions/uprn_known_spec.rb | 4 +-
.../form/lettings/questions/uprn_spec.rb | 46 ++++++++++-------
.../subsections/property_information_spec.rb | 1 -
.../form/sales/pages/uprn_known_spec.rb | 33 ------------
spec/models/form/sales/pages/uprn_spec.rb | 2 +-
.../form/sales/questions/uprn_known_spec.rb | 4 +-
spec/models/form/sales/questions/uprn_spec.rb | 47 ++++++++++-------
.../subsections/property_information_spec.rb | 1 -
spec/models/lettings_log_spec.rb | 1 +
spec/models/sales_log_spec.rb | 1 +
24 files changed, 97 insertions(+), 179 deletions(-)
delete mode 100644 app/models/form/lettings/pages/uprn_known.rb
delete mode 100644 app/models/form/sales/pages/uprn_known.rb
delete mode 100644 spec/models/form/lettings/pages/uprn_known_spec.rb
delete mode 100644 spec/models/form/sales/pages/uprn_known_spec.rb
diff --git a/Gemfile b/Gemfile
index 741f484bd..f23a4db6f 100644
--- a/Gemfile
+++ b/Gemfile
@@ -70,6 +70,7 @@ group :development, :test do
gem "byebug", platforms: %i[mri mingw x64_mingw]
gem "dotenv-rails"
gem "factory_bot_rails"
+ gem "faker"
gem "pry-byebug"
gem "parallel_tests"
@@ -93,7 +94,6 @@ group :test do
gem "capybara", require: false
gem "capybara-lockstep"
gem "capybara-screenshot"
- gem "faker"
gem "rspec-rails", require: false
gem "selenium-webdriver", require: false
gem "simplecov", require: false
diff --git a/app/models/form/lettings/pages/uprn.rb b/app/models/form/lettings/pages/uprn.rb
index 7b6b90f1a..f50111798 100644
--- a/app/models/form/lettings/pages/uprn.rb
+++ b/app/models/form/lettings/pages/uprn.rb
@@ -6,14 +6,13 @@ class Form::Lettings::Pages::Uprn < ::Form::Page
def questions
@questions ||= [
+ Form::Lettings::Questions::UprnKnown.new(nil, nil, self),
Form::Lettings::Questions::Uprn.new(nil, nil, self),
]
end
def routed_to?(log, _current_user = nil)
- return false if log.is_supported_housing?
-
- log.uprn_known == 1
+ !log.is_supported_housing?
end
def skip_text
diff --git a/app/models/form/lettings/pages/uprn_known.rb b/app/models/form/lettings/pages/uprn_known.rb
deleted file mode 100644
index 1ded1ba82..000000000
--- a/app/models/form/lettings/pages/uprn_known.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class Form::Lettings::Pages::UprnKnown < ::Form::Page
- def initialize(id, hsh, subsection)
- super
- @id = "uprn_known"
- end
-
- def questions
- @questions ||= [
- Form::Lettings::Questions::UprnKnown.new(nil, nil, self),
- ]
- end
-
- def routed_to?(log, _current_user = nil)
- !log.is_supported_housing?
- end
-end
diff --git a/app/models/form/lettings/questions/uprn.rb b/app/models/form/lettings/questions/uprn.rb
index efe9a4ea4..95ade90ad 100644
--- a/app/models/form/lettings/questions/uprn.rb
+++ b/app/models/form/lettings/questions/uprn.rb
@@ -5,9 +5,14 @@ class Form::Lettings::Questions::Uprn < ::Form::Question
@check_answer_label = "UPRN"
@header = "What is the property's UPRN"
@type = "text"
- @hint_text = "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and sectors UK-wide. For example 10010457355."
@width = 10
@question_number = 11
+ @inferred_check_answers_value = [
+ {
+ "condition" => { "uprn_known" => 0 },
+ "value" => "Not known",
+ },
+ ]
end
def unanswered_error_message
@@ -15,6 +20,8 @@ class Form::Lettings::Questions::Uprn < ::Form::Question
end
def get_extra_check_answer_value(log)
+ return unless log.uprn_known == 1
+
value = [
log.address_line1,
log.address_line2,
@@ -28,8 +35,4 @@ class Form::Lettings::Questions::Uprn < ::Form::Question
"\n\n#{value.join("\n")}"
end
-
- def hidden_in_check_answers?(log, _current_user = nil)
- log.uprn_known != 1
- end
end
diff --git a/app/models/form/lettings/questions/uprn_known.rb b/app/models/form/lettings/questions/uprn_known.rb
index d206885fb..816a31ffb 100644
--- a/app/models/form/lettings/questions/uprn_known.rb
+++ b/app/models/form/lettings/questions/uprn_known.rb
@@ -8,6 +8,8 @@ class Form::Lettings::Questions::UprnKnown < ::Form::Question
@answer_options = ANSWER_OPTIONS
@hint_text = "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and sectors UK-wide. For example 10010457355.
You can continue without the UPRN, but it means we will need you to enter the address of the property."
+ @conditional_for = { "uprn" => [1] }
+ @hidden_in_check_answers = true
end
ANSWER_OPTIONS = {
diff --git a/app/models/form/lettings/subsections/property_information.rb b/app/models/form/lettings/subsections/property_information.rb
index 2e21b8c5a..1290f7cf2 100644
--- a/app/models/form/lettings/subsections/property_information.rb
+++ b/app/models/form/lettings/subsections/property_information.rb
@@ -30,7 +30,6 @@ class Form::Lettings::Subsections::PropertyInformation < ::Form::Subsection
def uprn_questions
if form.start_date.year >= 2023
[
- Form::Lettings::Pages::UprnKnown.new(nil, nil, self),
Form::Lettings::Pages::Uprn.new(nil, nil, self),
Form::Lettings::Pages::UprnConfirmation.new(nil, nil, self),
Form::Lettings::Pages::Address.new(nil, nil, self),
diff --git a/app/models/form/sales/pages/uprn.rb b/app/models/form/sales/pages/uprn.rb
index e1835f8ca..ad247207f 100644
--- a/app/models/form/sales/pages/uprn.rb
+++ b/app/models/form/sales/pages/uprn.rb
@@ -6,6 +6,7 @@ class Form::Sales::Pages::Uprn < ::Form::Page
def questions
@questions ||= [
+ Form::Sales::Questions::UprnKnown.new(nil, nil, self),
Form::Sales::Questions::Uprn.new(nil, nil, self),
]
end
diff --git a/app/models/form/sales/pages/uprn_known.rb b/app/models/form/sales/pages/uprn_known.rb
deleted file mode 100644
index e2cbfe63f..000000000
--- a/app/models/form/sales/pages/uprn_known.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-class Form::Sales::Pages::UprnKnown < ::Form::Page
- def initialize(id, hsh, subsection)
- super
- @id = "uprn_known"
- end
-
- def questions
- @questions ||= [
- Form::Sales::Questions::UprnKnown.new(nil, nil, self),
- ]
- end
-end
diff --git a/app/models/form/sales/questions/uprn.rb b/app/models/form/sales/questions/uprn.rb
index 7967a2035..6b51260a7 100644
--- a/app/models/form/sales/questions/uprn.rb
+++ b/app/models/form/sales/questions/uprn.rb
@@ -5,9 +5,14 @@ class Form::Sales::Questions::Uprn < ::Form::Question
@check_answer_label = "UPRN"
@header = "What is the property's UPRN"
@type = "text"
- @hint_text = "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and sectors UK-wide. For example 10010457355."
@width = 10
@question_number = 14
+ @inferred_check_answers_value = [
+ {
+ "condition" => { "uprn_known" => 0 },
+ "value" => "Not known",
+ },
+ ]
end
def unanswered_error_message
@@ -15,6 +20,8 @@ class Form::Sales::Questions::Uprn < ::Form::Question
end
def get_extra_check_answer_value(log)
+ return unless log.uprn_known == 1
+
value = [
log.address_line1,
log.address_line2,
@@ -28,8 +35,4 @@ class Form::Sales::Questions::Uprn < ::Form::Question
"\n\n#{value.join("\n")}"
end
-
- def hidden_in_check_answers?(log, _current_user = nil)
- log.uprn_known != 1
- end
end
diff --git a/app/models/form/sales/questions/uprn_known.rb b/app/models/form/sales/questions/uprn_known.rb
index b07b0b7d7..22438e662 100644
--- a/app/models/form/sales/questions/uprn_known.rb
+++ b/app/models/form/sales/questions/uprn_known.rb
@@ -8,6 +8,14 @@ class Form::Sales::Questions::UprnKnown < ::Form::Question
@answer_options = ANSWER_OPTIONS
@hint_text = "The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and sectors UK-wide. For example 10010457355.
You can continue without the UPRN, but it means we will need you to enter the address of the property."
+ @conditional_for = { "uprn" => [1] }
+ @inferred_check_answers_value = [
+ {
+ "condition" => { "uprn_known" => 0 },
+ "value" => "Not known",
+ },
+ ]
+ @hidden_in_check_answers = true
end
ANSWER_OPTIONS = {
diff --git a/app/models/form/sales/subsections/property_information.rb b/app/models/form/sales/subsections/property_information.rb
index 95d8485c8..74a064dca 100644
--- a/app/models/form/sales/subsections/property_information.rb
+++ b/app/models/form/sales/subsections/property_information.rb
@@ -24,7 +24,6 @@ class Form::Sales::Subsections::PropertyInformation < ::Form::Subsection
def uprn_questions
if form.start_date.year >= 2023
[
- Form::Sales::Pages::UprnKnown.new(nil, nil, self),
Form::Sales::Pages::Uprn.new(nil, nil, self),
Form::Sales::Pages::UprnConfirmation.new(nil, nil, self),
Form::Sales::Pages::Address.new(nil, nil, self),
diff --git a/app/models/log.rb b/app/models/log.rb
index 13f7a5b5b..33d3c4547 100644
--- a/app/models/log.rb
+++ b/app/models/log.rb
@@ -52,6 +52,7 @@ class Log < ApplicationRecord
presenter = UprnDataPresenter.new(service.result)
+ self.uprn_known = 1
self.uprn_confirmed = nil
self.address_line1 = presenter.address_line1
self.address_line2 = presenter.address_line2
diff --git a/spec/models/form/lettings/pages/uprn_known_spec.rb b/spec/models/form/lettings/pages/uprn_known_spec.rb
deleted file mode 100644
index 27b893a5c..000000000
--- a/spec/models/form/lettings/pages/uprn_known_spec.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-require "rails_helper"
-
-RSpec.describe Form::Lettings::Pages::UprnKnown, type: :model do
- subject(:page) { described_class.new(page_id, page_definition, subsection) }
-
- let(:page_id) { nil }
- let(:page_definition) { nil }
- let(:subsection) { instance_double(Form::Subsection) }
-
- it "has correct subsection" do
- expect(page.subsection).to eq(subsection)
- end
-
- it "has correct questions" do
- expect(page.questions.map(&:id)).to eq(%w[uprn_known])
- end
-
- it "has the correct id" do
- expect(page.id).to eq("uprn_known")
- end
-
- it "has the correct header" do
- expect(page.header).to be_nil
- end
-
- it "has the correct description" do
- expect(page.description).to be_nil
- end
-
- it "has correct depends_on" do
- expect(page.depends_on).to be_nil
- end
-
- describe "has correct routed_to?" do
- context "when needstype != 2" do
- let(:log) { create(:lettings_log, needstype: nil) }
-
- it "returns true" do
- expect(page.routed_to?(log)).to eq(true)
- end
- end
-
- context "when needstype == 2" do
- let(:log) { create(:lettings_log, needstype: 2) }
-
- it "returns true" do
- expect(page.routed_to?(log)).to eq(false)
- end
- end
- end
-end
diff --git a/spec/models/form/lettings/pages/uprn_spec.rb b/spec/models/form/lettings/pages/uprn_spec.rb
index 7b480b6b2..d7ddec73f 100644
--- a/spec/models/form/lettings/pages/uprn_spec.rb
+++ b/spec/models/form/lettings/pages/uprn_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe Form::Lettings::Pages::Uprn, type: :model do
end
it "has correct questions" do
- expect(page.questions.map(&:id)).to eq(%w[uprn])
+ expect(page.questions.map(&:id)).to eq(%w[uprn_known uprn])
end
it "has the correct id" do
@@ -36,14 +36,6 @@ RSpec.describe Form::Lettings::Pages::Uprn, type: :model do
end
describe "has correct routed_to?" do
- context "when uprn_known != 1" do
- let(:log) { create(:lettings_log, uprn_known: 0) }
-
- it "returns false" do
- expect(page.routed_to?(log)).to eq(false)
- end
- end
-
context "when uprn_known == 1" do
let(:log) { create(:lettings_log, uprn_known: 1) }
diff --git a/spec/models/form/lettings/questions/uprn_known_spec.rb b/spec/models/form/lettings/questions/uprn_known_spec.rb
index 07eb72f8d..a79185462 100644
--- a/spec/models/form/lettings/questions/uprn_known_spec.rb
+++ b/spec/models/form/lettings/questions/uprn_known_spec.rb
@@ -39,7 +39,7 @@ RSpec.describe Form::Lettings::Questions::UprnKnown, type: :model do
end
it "has correct conditional for" do
- expect(question.conditional_for).to be_nil
+ expect(question.conditional_for).to eq({ "uprn" => [1] })
end
it "has the correct unanswered_error_message" do
@@ -54,6 +54,6 @@ RSpec.describe Form::Lettings::Questions::UprnKnown, type: :model do
end
it "has the correct hidden_in_check_answers" do
- expect(question.hidden_in_check_answers).to be_nil
+ expect(question.hidden_in_check_answers).to eq(true)
end
end
diff --git a/spec/models/form/lettings/questions/uprn_spec.rb b/spec/models/form/lettings/questions/uprn_spec.rb
index 8f6ba047a..5e0be655b 100644
--- a/spec/models/form/lettings/questions/uprn_spec.rb
+++ b/spec/models/form/lettings/questions/uprn_spec.rb
@@ -36,7 +36,7 @@ RSpec.describe Form::Lettings::Questions::Uprn, type: :model do
end
it "has the correct hint" do
- expect(question.hint_text).to eq("The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and sectors UK-wide. For example 10010457355.")
+ expect(question.hint_text).to be_nil
end
it "has the correct unanswered_error_message" do
@@ -61,32 +61,44 @@ RSpec.describe Form::Lettings::Questions::Uprn, type: :model do
county: "Test County",
postcode_full: "AA1 1AA",
la: "E09000003",
+ uprn_known:,
)
end
- it "returns formatted value" do
- expect(question.get_extra_check_answer_value(log)).to eq(
- "\n\n1, Test Street\nTest Town\nTest County\nAA1 1AA\nWestminster",
- )
+ context "when uprn known nil" do
+ let(:uprn_known) { nil }
+
+ it "returns formatted value" do
+ expect(question.get_extra_check_answer_value(log)).to be_nil
+ end
end
- end
- end
- describe "has the correct hidden_in_check_answers" do
- context "when uprn_known == 1" do
- let(:log) { create(:lettings_log, uprn_known: 1) }
+ context "when uprn known" do
+ let(:uprn_known) { 1 }
- it "returns false" do
- expect(question.hidden_in_check_answers?(log)).to eq(false)
+ it "returns formatted value" do
+ expect(question.get_extra_check_answer_value(log)).to eq(
+ "\n\n1, Test Street\nTest Town\nTest County\nAA1 1AA\nWestminster",
+ )
+ end
end
- end
- context "when uprn_known != 1" do
- let(:log) { create(:lettings_log, uprn_known: 0) }
+ context "when uprn not known" do
+ let(:uprn_known) { 0 }
- it "returns false" do
- expect(question.hidden_in_check_answers?(log)).to eq(true)
+ it "returns formatted value" do
+ expect(question.get_extra_check_answer_value(log)).to be_nil
+ end
end
end
end
+
+ it "has the correct inferred_check_answers_value" do
+ expect(question.inferred_check_answers_value).to eq([{
+ "condition" => {
+ "uprn_known" => 0,
+ },
+ "value" => "Not known",
+ }])
+ end
end
diff --git a/spec/models/form/lettings/subsections/property_information_spec.rb b/spec/models/form/lettings/subsections/property_information_spec.rb
index c1fd9f720..0e0bc7397 100644
--- a/spec/models/form/lettings/subsections/property_information_spec.rb
+++ b/spec/models/form/lettings/subsections/property_information_spec.rb
@@ -45,7 +45,6 @@ RSpec.describe Form::Lettings::Subsections::PropertyInformation, type: :model do
it "has correct pages" do
expect(property_information.pages.map(&:id)).to eq(
%w[
- uprn_known
uprn
uprn_confirmation
address
diff --git a/spec/models/form/sales/pages/uprn_known_spec.rb b/spec/models/form/sales/pages/uprn_known_spec.rb
deleted file mode 100644
index 9c18cfa21..000000000
--- a/spec/models/form/sales/pages/uprn_known_spec.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-require "rails_helper"
-
-RSpec.describe Form::Sales::Pages::UprnKnown, type: :model do
- subject(:page) { described_class.new(page_id, page_definition, subsection) }
-
- let(:page_id) { nil }
- let(:page_definition) { nil }
- let(:subsection) { instance_double(Form::Subsection) }
-
- it "has correct subsection" do
- expect(page.subsection).to eq(subsection)
- end
-
- it "has correct questions" do
- expect(page.questions.map(&:id)).to eq(%w[uprn_known])
- end
-
- it "has the correct id" do
- expect(page.id).to eq("uprn_known")
- end
-
- it "has the correct header" do
- expect(page.header).to be_nil
- end
-
- it "has the correct description" do
- expect(page.description).to be_nil
- end
-
- it "has correct depends_on" do
- expect(page.depends_on).to be_nil
- end
-end
diff --git a/spec/models/form/sales/pages/uprn_spec.rb b/spec/models/form/sales/pages/uprn_spec.rb
index 5573caf5a..a0cd5b7bc 100644
--- a/spec/models/form/sales/pages/uprn_spec.rb
+++ b/spec/models/form/sales/pages/uprn_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe Form::Sales::Pages::Uprn, type: :model do
end
it "has correct questions" do
- expect(page.questions.map(&:id)).to eq(%w[uprn])
+ expect(page.questions.map(&:id)).to eq(%w[uprn_known uprn])
end
it "has the correct id" do
diff --git a/spec/models/form/sales/questions/uprn_known_spec.rb b/spec/models/form/sales/questions/uprn_known_spec.rb
index 457471568..4016b6e8d 100644
--- a/spec/models/form/sales/questions/uprn_known_spec.rb
+++ b/spec/models/form/sales/questions/uprn_known_spec.rb
@@ -39,7 +39,7 @@ RSpec.describe Form::Sales::Questions::UprnKnown, type: :model do
end
it "has correct conditional for" do
- expect(question.conditional_for).to be_nil
+ expect(question.conditional_for).to eq({ "uprn" => [1] })
end
it "has the correct unanswered_error_message" do
@@ -54,6 +54,6 @@ RSpec.describe Form::Sales::Questions::UprnKnown, type: :model do
end
it "has the correct hidden_in_check_answers" do
- expect(question.hidden_in_check_answers).to be_nil
+ expect(question.hidden_in_check_answers).to eq(true)
end
end
diff --git a/spec/models/form/sales/questions/uprn_spec.rb b/spec/models/form/sales/questions/uprn_spec.rb
index f8fd75942..46e635868 100644
--- a/spec/models/form/sales/questions/uprn_spec.rb
+++ b/spec/models/form/sales/questions/uprn_spec.rb
@@ -36,7 +36,7 @@ RSpec.describe Form::Sales::Questions::Uprn, type: :model do
end
it "has the correct hint" do
- expect(question.hint_text).to eq("The Unique Property Reference Number (UPRN) is a unique number system created by Ordnance Survey and used by housing providers and sectors UK-wide. For example 10010457355.")
+ expect(question.hint_text).to be_nil
end
it "has the correct unanswered_error_message" do
@@ -61,33 +61,44 @@ RSpec.describe Form::Sales::Questions::Uprn, type: :model do
county: "Test County",
postcode_full: "AA1 1AA",
la: "E09000003",
+ uprn_known:,
)
end
- it "returns formatted value" do
- expect(question.get_extra_check_answer_value(log)).to eq(
- "\n\n1, Test Street\nTest Town\nTest County\nAA1 1AA\nWestminster",
- )
+ context "when uprn known nil" do
+ let(:uprn_known) { nil }
+
+ it "returns formatted value" do
+ expect(question.get_extra_check_answer_value(log)).to be_nil
+ end
end
- end
- end
- describe "has the correct hidden_in_check_answers" do
- context "when uprn_known == 1" do
- let(:log) { create(:sales_log) }
+ context "when uprn known" do
+ let(:uprn_known) { 1 }
- it "returns false" do
- log.uprn_known = 1
- expect(question.hidden_in_check_answers?(log)).to eq(false)
+ it "returns formatted value" do
+ expect(question.get_extra_check_answer_value(log)).to eq(
+ "\n\n1, Test Street\nTest Town\nTest County\nAA1 1AA\nWestminster",
+ )
+ end
end
- end
- context "when uprn_known != 1" do
- let(:log) { create(:sales_log, uprn_known: 0) }
+ context "when uprn not known" do
+ let(:uprn_known) { 0 }
- it "returns false" do
- expect(question.hidden_in_check_answers?(log)).to eq(true)
+ it "returns formatted value" do
+ expect(question.get_extra_check_answer_value(log)).to be_nil
+ end
end
end
end
+
+ it "has the correct inferred_check_answers_value" do
+ expect(question.inferred_check_answers_value).to eq([{
+ "condition" => {
+ "uprn_known" => 0,
+ },
+ "value" => "Not known",
+ }])
+ end
end
diff --git a/spec/models/form/sales/subsections/property_information_spec.rb b/spec/models/form/sales/subsections/property_information_spec.rb
index 7a0c57448..559db5ea6 100644
--- a/spec/models/form/sales/subsections/property_information_spec.rb
+++ b/spec/models/form/sales/subsections/property_information_spec.rb
@@ -41,7 +41,6 @@ RSpec.describe Form::Sales::Subsections::PropertyInformation, type: :model do
it "has correct pages" do
expect(property_information.pages.map(&:id)).to eq(
%w[
- uprn_known
uprn
uprn_confirmation
address
diff --git a/spec/models/lettings_log_spec.rb b/spec/models/lettings_log_spec.rb
index b33d2fe0f..03b1aae32 100644
--- a/spec/models/lettings_log_spec.rb
+++ b/spec/models/lettings_log_spec.rb
@@ -3140,6 +3140,7 @@ RSpec.describe LettingsLog do
.and change(lettings_log, :postcode_full).from(nil).to("POSTCODE")
.and change(lettings_log, :uprn_confirmed).from(1).to(nil)
.and change(lettings_log, :county).from("county").to(nil)
+ .and change(lettings_log, :uprn_known).from(nil).to(1)
end
end
diff --git a/spec/models/sales_log_spec.rb b/spec/models/sales_log_spec.rb
index dae08310e..1fc2cf73e 100644
--- a/spec/models/sales_log_spec.rb
+++ b/spec/models/sales_log_spec.rb
@@ -559,6 +559,7 @@ RSpec.describe SalesLog, type: :model do
.and change(sales_log, :postcode_full).from(nil).to("POSTCODE")
.and change(sales_log, :uprn_confirmed).from(1).to(nil)
.and change(sales_log, :county).from("county").to(nil)
+ .and change(sales_log, :uprn_known).from(nil).to(1)
end
end