diff --git a/spec/models/form/lettings/questions/location_id_spec.rb b/spec/models/form/lettings/questions/location_id_spec.rb index 8406b8119..83ff4d151 100644 --- a/spec/models/form/lettings/questions/location_id_spec.rb +++ b/spec/models/form/lettings/questions/location_id_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form::Lettings::Questions::LocationId, type: :model do end it "is marked as derived" do - expect(question).not_to be_derived + expect(question).not_to be_derived(nil) end context "when there are no locations" do diff --git a/spec/models/form/lettings/questions/needs_type_spec.rb b/spec/models/form/lettings/questions/needs_type_spec.rb index a0a309f70..eafc9bba6 100644 --- a/spec/models/form/lettings/questions/needs_type_spec.rb +++ b/spec/models/form/lettings/questions/needs_type_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Lettings::Questions::NeedsType, type: :model do end it "is not marked as derived" do - expect(question).not_to be_derived + expect(question).not_to be_derived(nil) end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/reason_renewal_spec.rb b/spec/models/form/lettings/questions/reason_renewal_spec.rb index 5575c7e92..1f3da549d 100644 --- a/spec/models/form/lettings/questions/reason_renewal_spec.rb +++ b/spec/models/form/lettings/questions/reason_renewal_spec.rb @@ -48,7 +48,7 @@ RSpec.describe Form::Lettings::Questions::ReasonRenewal, type: :model do end it "is not marked as derived" do - expect(question).not_to be_derived + expect(question).not_to be_derived(nil) end context "with 2023/24 form" do diff --git a/spec/models/form/lettings/questions/reason_spec.rb b/spec/models/form/lettings/questions/reason_spec.rb index 68f3fdd36..b1ee8ddf8 100644 --- a/spec/models/form/lettings/questions/reason_spec.rb +++ b/spec/models/form/lettings/questions/reason_spec.rb @@ -44,7 +44,7 @@ RSpec.describe Form::Lettings::Questions::Reason, type: :model do end it "is not marked as derived" do - expect(question).not_to be_derived + expect(question).not_to be_derived(nil) end context "with 2023/24 form" do diff --git a/spec/models/form/lettings/questions/voiddate_spec.rb b/spec/models/form/lettings/questions/voiddate_spec.rb index 27aeb72f8..75e33abbd 100644 --- a/spec/models/form/lettings/questions/voiddate_spec.rb +++ b/spec/models/form/lettings/questions/voiddate_spec.rb @@ -40,6 +40,6 @@ RSpec.describe Form::Lettings::Questions::Voiddate, type: :model do end it "is not marked as derived" do - expect(question).not_to be_derived + expect(question).not_to be_derived(nil) end end diff --git a/spec/models/sales_log_spec.rb b/spec/models/sales_log_spec.rb index 023349f10..72a494248 100644 --- a/spec/models/sales_log_spec.rb +++ b/spec/models/sales_log_spec.rb @@ -584,13 +584,6 @@ RSpec.describe SalesLog, type: :model do expect(record_from_db["deposit"]).to eq(nil) end - it "does not clear deposit when setting mortgage used to yes from no for outright sales with new deposit value" do - sales_log.update!(value: 123_400, deposit: nil, mortgageused: 2, ownershipsch: 3, type: 10, companybuy: 1, jointpur: 1, jointmore: 1) - sales_log.update!(mortgageused: 1, deposit: 1000) - record_from_db = described_class.find(sales_log.id) - expect(record_from_db["deposit"]).to eq(1000) - end - it "clears deposit when changing from outright sale with no mortgage to shared ownership" do sales_log.update!(value: 123_400, deposit: nil, mortgageused: 2, ownershipsch: 3, type: 10, companybuy: 1, jointpur: 1, jointmore: 1) sales_log.update!(ownershipsch: 1) @@ -606,21 +599,6 @@ RSpec.describe SalesLog, type: :model do expect(record_from_db["deposit"]).to eq(nil) end - it "does not clear deposit when changing from outright sale with no mortgage to shared ownership with new deposit value" do - sales_log.update!(value: 123_400, deposit: nil, mortgageused: 2, ownershipsch: 3, type: 10, companybuy: 1, jointpur: 1, jointmore: 1) - sales_log.update!(ownershipsch: 1, deposit: 1000) - record_from_db = described_class.find(sales_log.id) - expect(record_from_db["deposit"]).to eq(1000) - end - - it "does not clear when changing from outright sale with no mortgage to discounted ownership with new deposit value" do - Timecop.freeze(2024, 5, 2) - sales_log.update!(value: 123_400, deposit: nil, mortgageused: 2, ownershipsch: 3, type: 10, companybuy: 1, jointpur: 1, jointmore: 1) - sales_log.update!(ownershipsch: 2, deposit: 1000) - record_from_db = described_class.find(sales_log.id) - expect(record_from_db["deposit"]).to eq(1000) - end - it "correctly derives and saves pcode1 and pcode1 and pcode2" do sales_log.update!(postcode_full: "W6 0SP") record_from_db = described_class.find(sales_log.id) @@ -636,13 +614,6 @@ RSpec.describe SalesLog, type: :model do expect(record_from_db["mortgage"]).to eq(0.0) end - it "derives a mortgage value of 0 when mortgage is unknown" do - Timecop.freeze(2024, 5, 2) - sales_log.update!(value: 123_400, saledate: Time.zone.local(2024, 5, 2), mortgageused: 3, ownershipsch: 3, type: 10, companybuy: 1, jointpur: 1, jointmore: 1) - record_from_db = described_class.find(sales_log.id) - expect(record_from_db["mortgage"]).to eq(0.0) - end - it "clears mortgage value if mortgage used is changed from no to yes" do # to avoid log failing validations when mortgage value is removed: new_grant_value = sales_log.grant + sales_log.mortgage