Browse Source

CLDC-4312: Fix broken purchase price soft validation (#3253)

* CLDC-4297: set derived for sales beds

* CLDC-4312: update tests
pull/3264/head
Nat Dean-Lewis 4 days ago committed by GitHub
parent
commit
05abccd7bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      app/models/form/sales/questions/property_number_of_bedrooms.rb
  2. 18
      spec/models/form/sales/questions/property_number_of_bedrooms_spec.rb

4
app/models/form/sales/questions/property_number_of_bedrooms.rb

@ -11,5 +11,9 @@ class Form::Sales::Questions::PropertyNumberOfBedrooms < ::Form::Question
@question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR)
end
def derived?(log)
log.is_bedsit?
end
QUESTION_NUMBER_FROM_YEAR = { 2023 => 11, 2024 => 18, 2025 => 17, 2026 => 18 }.freeze
end

18
spec/models/form/sales/questions/property_number_of_bedrooms_spec.rb

@ -19,8 +19,22 @@ RSpec.describe Form::Sales::Questions::PropertyNumberOfBedrooms, type: :model do
expect(question.type).to eq("numeric")
end
it "is not marked as derived" do
expect(question.derived?(nil)).to be false
describe "#derived?" do
context "when the log is a bedsit" do
let(:log) { build(:sales_log, proptype: 2) }
it "is marked as derived" do
expect(question.derived?(log)).to be true
end
end
context "when the log is not a bedsit" do
let(:log) { build(:sales_log, proptype: 1) }
it "is not marked as derived" do
expect(question.derived?(log)).to be false
end
end
end
it "has the correct min" do

Loading…
Cancel
Save