diff --git a/app/models/derived_variables/sales_log_variables.rb b/app/models/derived_variables/sales_log_variables.rb index 05210830b..24ba9ce5c 100644 --- a/app/models/derived_variables/sales_log_variables.rb +++ b/app/models/derived_variables/sales_log_variables.rb @@ -17,7 +17,13 @@ module DerivedVariables::SalesLogVariables self.homonth = hodate.month self.hoyear = hodate.year end - self.deposit = value if outright_sale? && mortgage_not_used? + + if outright_sale? && mortgage_not_used? + self.deposit = value + elsif outright_sale? && mortgageused_changed?(from: 2, to: 1) + # Clear when switching mortgage used from no to yes + self.deposit = nil + end if saledate && form.start_year_after_2024? && discounted_ownership_sale? self.ppostcode_full = postcode_full diff --git a/app/models/form.rb b/app/models/form.rb index baae2d9bb..1d58e2f9f 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -270,7 +270,7 @@ class Form else questions.reject { |q| %w[radio checkbox].include?(q.type) || q.disable_clearing_if_not_routed_or_dynamic_answer_options } end - routed, not_routed = questions_by_type.partition { |q| q.page.routed_to?(log, current_user) || q.derived? } + routed, not_routed = questions_by_type.partition { |q| q.page.routed_to?(log, current_user) || q.derived?(log) } { routed:, not_routed: } end diff --git a/app/models/form/lettings/questions/created_by_id.rb b/app/models/form/lettings/questions/created_by_id.rb index b2516808e..02176fb4d 100644 --- a/app/models/form/lettings/questions/created_by_id.rb +++ b/app/models/form/lettings/questions/created_by_id.rb @@ -6,6 +6,7 @@ class Form::Lettings::Questions::CreatedById < ::Form::Question @id = "created_by_id" @check_answer_label = "Log owner" @header = "Which user are you creating this log for?" + @derived = true @type = "select" end @@ -44,10 +45,6 @@ class Form::Lettings::Questions::CreatedById < ::Form::Question present_user(User.find(value)) end - def derived? - true - end - private def present_user(user) diff --git a/app/models/form/lettings/questions/managing_organisation.rb b/app/models/form/lettings/questions/managing_organisation.rb index c9ab1247a..51eccdaac 100644 --- a/app/models/form/lettings/questions/managing_organisation.rb +++ b/app/models/form/lettings/questions/managing_organisation.rb @@ -4,6 +4,7 @@ class Form::Lettings::Questions::ManagingOrganisation < ::Form::Question @id = "managing_organisation_id" @check_answer_label = "Managing agent" @header = "Which organisation manages this letting?" + @derived = true @type = "select" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] if form.start_date.present? end @@ -62,10 +63,6 @@ class Form::Lettings::Questions::ManagingOrganisation < ::Form::Question answer_options[value] end - def derived? - true - end - def hidden_in_check_answers?(log, user = nil) user.nil? || !@page.routed_to?(log, user) end diff --git a/app/models/form/lettings/questions/stock_owner.rb b/app/models/form/lettings/questions/stock_owner.rb index 758427fc9..682c64247 100644 --- a/app/models/form/lettings/questions/stock_owner.rb +++ b/app/models/form/lettings/questions/stock_owner.rb @@ -4,6 +4,7 @@ class Form::Lettings::Questions::StockOwner < ::Form::Question @id = "owning_organisation_id" @check_answer_label = "Stock owner" @header = "Which organisation owns this property?" + @derived = true @type = "select" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] if form.start_date.present? end @@ -60,10 +61,6 @@ class Form::Lettings::Questions::StockOwner < ::Form::Question answer_options(log, user)[value] end - def derived? - true - end - def hidden_in_check_answers?(_log, user = nil) return false if user.support? diff --git a/app/models/form/question.rb b/app/models/form/question.rb index 0a486b5bd..0c1611e60 100644 --- a/app/models/form/question.rb +++ b/app/models/form/question.rb @@ -99,7 +99,7 @@ class Form::Question page.routed_to?(log, nil) && enabled?(log) end - def derived? + def derived?(_log) !!derived end diff --git a/app/models/form/sales/questions/buyer_previous.rb b/app/models/form/sales/questions/buyer_previous.rb index fe16969d7..b35a67c5e 100644 --- a/app/models/form/sales/questions/buyer_previous.rb +++ b/app/models/form/sales/questions/buyer_previous.rb @@ -22,7 +22,7 @@ class Form::Sales::Questions::BuyerPrevious < ::Form::Question } end - def derived? + def derived?(_log) form.start_year_after_2024? end diff --git a/app/models/form/sales/questions/created_by_id.rb b/app/models/form/sales/questions/created_by_id.rb index 4e0e73e27..725361ee4 100644 --- a/app/models/form/sales/questions/created_by_id.rb +++ b/app/models/form/sales/questions/created_by_id.rb @@ -6,6 +6,7 @@ class Form::Sales::Questions::CreatedById < ::Form::Question @id = "created_by_id" @check_answer_label = "Log owner" @header = "Which user are you creating this log for?" + @derived = true @type = "select" end @@ -47,10 +48,6 @@ class Form::Sales::Questions::CreatedById < ::Form::Question true end - def derived? - true - end - private def present_user(user) diff --git a/app/models/form/sales/questions/deposit_amount.rb b/app/models/form/sales/questions/deposit_amount.rb index 9c18e3688..72faa818c 100644 --- a/app/models/form/sales/questions/deposit_amount.rb +++ b/app/models/form/sales/questions/deposit_amount.rb @@ -10,12 +10,15 @@ class Form::Sales::Questions::DepositAmount < ::Form::Question @step = 1 @width = 5 @prefix = "£" - @derived = true @ownershipsch = ownershipsch @question_number = QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.fetch(form.start_date.year, QUESTION_NUMBER_FROM_YEAR_AND_OWNERSHIP.max_by { |k, _v| k }.last)[ownershipsch] @optional = optional end + def derived?(log) + log.outright_sale? && log.mortgage_not_used? + end + def selected_answer_option_is_derived?(_log) true end diff --git a/app/models/form/sales/questions/managing_organisation.rb b/app/models/form/sales/questions/managing_organisation.rb index a0e8f2c28..f98dd0100 100644 --- a/app/models/form/sales/questions/managing_organisation.rb +++ b/app/models/form/sales/questions/managing_organisation.rb @@ -4,6 +4,7 @@ class Form::Sales::Questions::ManagingOrganisation < ::Form::Question @id = "managing_organisation_id" @check_answer_label = "Reported by" @header = "Which organisation is reporting this sale?" + @derived = true @type = "select" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end @@ -54,10 +55,6 @@ class Form::Sales::Questions::ManagingOrganisation < ::Form::Question answer_options[value] end - def derived? - true - end - def hidden_in_check_answers?(log, user = nil) user.nil? || !@page.routed_to?(log, user) end diff --git a/app/models/form/sales/questions/owning_organisation_id.rb b/app/models/form/sales/questions/owning_organisation_id.rb index 838b770f6..062fbcaaf 100644 --- a/app/models/form/sales/questions/owning_organisation_id.rb +++ b/app/models/form/sales/questions/owning_organisation_id.rb @@ -4,6 +4,7 @@ class Form::Sales::Questions::OwningOrganisationId < ::Form::Question @id = "owning_organisation_id" @check_answer_label = "Owning organisation" @header = "Which organisation owns this log?" + @derived = true @type = "select" @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end @@ -71,10 +72,6 @@ class Form::Sales::Questions::OwningOrganisationId < ::Form::Question answer_options(log, user)[value] end - def derived? - true - end - def hidden_in_check_answers?(_log, user = nil) return false if user.support? diff --git a/app/models/form/subsection.rb b/app/models/form/subsection.rb index bff8b8e73..25a473e98 100644 --- a/app/models/form/subsection.rb +++ b/app/models/form/subsection.rb @@ -29,7 +29,7 @@ class Form::Subsection qs = applicable_questions(log) qs_optional_removed = qs.reject { |q| log.optional_fields.include?(q.id) } - return :not_started if qs.count.positive? && qs.all? { |question| question.unanswered?(log) || question.read_only? || question.derived? } + return :not_started if qs.count.positive? && qs.all? { |question| question.unanswered?(log) || question.read_only? || question.derived?(log) } return :completed if qs_optional_removed.all? { |question| question.completed?(log) } :in_progress @@ -49,7 +49,7 @@ class Form::Subsection def applicable_questions(log) questions.select do |q| - (q.displayed_to_user?(log) && !q.derived?) || q.is_derived_or_has_inferred_check_answers_value?(log) + (q.displayed_to_user?(log) && !q.derived?(log)) || q.is_derived_or_has_inferred_check_answers_value?(log) end end diff --git a/app/models/sales_log.rb b/app/models/sales_log.rb index 5223c249b..d6e6bf40b 100644 --- a/app/models/sales_log.rb +++ b/app/models/sales_log.rb @@ -330,6 +330,10 @@ class SalesLog < Log mortgageused == 2 end + def mortgage_use_unknown? + mortgageused == 3 + end + def process_postcode_changes! self.postcode_full = upcase_and_remove_whitespace(postcode_full) return if postcode_full.blank? diff --git a/spec/models/form/lettings/questions/address_line1_for_address_matcher_spec.rb b/spec/models/form/lettings/questions/address_line1_for_address_matcher_spec.rb index 7c0baa66e..a34856035 100644 --- a/spec/models/form/lettings/questions/address_line1_for_address_matcher_spec.rb +++ b/spec/models/form/lettings/questions/address_line1_for_address_matcher_spec.rb @@ -37,7 +37,7 @@ RSpec.describe Form::Lettings::Questions::AddressLine1ForAddressMatcher, type: : end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/lettings/questions/address_line1_spec.rb b/spec/models/form/lettings/questions/address_line1_spec.rb index 82e6a5274..7416ef97a 100644 --- a/spec/models/form/lettings/questions/address_line1_spec.rb +++ b/spec/models/form/lettings/questions/address_line1_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form::Lettings::Questions::AddressLine1, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/lettings/questions/address_line2_spec.rb b/spec/models/form/lettings/questions/address_line2_spec.rb index 4ac51a231..4948a77bf 100644 --- a/spec/models/form/lettings/questions/address_line2_spec.rb +++ b/spec/models/form/lettings/questions/address_line2_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Lettings::Questions::AddressLine2, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/lettings/questions/age1_known_spec.rb b/spec/models/form/lettings/questions/age1_known_spec.rb index ac5af8aab..5665f27ac 100644 --- a/spec/models/form/lettings/questions/age1_known_spec.rb +++ b/spec/models/form/lettings/questions/age1_known_spec.rb @@ -23,7 +23,7 @@ RSpec.describe Form::Lettings::Questions::Age1Known, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/age_known_spec.rb b/spec/models/form/lettings/questions/age_known_spec.rb index bac940097..8e4c60fe6 100644 --- a/spec/models/form/lettings/questions/age_known_spec.rb +++ b/spec/models/form/lettings/questions/age_known_spec.rb @@ -16,7 +16,7 @@ RSpec.describe Form::Lettings::Questions::AgeKnown, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/age_spec.rb b/spec/models/form/lettings/questions/age_spec.rb index 85659fc8f..3fe34e51b 100644 --- a/spec/models/form/lettings/questions/age_spec.rb +++ b/spec/models/form/lettings/questions/age_spec.rb @@ -21,7 +21,7 @@ RSpec.describe Form::Lettings::Questions::Age, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end context "when child" do diff --git a/spec/models/form/lettings/questions/beds_spec.rb b/spec/models/form/lettings/questions/beds_spec.rb index 6291892b1..2c68cabfe 100644 --- a/spec/models/form/lettings/questions/beds_spec.rb +++ b/spec/models/form/lettings/questions/beds_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form::Lettings::Questions::Beds, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct min" do diff --git a/spec/models/form/lettings/questions/care_home_charges_value_check_spec.rb b/spec/models/form/lettings/questions/care_home_charges_value_check_spec.rb index d31891c5d..5b14949a3 100644 --- a/spec/models/form/lettings/questions/care_home_charges_value_check_spec.rb +++ b/spec/models/form/lettings/questions/care_home_charges_value_check_spec.rb @@ -27,7 +27,7 @@ RSpec.describe Form::Lettings::Questions::CareHomeChargesValueCheck, type: :mode end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/lettings/questions/county_spec.rb b/spec/models/form/lettings/questions/county_spec.rb index 901bd2e9c..c3473e75d 100644 --- a/spec/models/form/lettings/questions/county_spec.rb +++ b/spec/models/form/lettings/questions/county_spec.rb @@ -32,7 +32,7 @@ RSpec.describe Form::Lettings::Questions::County, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/lettings/questions/created_by_id_spec.rb b/spec/models/form/lettings/questions/created_by_id_spec.rb index 98e0e283b..c175997f6 100644 --- a/spec/models/form/lettings/questions/created_by_id_spec.rb +++ b/spec/models/form/lettings/questions/created_by_id_spec.rb @@ -38,7 +38,7 @@ RSpec.describe Form::Lettings::Questions::CreatedById, type: :model do end it "is marked as derived" do - expect(question.derived?).to be true + expect(question.derived?(nil)).to be true end def expected_option_for_users(users) diff --git a/spec/models/form/lettings/questions/declaration_spec.rb b/spec/models/form/lettings/questions/declaration_spec.rb index fae18e5bc..7b90a964e 100644 --- a/spec/models/form/lettings/questions/declaration_spec.rb +++ b/spec/models/form/lettings/questions/declaration_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/lettings/questions/details_known_spec.rb b/spec/models/form/lettings/questions/details_known_spec.rb index 799b307b0..abedc3f11 100644 --- a/spec/models/form/lettings/questions/details_known_spec.rb +++ b/spec/models/form/lettings/questions/details_known_spec.rb @@ -16,7 +16,7 @@ RSpec.describe Form::Lettings::Questions::DetailsKnown, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/lettings/questions/ethnic_white_spec.rb b/spec/models/form/lettings/questions/ethnic_white_spec.rb index b06490b86..cff675d64 100644 --- a/spec/models/form/lettings/questions/ethnic_white_spec.rb +++ b/spec/models/form/lettings/questions/ethnic_white_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form::Lettings::Questions::EthnicWhite, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end context "with 2023/24 form" do diff --git a/spec/models/form/lettings/questions/gender_identity1_spec.rb b/spec/models/form/lettings/questions/gender_identity1_spec.rb index 337936dbc..8072149e0 100644 --- a/spec/models/form/lettings/questions/gender_identity1_spec.rb +++ b/spec/models/form/lettings/questions/gender_identity1_spec.rb @@ -34,7 +34,7 @@ RSpec.describe Form::Lettings::Questions::GenderIdentity1, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/hb_spec.rb b/spec/models/form/lettings/questions/hb_spec.rb index a73f030ad..20e775fcc 100644 --- a/spec/models/form/lettings/questions/hb_spec.rb +++ b/spec/models/form/lettings/questions/hb_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form::Lettings::Questions::Hb, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/homeless_spec.rb b/spec/models/form/lettings/questions/homeless_spec.rb index f2b384360..e9dfbcaef 100644 --- a/spec/models/form/lettings/questions/homeless_spec.rb +++ b/spec/models/form/lettings/questions/homeless_spec.rb @@ -26,7 +26,7 @@ RSpec.describe Form::Lettings::Questions::Homeless, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/housingneeds_other_spec.rb b/spec/models/form/lettings/questions/housingneeds_other_spec.rb index b6649aea4..9e1e628ff 100644 --- a/spec/models/form/lettings/questions/housingneeds_other_spec.rb +++ b/spec/models/form/lettings/questions/housingneeds_other_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form::Lettings::Questions::HousingneedsOther, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end context "with 2023/24 form" do diff --git a/spec/models/form/lettings/questions/irproduct_other_spec.rb b/spec/models/form/lettings/questions/irproduct_other_spec.rb index aeea7ae20..2406e4618 100644 --- a/spec/models/form/lettings/questions/irproduct_other_spec.rb +++ b/spec/models/form/lettings/questions/irproduct_other_spec.rb @@ -28,6 +28,6 @@ RSpec.describe Form::Lettings::Questions::IrproductOther, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end end diff --git a/spec/models/form/lettings/questions/is_carehome_spec.rb b/spec/models/form/lettings/questions/is_carehome_spec.rb index 8a2853aa3..77fb7804b 100644 --- a/spec/models/form/lettings/questions/is_carehome_spec.rb +++ b/spec/models/form/lettings/questions/is_carehome_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form::Lettings::Questions::IsCarehome, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end context "with 2023/24 form" do diff --git a/spec/models/form/lettings/questions/joint_spec.rb b/spec/models/form/lettings/questions/joint_spec.rb index 338110e4d..7c5b26402 100644 --- a/spec/models/form/lettings/questions/joint_spec.rb +++ b/spec/models/form/lettings/questions/joint_spec.rb @@ -49,7 +49,7 @@ RSpec.describe Form::Lettings::Questions::Joint, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end context "with collection year on or after 2024" do diff --git a/spec/models/form/lettings/questions/layear_spec.rb b/spec/models/form/lettings/questions/layear_spec.rb index e42ac704d..7d3ec681c 100644 --- a/spec/models/form/lettings/questions/layear_spec.rb +++ b/spec/models/form/lettings/questions/layear_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form::Lettings::Questions::Layear, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end context "with 2023/24 form" do diff --git a/spec/models/form/lettings/questions/letting_allocation_spec.rb b/spec/models/form/lettings/questions/letting_allocation_spec.rb index 78cd5acca..ccd0f8a53 100644 --- a/spec/models/form/lettings/questions/letting_allocation_spec.rb +++ b/spec/models/form/lettings/questions/letting_allocation_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form::Lettings::Questions::LettingAllocation, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end context "with 2023/24 form" do 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/managing_organisation_spec.rb b/spec/models/form/lettings/questions/managing_organisation_spec.rb index f35f17b4f..86d58d4d3 100644 --- a/spec/models/form/lettings/questions/managing_organisation_spec.rb +++ b/spec/models/form/lettings/questions/managing_organisation_spec.rb @@ -231,7 +231,7 @@ RSpec.describe Form::Lettings::Questions::ManagingOrganisation, type: :model do end it "is marked as derived" do - expect(question.derived?).to be true + expect(question.derived?(nil)).to be true end describe "#hidden_in_check_answers?" do diff --git a/spec/models/form/lettings/questions/multiple_partners_value_check_spec.rb b/spec/models/form/lettings/questions/multiple_partners_value_check_spec.rb index 04cd6aee3..d946468b0 100644 --- a/spec/models/form/lettings/questions/multiple_partners_value_check_spec.rb +++ b/spec/models/form/lettings/questions/multiple_partners_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Lettings::Questions::MultiplePartnersValueCheck, type: :mod end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/lettings/questions/nationality_spec.rb b/spec/models/form/lettings/questions/nationality_spec.rb index f32cf4f0d..600ef2692 100644 --- a/spec/models/form/lettings/questions/nationality_spec.rb +++ b/spec/models/form/lettings/questions/nationality_spec.rb @@ -43,6 +43,6 @@ RSpec.describe Form::Lettings::Questions::Nationality, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end end 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/no_address_found_spec.rb b/spec/models/form/lettings/questions/no_address_found_spec.rb index 259f0bec1..221ab6688 100644 --- a/spec/models/form/lettings/questions/no_address_found_spec.rb +++ b/spec/models/form/lettings/questions/no_address_found_spec.rb @@ -27,7 +27,7 @@ RSpec.describe Form::Lettings::Questions::NoAddressFound, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/lettings/questions/offered_spec.rb b/spec/models/form/lettings/questions/offered_spec.rb index 45a589a32..bda69490e 100644 --- a/spec/models/form/lettings/questions/offered_spec.rb +++ b/spec/models/form/lettings/questions/offered_spec.rb @@ -35,7 +35,7 @@ RSpec.describe Form::Lettings::Questions::Offered, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/lettings/questions/partner_under16_value_check_spec.rb b/spec/models/form/lettings/questions/partner_under16_value_check_spec.rb index 87206a0df..dfff2a22c 100644 --- a/spec/models/form/lettings/questions/partner_under16_value_check_spec.rb +++ b/spec/models/form/lettings/questions/partner_under16_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Lettings::Questions::PartnerUnder16ValueCheck, type: :model end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/lettings/questions/person_gender_identity_spec.rb b/spec/models/form/lettings/questions/person_gender_identity_spec.rb index 49daf60ed..60a0608e5 100644 --- a/spec/models/form/lettings/questions/person_gender_identity_spec.rb +++ b/spec/models/form/lettings/questions/person_gender_identity_spec.rb @@ -23,7 +23,7 @@ RSpec.describe Form::Lettings::Questions::PersonGenderIdentity, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end context "with form year before 2024" do diff --git a/spec/models/form/lettings/questions/person_relationship_spec.rb b/spec/models/form/lettings/questions/person_relationship_spec.rb index 51975e719..65e9746d9 100644 --- a/spec/models/form/lettings/questions/person_relationship_spec.rb +++ b/spec/models/form/lettings/questions/person_relationship_spec.rb @@ -16,7 +16,7 @@ RSpec.describe Form::Lettings::Questions::PersonRelationship, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/person_working_situation_spec.rb b/spec/models/form/lettings/questions/person_working_situation_spec.rb index b4af7eb62..3e564823e 100644 --- a/spec/models/form/lettings/questions/person_working_situation_spec.rb +++ b/spec/models/form/lettings/questions/person_working_situation_spec.rb @@ -16,7 +16,7 @@ RSpec.describe Form::Lettings::Questions::PersonWorkingSituation, type: :model d end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/postcode_for_address_matcher_spec.rb b/spec/models/form/lettings/questions/postcode_for_address_matcher_spec.rb index e213e0fc4..b0b5c37bf 100644 --- a/spec/models/form/lettings/questions/postcode_for_address_matcher_spec.rb +++ b/spec/models/form/lettings/questions/postcode_for_address_matcher_spec.rb @@ -33,7 +33,7 @@ RSpec.describe Form::Lettings::Questions::PostcodeForAddressMatcher, type: :mode end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/lettings/questions/postcode_for_full_address_spec.rb b/spec/models/form/lettings/questions/postcode_for_full_address_spec.rb index 1cb179ce5..0ccc8c26b 100644 --- a/spec/models/form/lettings/questions/postcode_for_full_address_spec.rb +++ b/spec/models/form/lettings/questions/postcode_for_full_address_spec.rb @@ -32,7 +32,7 @@ RSpec.describe Form::Lettings::Questions::PostcodeForFullAddress, type: :model d end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/lettings/questions/ppcodenk_spec.rb b/spec/models/form/lettings/questions/ppcodenk_spec.rb index 79613d962..cc109c75f 100644 --- a/spec/models/form/lettings/questions/ppcodenk_spec.rb +++ b/spec/models/form/lettings/questions/ppcodenk_spec.rb @@ -23,7 +23,7 @@ RSpec.describe Form::Lettings::Questions::Ppcodenk, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/previous_la_known_spec.rb b/spec/models/form/lettings/questions/previous_la_known_spec.rb index 8b8460ce0..fea17d56a 100644 --- a/spec/models/form/lettings/questions/previous_la_known_spec.rb +++ b/spec/models/form/lettings/questions/previous_la_known_spec.rb @@ -23,7 +23,7 @@ RSpec.describe Form::Lettings::Questions::PreviousLaKnown, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/previous_let_type_spec.rb b/spec/models/form/lettings/questions/previous_let_type_spec.rb index 8b28bc93a..bf9cf78f9 100644 --- a/spec/models/form/lettings/questions/previous_let_type_spec.rb +++ b/spec/models/form/lettings/questions/previous_let_type_spec.rb @@ -38,7 +38,7 @@ RSpec.describe Form::Lettings::Questions::PreviousLetType, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer options" do diff --git a/spec/models/form/lettings/questions/previous_tenure_renewal_spec.rb b/spec/models/form/lettings/questions/previous_tenure_renewal_spec.rb index 8f7325334..724b6f143 100644 --- a/spec/models/form/lettings/questions/previous_tenure_renewal_spec.rb +++ b/spec/models/form/lettings/questions/previous_tenure_renewal_spec.rb @@ -26,7 +26,7 @@ RSpec.describe Form::Lettings::Questions::PreviousTenureRenewal, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/lettings/questions/previous_tenure_spec.rb b/spec/models/form/lettings/questions/previous_tenure_spec.rb index 2b46b4499..83c4d12de 100644 --- a/spec/models/form/lettings/questions/previous_tenure_spec.rb +++ b/spec/models/form/lettings/questions/previous_tenure_spec.rb @@ -26,7 +26,7 @@ RSpec.describe Form::Lettings::Questions::PreviousTenure, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/lettings/questions/property_reference_spec.rb b/spec/models/form/lettings/questions/property_reference_spec.rb index b4aa848af..2f0c21b75 100644 --- a/spec/models/form/lettings/questions/property_reference_spec.rb +++ b/spec/models/form/lettings/questions/property_reference_spec.rb @@ -37,7 +37,7 @@ RSpec.describe Form::Lettings::Questions::PropertyReference, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "returns false for answer_selected" do diff --git a/spec/models/form/lettings/questions/reason_renewal_spec.rb b/spec/models/form/lettings/questions/reason_renewal_spec.rb index d4660d7f4..6d507d1f6 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 39724606b..ab7d4202d 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/reasonpref_spec.rb b/spec/models/form/lettings/questions/reasonpref_spec.rb index 1f531921d..ac39d8ba0 100644 --- a/spec/models/form/lettings/questions/reasonpref_spec.rb +++ b/spec/models/form/lettings/questions/reasonpref_spec.rb @@ -23,7 +23,7 @@ RSpec.describe Form::Lettings::Questions::Reasonpref, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/renewal_spec.rb b/spec/models/form/lettings/questions/renewal_spec.rb index 15b6fa84b..1b921070c 100644 --- a/spec/models/form/lettings/questions/renewal_spec.rb +++ b/spec/models/form/lettings/questions/renewal_spec.rb @@ -47,7 +47,7 @@ RSpec.describe Form::Lettings::Questions::Renewal, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end context "with collection year on or after 2024" do diff --git a/spec/models/form/lettings/questions/rent_type_spec.rb b/spec/models/form/lettings/questions/rent_type_spec.rb index 62d8145d1..f23ea45b4 100644 --- a/spec/models/form/lettings/questions/rent_type_spec.rb +++ b/spec/models/form/lettings/questions/rent_type_spec.rb @@ -44,7 +44,7 @@ RSpec.describe Form::Lettings::Questions::RentType, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end context "when 2023" do diff --git a/spec/models/form/lettings/questions/rsnvac_spec.rb b/spec/models/form/lettings/questions/rsnvac_spec.rb index bdc84753d..8f796d548 100644 --- a/spec/models/form/lettings/questions/rsnvac_spec.rb +++ b/spec/models/form/lettings/questions/rsnvac_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form::Lettings::Questions::Rsnvac, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end context "with 2023/24 form" do diff --git a/spec/models/form/lettings/questions/scheme_id_spec.rb b/spec/models/form/lettings/questions/scheme_id_spec.rb index ec9283113..09272670d 100644 --- a/spec/models/form/lettings/questions/scheme_id_spec.rb +++ b/spec/models/form/lettings/questions/scheme_id_spec.rb @@ -61,7 +61,7 @@ RSpec.describe Form::Lettings::Questions::SchemeId, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct inferred_answers" do diff --git a/spec/models/form/lettings/questions/sheltered_spec.rb b/spec/models/form/lettings/questions/sheltered_spec.rb index c37646abb..15668648f 100644 --- a/spec/models/form/lettings/questions/sheltered_spec.rb +++ b/spec/models/form/lettings/questions/sheltered_spec.rb @@ -69,6 +69,6 @@ RSpec.describe Form::Lettings::Questions::Sheltered, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end end diff --git a/spec/models/form/lettings/questions/stock_owner_spec.rb b/spec/models/form/lettings/questions/stock_owner_spec.rb index 376179cf2..af899e4ab 100644 --- a/spec/models/form/lettings/questions/stock_owner_spec.rb +++ b/spec/models/form/lettings/questions/stock_owner_spec.rb @@ -250,7 +250,7 @@ RSpec.describe Form::Lettings::Questions::StockOwner, type: :model do end it "is marked as derived" do - expect(question.derived?).to be true + expect(question.derived?(nil)).to be true end describe "#hidden_in_check_answers?" do diff --git a/spec/models/form/lettings/questions/tenancy_length_spec.rb b/spec/models/form/lettings/questions/tenancy_length_spec.rb index 2de7c99a6..4d1e9ec50 100644 --- a/spec/models/form/lettings/questions/tenancy_length_spec.rb +++ b/spec/models/form/lettings/questions/tenancy_length_spec.rb @@ -39,6 +39,6 @@ RSpec.describe Form::Lettings::Questions::TenancyLength, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end end diff --git a/spec/models/form/lettings/questions/tenancy_other_spec.rb b/spec/models/form/lettings/questions/tenancy_other_spec.rb index 4891f5e31..554948ff3 100644 --- a/spec/models/form/lettings/questions/tenancy_other_spec.rb +++ b/spec/models/form/lettings/questions/tenancy_other_spec.rb @@ -30,6 +30,6 @@ RSpec.describe Form::Lettings::Questions::TenancyOther, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end end diff --git a/spec/models/form/lettings/questions/tenancy_start_date_spec.rb b/spec/models/form/lettings/questions/tenancy_start_date_spec.rb index a6c96d989..35083ad01 100644 --- a/spec/models/form/lettings/questions/tenancy_start_date_spec.rb +++ b/spec/models/form/lettings/questions/tenancy_start_date_spec.rb @@ -28,6 +28,6 @@ RSpec.describe Form::Lettings::Questions::TenancyStartDate, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end end diff --git a/spec/models/form/lettings/questions/tenancy_type_spec.rb b/spec/models/form/lettings/questions/tenancy_type_spec.rb index 6eafc96a7..196ec38bb 100644 --- a/spec/models/form/lettings/questions/tenancy_type_spec.rb +++ b/spec/models/form/lettings/questions/tenancy_type_spec.rb @@ -114,6 +114,6 @@ RSpec.describe Form::Lettings::Questions::TenancyType, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end end diff --git a/spec/models/form/lettings/questions/tenant_code_spec.rb b/spec/models/form/lettings/questions/tenant_code_spec.rb index dc6ed86d5..e5e434427 100644 --- a/spec/models/form/lettings/questions/tenant_code_spec.rb +++ b/spec/models/form/lettings/questions/tenant_code_spec.rb @@ -36,6 +36,6 @@ RSpec.describe Form::Lettings::Questions::TenantCode, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end end diff --git a/spec/models/form/lettings/questions/town_or_city_spec.rb b/spec/models/form/lettings/questions/town_or_city_spec.rb index 61262055f..77867630f 100644 --- a/spec/models/form/lettings/questions/town_or_city_spec.rb +++ b/spec/models/form/lettings/questions/town_or_city_spec.rb @@ -32,7 +32,7 @@ RSpec.describe Form::Lettings::Questions::TownOrCity, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/lettings/questions/uprn_confirmation_spec.rb b/spec/models/form/lettings/questions/uprn_confirmation_spec.rb index 92563b322..ee0235c54 100644 --- a/spec/models/form/lettings/questions/uprn_confirmation_spec.rb +++ b/spec/models/form/lettings/questions/uprn_confirmation_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Lettings::Questions::UprnConfirmation, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/lettings/questions/uprn_known_spec.rb b/spec/models/form/lettings/questions/uprn_known_spec.rb index 94f99fe53..5f646e710 100644 --- a/spec/models/form/lettings/questions/uprn_known_spec.rb +++ b/spec/models/form/lettings/questions/uprn_known_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Lettings::Questions::UprnKnown, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/lettings/questions/uprn_selection_spec.rb b/spec/models/form/lettings/questions/uprn_selection_spec.rb index de009a8c9..7ecd133ce 100644 --- a/spec/models/form/lettings/questions/uprn_selection_spec.rb +++ b/spec/models/form/lettings/questions/uprn_selection_spec.rb @@ -49,7 +49,7 @@ RSpec.describe Form::Lettings::Questions::UprnSelection, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/lettings/questions/uprn_spec.rb b/spec/models/form/lettings/questions/uprn_spec.rb index d02a3ff1f..17c36eb5f 100644 --- a/spec/models/form/lettings/questions/uprn_spec.rb +++ b/spec/models/form/lettings/questions/uprn_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Lettings::Questions::Uprn, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct question_number" 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/form/lettings/questions/waityear_spec.rb b/spec/models/form/lettings/questions/waityear_spec.rb index 7a322f864..5b30cd641 100644 --- a/spec/models/form/lettings/questions/waityear_spec.rb +++ b/spec/models/form/lettings/questions/waityear_spec.rb @@ -23,7 +23,7 @@ RSpec.describe Form::Lettings::Questions::Waityear, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct check_answer_label" do diff --git a/spec/models/form/lettings/questions/wheelchair_spec.rb b/spec/models/form/lettings/questions/wheelchair_spec.rb index a5d240d51..d24320788 100644 --- a/spec/models/form/lettings/questions/wheelchair_spec.rb +++ b/spec/models/form/lettings/questions/wheelchair_spec.rb @@ -43,7 +43,7 @@ RSpec.describe Form::Lettings::Questions::Wheelchair, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end context "with 2024 form" do diff --git a/spec/models/form/sales/questions/address_line1_for_address_matcher_spec.rb b/spec/models/form/sales/questions/address_line1_for_address_matcher_spec.rb index 61bd183f0..213fddaf3 100644 --- a/spec/models/form/sales/questions/address_line1_for_address_matcher_spec.rb +++ b/spec/models/form/sales/questions/address_line1_for_address_matcher_spec.rb @@ -37,7 +37,7 @@ RSpec.describe Form::Sales::Questions::AddressLine1ForAddressMatcher, type: :mod end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/address_line1_spec.rb b/spec/models/form/sales/questions/address_line1_spec.rb index b1eb2e6e4..520587cb3 100644 --- a/spec/models/form/sales/questions/address_line1_spec.rb +++ b/spec/models/form/sales/questions/address_line1_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form::Sales::Questions::AddressLine1, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/address_line2_spec.rb b/spec/models/form/sales/questions/address_line2_spec.rb index 06c93da80..52f7cc0fd 100644 --- a/spec/models/form/sales/questions/address_line2_spec.rb +++ b/spec/models/form/sales/questions/address_line2_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::AddressLine2, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/age1_spec.rb b/spec/models/form/sales/questions/age1_spec.rb index a2aa0ab66..d7529ef27 100644 --- a/spec/models/form/sales/questions/age1_spec.rb +++ b/spec/models/form/sales/questions/age1_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Age1, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/age2_spec.rb b/spec/models/form/sales/questions/age2_spec.rb index c5aa815f7..e1cd82297 100644 --- a/spec/models/form/sales/questions/age2_spec.rb +++ b/spec/models/form/sales/questions/age2_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Age2, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/armed_forces_spec.rb b/spec/models/form/sales/questions/armed_forces_spec.rb index 14278b34f..f775c800c 100644 --- a/spec/models/form/sales/questions/armed_forces_spec.rb +++ b/spec/models/form/sales/questions/armed_forces_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::ArmedForces, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/armed_forces_spouse_spec.rb b/spec/models/form/sales/questions/armed_forces_spouse_spec.rb index f791f4339..92ae3df0c 100644 --- a/spec/models/form/sales/questions/armed_forces_spouse_spec.rb +++ b/spec/models/form/sales/questions/armed_forces_spouse_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::ArmedForcesSpouse, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/buyer1_age_known_spec.rb b/spec/models/form/sales/questions/buyer1_age_known_spec.rb index f1b470435..5c3c0ba56 100644 --- a/spec/models/form/sales/questions/buyer1_age_known_spec.rb +++ b/spec/models/form/sales/questions/buyer1_age_known_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer1AgeKnown, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/buyer1_ethnic_background_arab_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_background_arab_spec.rb index d77431d03..c49cbb91a 100644 --- a/spec/models/form/sales/questions/buyer1_ethnic_background_arab_spec.rb +++ b/spec/models/form/sales/questions/buyer1_ethnic_background_arab_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundArab, type: :model end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/buyer1_ethnic_background_asian_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_background_asian_spec.rb index 1c8dc47cb..4eae7d8ac 100644 --- a/spec/models/form/sales/questions/buyer1_ethnic_background_asian_spec.rb +++ b/spec/models/form/sales/questions/buyer1_ethnic_background_asian_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundAsian, type: :model end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/buyer1_ethnic_background_black_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_background_black_spec.rb index cdb5eeed1..c0cf78aa8 100644 --- a/spec/models/form/sales/questions/buyer1_ethnic_background_black_spec.rb +++ b/spec/models/form/sales/questions/buyer1_ethnic_background_black_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundBlack, type: :model end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/buyer1_ethnic_background_mixed_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_background_mixed_spec.rb index 51a1e705c..4c3f4c0c6 100644 --- a/spec/models/form/sales/questions/buyer1_ethnic_background_mixed_spec.rb +++ b/spec/models/form/sales/questions/buyer1_ethnic_background_mixed_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundMixed, type: :model end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/buyer1_ethnic_background_white_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_background_white_spec.rb index ef0e9e9ff..0feae47b7 100644 --- a/spec/models/form/sales/questions/buyer1_ethnic_background_white_spec.rb +++ b/spec/models/form/sales/questions/buyer1_ethnic_background_white_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicBackgroundWhite, type: :model end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end context "with 2023/24 form" do diff --git a/spec/models/form/sales/questions/buyer1_ethnic_group_spec.rb b/spec/models/form/sales/questions/buyer1_ethnic_group_spec.rb index 65ee22933..02adb5f65 100644 --- a/spec/models/form/sales/questions/buyer1_ethnic_group_spec.rb +++ b/spec/models/form/sales/questions/buyer1_ethnic_group_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer1EthnicGroup, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/buyer1_income_known_spec.rb b/spec/models/form/sales/questions/buyer1_income_known_spec.rb index 418f85683..644bb3e55 100644 --- a/spec/models/form/sales/questions/buyer1_income_known_spec.rb +++ b/spec/models/form/sales/questions/buyer1_income_known_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer1IncomeKnown, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/buyer1_income_spec.rb b/spec/models/form/sales/questions/buyer1_income_spec.rb index 78d184ca4..7bf56762b 100644 --- a/spec/models/form/sales/questions/buyer1_income_spec.rb +++ b/spec/models/form/sales/questions/buyer1_income_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer1Income, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/buyer1_income_value_check_spec.rb b/spec/models/form/sales/questions/buyer1_income_value_check_spec.rb index 6ba8d23fe..31f249114 100644 --- a/spec/models/form/sales/questions/buyer1_income_value_check_spec.rb +++ b/spec/models/form/sales/questions/buyer1_income_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer1IncomeValueCheck, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/buyer1_live_in_property_spec.rb b/spec/models/form/sales/questions/buyer1_live_in_property_spec.rb index 0563a3ea9..077ac196e 100644 --- a/spec/models/form/sales/questions/buyer1_live_in_property_spec.rb +++ b/spec/models/form/sales/questions/buyer1_live_in_property_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer1LiveInProperty, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/buyer1_mortgage_spec.rb b/spec/models/form/sales/questions/buyer1_mortgage_spec.rb index 7fc06c65a..94d78eafa 100644 --- a/spec/models/form/sales/questions/buyer1_mortgage_spec.rb +++ b/spec/models/form/sales/questions/buyer1_mortgage_spec.rb @@ -29,7 +29,7 @@ RSpec.describe Form::Sales::Questions::Buyer1Mortgage, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/buyer1_nationality_spec.rb b/spec/models/form/sales/questions/buyer1_nationality_spec.rb index edbceddd7..b27124fbc 100644 --- a/spec/models/form/sales/questions/buyer1_nationality_spec.rb +++ b/spec/models/form/sales/questions/buyer1_nationality_spec.rb @@ -26,7 +26,7 @@ RSpec.describe Form::Sales::Questions::Buyer1Nationality, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/buyer1_previous_tenure_spec.rb b/spec/models/form/sales/questions/buyer1_previous_tenure_spec.rb index bac8c46fe..6a8197370 100644 --- a/spec/models/form/sales/questions/buyer1_previous_tenure_spec.rb +++ b/spec/models/form/sales/questions/buyer1_previous_tenure_spec.rb @@ -27,7 +27,7 @@ RSpec.describe Form::Sales::Questions::Buyer1PreviousTenure, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/buyer1_working_situation_spec.rb b/spec/models/form/sales/questions/buyer1_working_situation_spec.rb index 45bd0a8af..4e8c4431f 100644 --- a/spec/models/form/sales/questions/buyer1_working_situation_spec.rb +++ b/spec/models/form/sales/questions/buyer1_working_situation_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer1WorkingSituation, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/buyer2_age_known_spec.rb b/spec/models/form/sales/questions/buyer2_age_known_spec.rb index b3127b18e..68a8d01b4 100644 --- a/spec/models/form/sales/questions/buyer2_age_known_spec.rb +++ b/spec/models/form/sales/questions/buyer2_age_known_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer2AgeKnown, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/buyer2_ethnic_background_arab_spec.rb b/spec/models/form/sales/questions/buyer2_ethnic_background_arab_spec.rb index d078d1e7c..ea6c3cc64 100644 --- a/spec/models/form/sales/questions/buyer2_ethnic_background_arab_spec.rb +++ b/spec/models/form/sales/questions/buyer2_ethnic_background_arab_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer2EthnicBackgroundArab, type: :model end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/buyer2_ethnic_background_asian_spec.rb b/spec/models/form/sales/questions/buyer2_ethnic_background_asian_spec.rb index b1bafa881..32715afdd 100644 --- a/spec/models/form/sales/questions/buyer2_ethnic_background_asian_spec.rb +++ b/spec/models/form/sales/questions/buyer2_ethnic_background_asian_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer2EthnicBackgroundAsian, type: :model end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/buyer2_ethnic_background_black_spec.rb b/spec/models/form/sales/questions/buyer2_ethnic_background_black_spec.rb index 97bc3b349..820e7cb7a 100644 --- a/spec/models/form/sales/questions/buyer2_ethnic_background_black_spec.rb +++ b/spec/models/form/sales/questions/buyer2_ethnic_background_black_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer2EthnicBackgroundBlack, type: :model end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/buyer2_ethnic_background_mixed_spec.rb b/spec/models/form/sales/questions/buyer2_ethnic_background_mixed_spec.rb index ad02b97cc..96f621a0c 100644 --- a/spec/models/form/sales/questions/buyer2_ethnic_background_mixed_spec.rb +++ b/spec/models/form/sales/questions/buyer2_ethnic_background_mixed_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer2EthnicBackgroundMixed, type: :model end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/buyer2_ethnic_background_white_spec.rb b/spec/models/form/sales/questions/buyer2_ethnic_background_white_spec.rb index d5e75e690..3ff9c7f3c 100644 --- a/spec/models/form/sales/questions/buyer2_ethnic_background_white_spec.rb +++ b/spec/models/form/sales/questions/buyer2_ethnic_background_white_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form::Sales::Questions::Buyer2EthnicBackgroundWhite, type: :model end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/buyer2_ethnic_group_spec.rb b/spec/models/form/sales/questions/buyer2_ethnic_group_spec.rb index 0369337ef..a94cf56e7 100644 --- a/spec/models/form/sales/questions/buyer2_ethnic_group_spec.rb +++ b/spec/models/form/sales/questions/buyer2_ethnic_group_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer2EthnicGroup, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/buyer2_income_known_spec.rb b/spec/models/form/sales/questions/buyer2_income_known_spec.rb index 37927f453..9c6a8a51a 100644 --- a/spec/models/form/sales/questions/buyer2_income_known_spec.rb +++ b/spec/models/form/sales/questions/buyer2_income_known_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer2IncomeKnown, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/buyer2_income_spec.rb b/spec/models/form/sales/questions/buyer2_income_spec.rb index 0eb92fad9..f13c51a06 100644 --- a/spec/models/form/sales/questions/buyer2_income_spec.rb +++ b/spec/models/form/sales/questions/buyer2_income_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer2Income, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/buyer2_income_value_check_spec.rb b/spec/models/form/sales/questions/buyer2_income_value_check_spec.rb index ce82f2839..8b0fd4328 100644 --- a/spec/models/form/sales/questions/buyer2_income_value_check_spec.rb +++ b/spec/models/form/sales/questions/buyer2_income_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer2IncomeValueCheck, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/buyer2_live_in_property_spec.rb b/spec/models/form/sales/questions/buyer2_live_in_property_spec.rb index 3e27fa114..fb464e6d2 100644 --- a/spec/models/form/sales/questions/buyer2_live_in_property_spec.rb +++ b/spec/models/form/sales/questions/buyer2_live_in_property_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer2LiveInProperty, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/buyer2_living_in_spec.rb b/spec/models/form/sales/questions/buyer2_living_in_spec.rb index 48cb9d570..4de3f0bcf 100644 --- a/spec/models/form/sales/questions/buyer2_living_in_spec.rb +++ b/spec/models/form/sales/questions/buyer2_living_in_spec.rb @@ -26,7 +26,7 @@ RSpec.describe Form::Sales::Questions::Buyer2LivingIn, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/buyer2_mortgage_spec.rb b/spec/models/form/sales/questions/buyer2_mortgage_spec.rb index 174f5500a..6b297423c 100644 --- a/spec/models/form/sales/questions/buyer2_mortgage_spec.rb +++ b/spec/models/form/sales/questions/buyer2_mortgage_spec.rb @@ -29,7 +29,7 @@ RSpec.describe Form::Sales::Questions::Buyer2Mortgage, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/buyer2_nationality_spec.rb b/spec/models/form/sales/questions/buyer2_nationality_spec.rb index f283b8496..66def77bf 100644 --- a/spec/models/form/sales/questions/buyer2_nationality_spec.rb +++ b/spec/models/form/sales/questions/buyer2_nationality_spec.rb @@ -26,7 +26,7 @@ RSpec.describe Form::Sales::Questions::Buyer2Nationality, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/buyer2_relationship_to_buyer1_spec.rb b/spec/models/form/sales/questions/buyer2_relationship_to_buyer1_spec.rb index e4cc4af11..a4f5ad962 100644 --- a/spec/models/form/sales/questions/buyer2_relationship_to_buyer1_spec.rb +++ b/spec/models/form/sales/questions/buyer2_relationship_to_buyer1_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer2RelationshipToBuyer1, type: :model end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/buyer2_working_situation_spec.rb b/spec/models/form/sales/questions/buyer2_working_situation_spec.rb index a89f10194..c0c429b2d 100644 --- a/spec/models/form/sales/questions/buyer2_working_situation_spec.rb +++ b/spec/models/form/sales/questions/buyer2_working_situation_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Buyer2WorkingSituation, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/buyer_company_spec.rb b/spec/models/form/sales/questions/buyer_company_spec.rb index d11d7af84..76db2952f 100644 --- a/spec/models/form/sales/questions/buyer_company_spec.rb +++ b/spec/models/form/sales/questions/buyer_company_spec.rb @@ -24,7 +24,7 @@ RSpec.describe Form::Sales::Questions::BuyerCompany, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/buyer_interview_spec.rb b/spec/models/form/sales/questions/buyer_interview_spec.rb index a6c9ed1df..0cd58eae6 100644 --- a/spec/models/form/sales/questions/buyer_interview_spec.rb +++ b/spec/models/form/sales/questions/buyer_interview_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::BuyerInterview, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/buyer_live_in_value_check_spec.rb b/spec/models/form/sales/questions/buyer_live_in_value_check_spec.rb index 0409f4f2e..9a0ba99c8 100644 --- a/spec/models/form/sales/questions/buyer_live_in_value_check_spec.rb +++ b/spec/models/form/sales/questions/buyer_live_in_value_check_spec.rb @@ -29,7 +29,7 @@ RSpec.describe Form::Sales::Questions::BuyerLiveInValueCheck, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/buyer_live_spec.rb b/spec/models/form/sales/questions/buyer_live_spec.rb index 9fb657770..8b7d9ce1f 100644 --- a/spec/models/form/sales/questions/buyer_live_spec.rb +++ b/spec/models/form/sales/questions/buyer_live_spec.rb @@ -32,7 +32,7 @@ RSpec.describe Form::Sales::Questions::BuyerLive, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/buyer_previous_spec.rb b/spec/models/form/sales/questions/buyer_previous_spec.rb index f330400f0..ef46d2fd0 100644 --- a/spec/models/form/sales/questions/buyer_previous_spec.rb +++ b/spec/models/form/sales/questions/buyer_previous_spec.rb @@ -78,7 +78,7 @@ RSpec.describe Form::Sales::Questions::BuyerPrevious, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end end @@ -88,7 +88,7 @@ RSpec.describe Form::Sales::Questions::BuyerPrevious, type: :model do end it "is marked as derived" do - expect(question.derived?).to be true + expect(question.derived?(nil)).to be true end end end diff --git a/spec/models/form/sales/questions/buyer_still_serving_spec.rb b/spec/models/form/sales/questions/buyer_still_serving_spec.rb index 732228f17..64b6ad79f 100644 --- a/spec/models/form/sales/questions/buyer_still_serving_spec.rb +++ b/spec/models/form/sales/questions/buyer_still_serving_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::BuyerStillServing, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/buyers_organisations_spec.rb b/spec/models/form/sales/questions/buyers_organisations_spec.rb index 0c6cb737a..0c28cff6f 100644 --- a/spec/models/form/sales/questions/buyers_organisations_spec.rb +++ b/spec/models/form/sales/questions/buyers_organisations_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::BuyersOrganisations, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/combined_income_value_check_spec.rb b/spec/models/form/sales/questions/combined_income_value_check_spec.rb index df4d07849..a47b8a4b3 100644 --- a/spec/models/form/sales/questions/combined_income_value_check_spec.rb +++ b/spec/models/form/sales/questions/combined_income_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::CombinedIncomeValueCheck, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/county_spec.rb b/spec/models/form/sales/questions/county_spec.rb index 64bfab772..0961cba38 100644 --- a/spec/models/form/sales/questions/county_spec.rb +++ b/spec/models/form/sales/questions/county_spec.rb @@ -32,7 +32,7 @@ RSpec.describe Form::Sales::Questions::County, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/created_by_id_spec.rb b/spec/models/form/sales/questions/created_by_id_spec.rb index 0f3ca4b73..7645f45f0 100644 --- a/spec/models/form/sales/questions/created_by_id_spec.rb +++ b/spec/models/form/sales/questions/created_by_id_spec.rb @@ -34,7 +34,7 @@ RSpec.describe Form::Sales::Questions::CreatedById, type: :model do end it "is marked as derived" do - expect(question.derived?).to be true + expect(question.derived?(nil)).to be true end def expected_option_for_users(users) diff --git a/spec/models/form/sales/questions/deposit_amount_spec.rb b/spec/models/form/sales/questions/deposit_amount_spec.rb index 578383f6b..b2d83ada3 100644 --- a/spec/models/form/sales/questions/deposit_amount_spec.rb +++ b/spec/models/form/sales/questions/deposit_amount_spec.rb @@ -27,8 +27,39 @@ RSpec.describe Form::Sales::Questions::DepositAmount, type: :model do expect(question.type).to eq("numeric") end - it "is marked as derived" do - expect(question.derived?).to be true + context "when the ownership type is shared" do + let(:log) { create(:sales_log, :completed, ownershipsch: 1, mortgageused: 2) } + + it "is not marked as derived" do + expect(question.derived?(log)).to be false + end + end + + context "when the ownership type is discounted" do + let(:log) { create(:sales_log, :completed, ownershipsch: 2, mortgageused: 2) } + + it "is not marked as derived" do + expect(question.derived?(log)).to be false + end + end + + context "when the ownership type is outright" do + let(:log) { create(:sales_log, :completed, ownershipsch: 3, mortgageused: 2) } + + it "is not marked as derived when a mortgage is used" do + log.mortgageused = 1 + expect(question.derived?(log)).to be false + end + + it "is marked as derived when a mortgage is not used" do + log.mortgageused = 2 + expect(question.derived?(log)).to be true + end + + it "is not marked as derived when the mortgage use is unknown" do + log.mortgageused = 3 + expect(question.derived?(log)).to be false + end end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/deposit_discount_spec.rb b/spec/models/form/sales/questions/deposit_discount_spec.rb index 552f31636..add79d0ed 100644 --- a/spec/models/form/sales/questions/deposit_discount_spec.rb +++ b/spec/models/form/sales/questions/deposit_discount_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::DepositDiscount, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/deposit_value_check_spec.rb b/spec/models/form/sales/questions/deposit_value_check_spec.rb index 70baafbef..765782f57 100644 --- a/spec/models/form/sales/questions/deposit_value_check_spec.rb +++ b/spec/models/form/sales/questions/deposit_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::DepositValueCheck, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/discount_spec.rb b/spec/models/form/sales/questions/discount_spec.rb index 59d1f5d62..0df9175ff 100644 --- a/spec/models/form/sales/questions/discount_spec.rb +++ b/spec/models/form/sales/questions/discount_spec.rb @@ -34,7 +34,7 @@ RSpec.describe Form::Sales::Questions::Discount, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/discounted_ownership_type_spec.rb b/spec/models/form/sales/questions/discounted_ownership_type_spec.rb index 89fe9378a..442d015a6 100644 --- a/spec/models/form/sales/questions/discounted_ownership_type_spec.rb +++ b/spec/models/form/sales/questions/discounted_ownership_type_spec.rb @@ -30,7 +30,7 @@ RSpec.describe Form::Sales::Questions::DiscountedOwnershipType, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/discounted_sale_value_check_spec.rb b/spec/models/form/sales/questions/discounted_sale_value_check_spec.rb index 8e9e4e7a7..bb247af4a 100644 --- a/spec/models/form/sales/questions/discounted_sale_value_check_spec.rb +++ b/spec/models/form/sales/questions/discounted_sale_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::DiscountedSaleValueCheck, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/equity_spec.rb b/spec/models/form/sales/questions/equity_spec.rb index b54366114..ad80eef50 100644 --- a/spec/models/form/sales/questions/equity_spec.rb +++ b/spec/models/form/sales/questions/equity_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Equity, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/exchange_date_spec.rb b/spec/models/form/sales/questions/exchange_date_spec.rb index a1d2a56b9..777e5596c 100644 --- a/spec/models/form/sales/questions/exchange_date_spec.rb +++ b/spec/models/form/sales/questions/exchange_date_spec.rb @@ -28,6 +28,6 @@ RSpec.describe Form::Sales::Questions::ExchangeDate, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end end diff --git a/spec/models/form/sales/questions/extra_borrowing_spec.rb b/spec/models/form/sales/questions/extra_borrowing_spec.rb index 77b36038a..59c962c63 100644 --- a/spec/models/form/sales/questions/extra_borrowing_spec.rb +++ b/spec/models/form/sales/questions/extra_borrowing_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::ExtraBorrowing, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/fromprop_spec.rb b/spec/models/form/sales/questions/fromprop_spec.rb index 184e9e90a..5660cbd91 100644 --- a/spec/models/form/sales/questions/fromprop_spec.rb +++ b/spec/models/form/sales/questions/fromprop_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Fromprop, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/gender_identity1_spec.rb b/spec/models/form/sales/questions/gender_identity1_spec.rb index a3049fcc2..89989a20f 100644 --- a/spec/models/form/sales/questions/gender_identity1_spec.rb +++ b/spec/models/form/sales/questions/gender_identity1_spec.rb @@ -35,7 +35,7 @@ RSpec.describe Form::Sales::Questions::GenderIdentity1, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/gender_identity2_spec.rb b/spec/models/form/sales/questions/gender_identity2_spec.rb index 334ce23f1..92ebb4758 100644 --- a/spec/models/form/sales/questions/gender_identity2_spec.rb +++ b/spec/models/form/sales/questions/gender_identity2_spec.rb @@ -35,7 +35,7 @@ RSpec.describe Form::Sales::Questions::GenderIdentity2, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/grant_spec.rb b/spec/models/form/sales/questions/grant_spec.rb index 656658881..124ade07e 100644 --- a/spec/models/form/sales/questions/grant_spec.rb +++ b/spec/models/form/sales/questions/grant_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Grant, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/handover_date_check_spec.rb b/spec/models/form/sales/questions/handover_date_check_spec.rb index 86a46436b..d59764567 100644 --- a/spec/models/form/sales/questions/handover_date_check_spec.rb +++ b/spec/models/form/sales/questions/handover_date_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::HandoverDateCheck, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/handover_date_spec.rb b/spec/models/form/sales/questions/handover_date_spec.rb index 4630f0772..94119ea32 100644 --- a/spec/models/form/sales/questions/handover_date_spec.rb +++ b/spec/models/form/sales/questions/handover_date_spec.rb @@ -28,6 +28,6 @@ RSpec.describe Form::Sales::Questions::HandoverDate, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end end diff --git a/spec/models/form/sales/questions/has_leasehold_charges_spec.rb b/spec/models/form/sales/questions/has_leasehold_charges_spec.rb index 895a5d3fe..2d1034d57 100644 --- a/spec/models/form/sales/questions/has_leasehold_charges_spec.rb +++ b/spec/models/form/sales/questions/has_leasehold_charges_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::HasLeaseholdCharges, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/household_disability_spec.rb b/spec/models/form/sales/questions/household_disability_spec.rb index db9e8e592..75a100595 100644 --- a/spec/models/form/sales/questions/household_disability_spec.rb +++ b/spec/models/form/sales/questions/household_disability_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::HouseholdDisability, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/household_wheelchair_check_spec.rb b/spec/models/form/sales/questions/household_wheelchair_check_spec.rb index d203ee444..a5e01a5f9 100644 --- a/spec/models/form/sales/questions/household_wheelchair_check_spec.rb +++ b/spec/models/form/sales/questions/household_wheelchair_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::HouseholdWheelchairCheck, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/household_wheelchair_spec.rb b/spec/models/form/sales/questions/household_wheelchair_spec.rb index 16c1cfc9e..0e12f37d0 100644 --- a/spec/models/form/sales/questions/household_wheelchair_spec.rb +++ b/spec/models/form/sales/questions/household_wheelchair_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::HouseholdWheelchair, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/housing_benefits_spec.rb b/spec/models/form/sales/questions/housing_benefits_spec.rb index 20266fd49..9a50d053d 100644 --- a/spec/models/form/sales/questions/housing_benefits_spec.rb +++ b/spec/models/form/sales/questions/housing_benefits_spec.rb @@ -39,7 +39,7 @@ RSpec.describe Form::Sales::Questions::HousingBenefits, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/joint_purchase_spec.rb b/spec/models/form/sales/questions/joint_purchase_spec.rb index e5d991c19..164ad0e9b 100644 --- a/spec/models/form/sales/questions/joint_purchase_spec.rb +++ b/spec/models/form/sales/questions/joint_purchase_spec.rb @@ -35,7 +35,7 @@ RSpec.describe Form::Sales::Questions::JointPurchase, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/la_nominations_spec.rb b/spec/models/form/sales/questions/la_nominations_spec.rb index 61cf30ac8..46c2be023 100644 --- a/spec/models/form/sales/questions/la_nominations_spec.rb +++ b/spec/models/form/sales/questions/la_nominations_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::LaNominations, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/leasehold_charges_spec.rb b/spec/models/form/sales/questions/leasehold_charges_spec.rb index 86146cba6..59a0a8658 100644 --- a/spec/models/form/sales/questions/leasehold_charges_spec.rb +++ b/spec/models/form/sales/questions/leasehold_charges_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::LeaseholdCharges, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/living_before_purchase_spec.rb b/spec/models/form/sales/questions/living_before_purchase_spec.rb index 609f75761..8c7a8caae 100644 --- a/spec/models/form/sales/questions/living_before_purchase_spec.rb +++ b/spec/models/form/sales/questions/living_before_purchase_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::LivingBeforePurchase, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/living_before_purchase_years_spec.rb b/spec/models/form/sales/questions/living_before_purchase_years_spec.rb index 9e0c2359a..455441a5d 100644 --- a/spec/models/form/sales/questions/living_before_purchase_years_spec.rb +++ b/spec/models/form/sales/questions/living_before_purchase_years_spec.rb @@ -33,7 +33,7 @@ RSpec.describe Form::Sales::Questions::LivingBeforePurchaseYears, type: :model d end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do @@ -81,7 +81,7 @@ RSpec.describe Form::Sales::Questions::LivingBeforePurchaseYears, type: :model d end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/managing_organisation_spec.rb b/spec/models/form/sales/questions/managing_organisation_spec.rb index 69bdab4af..716b1b917 100644 --- a/spec/models/form/sales/questions/managing_organisation_spec.rb +++ b/spec/models/form/sales/questions/managing_organisation_spec.rb @@ -177,7 +177,7 @@ RSpec.describe Form::Sales::Questions::ManagingOrganisation, type: :model do end it "is marked as derived" do - expect(question.derived?).to be true + expect(question.derived?(nil)).to be true end describe "#hidden_in_check_answers?" do diff --git a/spec/models/form/sales/questions/monthly_charges_value_check_spec.rb b/spec/models/form/sales/questions/monthly_charges_value_check_spec.rb index a62bac569..d1c1b6884 100644 --- a/spec/models/form/sales/questions/monthly_charges_value_check_spec.rb +++ b/spec/models/form/sales/questions/monthly_charges_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::MonthlyChargesValueCheck, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/monthly_rent_spec.rb b/spec/models/form/sales/questions/monthly_rent_spec.rb index 6c349a7fb..3c703a7db 100644 --- a/spec/models/form/sales/questions/monthly_rent_spec.rb +++ b/spec/models/form/sales/questions/monthly_rent_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::MonthlyRent, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/mortgage_amount_spec.rb b/spec/models/form/sales/questions/mortgage_amount_spec.rb index 2732bda50..c2d39dc03 100644 --- a/spec/models/form/sales/questions/mortgage_amount_spec.rb +++ b/spec/models/form/sales/questions/mortgage_amount_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::MortgageAmount, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/mortgage_lender_other_spec.rb b/spec/models/form/sales/questions/mortgage_lender_other_spec.rb index 8150c1088..e103b0ffd 100644 --- a/spec/models/form/sales/questions/mortgage_lender_other_spec.rb +++ b/spec/models/form/sales/questions/mortgage_lender_other_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::MortgageLenderOther, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/mortgage_lender_spec.rb b/spec/models/form/sales/questions/mortgage_lender_spec.rb index baac7c9d1..d5b2225cc 100644 --- a/spec/models/form/sales/questions/mortgage_lender_spec.rb +++ b/spec/models/form/sales/questions/mortgage_lender_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form::Sales::Questions::MortgageLender, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "is has correct guidance position" do diff --git a/spec/models/form/sales/questions/mortgage_length_spec.rb b/spec/models/form/sales/questions/mortgage_length_spec.rb index 989cb2c0b..3e6e9b6cf 100644 --- a/spec/models/form/sales/questions/mortgage_length_spec.rb +++ b/spec/models/form/sales/questions/mortgage_length_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::MortgageLength, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/mortgage_value_check_spec.rb b/spec/models/form/sales/questions/mortgage_value_check_spec.rb index 7abc07e1f..ec51da724 100644 --- a/spec/models/form/sales/questions/mortgage_value_check_spec.rb +++ b/spec/models/form/sales/questions/mortgage_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::MortgageValueCheck, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/mortgageused_spec.rb b/spec/models/form/sales/questions/mortgageused_spec.rb index 4c1dbd8dc..5c98360af 100644 --- a/spec/models/form/sales/questions/mortgageused_spec.rb +++ b/spec/models/form/sales/questions/mortgageused_spec.rb @@ -29,7 +29,7 @@ RSpec.describe Form::Sales::Questions::Mortgageused, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/multiple_partners_value_check_spec.rb b/spec/models/form/sales/questions/multiple_partners_value_check_spec.rb index 7afda39bb..eb89dd910 100644 --- a/spec/models/form/sales/questions/multiple_partners_value_check_spec.rb +++ b/spec/models/form/sales/questions/multiple_partners_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::MultiplePartnersValueCheck, type: :model end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/no_address_found_spec.rb b/spec/models/form/sales/questions/no_address_found_spec.rb index 97881b2d7..6d6c2cea5 100644 --- a/spec/models/form/sales/questions/no_address_found_spec.rb +++ b/spec/models/form/sales/questions/no_address_found_spec.rb @@ -27,7 +27,7 @@ RSpec.describe Form::Sales::Questions::NoAddressFound, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/number_joint_buyers_spec.rb b/spec/models/form/sales/questions/number_joint_buyers_spec.rb index 0dc77d54b..efece2ecc 100644 --- a/spec/models/form/sales/questions/number_joint_buyers_spec.rb +++ b/spec/models/form/sales/questions/number_joint_buyers_spec.rb @@ -34,7 +34,7 @@ RSpec.describe Form::Sales::Questions::NumberJointBuyers, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/number_of_others_in_property_spec.rb b/spec/models/form/sales/questions/number_of_others_in_property_spec.rb index 66abad48c..188ad750a 100644 --- a/spec/models/form/sales/questions/number_of_others_in_property_spec.rb +++ b/spec/models/form/sales/questions/number_of_others_in_property_spec.rb @@ -29,7 +29,7 @@ RSpec.describe Form::Sales::Questions::NumberOfOthersInProperty, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/old_persons_shared_ownership_value_check_spec.rb b/spec/models/form/sales/questions/old_persons_shared_ownership_value_check_spec.rb index 5ac066e31..794745c77 100644 --- a/spec/models/form/sales/questions/old_persons_shared_ownership_value_check_spec.rb +++ b/spec/models/form/sales/questions/old_persons_shared_ownership_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::OldPersonsSharedOwnershipValueCheck, type end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/other_ownership_type_spec.rb b/spec/models/form/sales/questions/other_ownership_type_spec.rb index e3986fcab..0507bf749 100644 --- a/spec/models/form/sales/questions/other_ownership_type_spec.rb +++ b/spec/models/form/sales/questions/other_ownership_type_spec.rb @@ -28,6 +28,6 @@ RSpec.describe Form::Sales::Questions::OtherOwnershipType, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end end diff --git a/spec/models/form/sales/questions/outright_ownership_type_spec.rb b/spec/models/form/sales/questions/outright_ownership_type_spec.rb index e3bd043b4..11e0b7b10 100644 --- a/spec/models/form/sales/questions/outright_ownership_type_spec.rb +++ b/spec/models/form/sales/questions/outright_ownership_type_spec.rb @@ -26,7 +26,7 @@ RSpec.describe Form::Sales::Questions::OutrightOwnershipType, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/ownership_scheme_spec.rb b/spec/models/form/sales/questions/ownership_scheme_spec.rb index c3b635354..93cc4f0b2 100644 --- a/spec/models/form/sales/questions/ownership_scheme_spec.rb +++ b/spec/models/form/sales/questions/ownership_scheme_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form::Sales::Questions::OwnershipScheme, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/owning_organisation_id_spec.rb b/spec/models/form/sales/questions/owning_organisation_id_spec.rb index 929221a8c..7f14824db 100644 --- a/spec/models/form/sales/questions/owning_organisation_id_spec.rb +++ b/spec/models/form/sales/questions/owning_organisation_id_spec.rb @@ -296,7 +296,7 @@ RSpec.describe Form::Sales::Questions::OwningOrganisationId, type: :model do end it "is marked as derived" do - expect(question.derived?).to be true + expect(question.derived?(nil)).to be true end context "when the current user is support" do diff --git a/spec/models/form/sales/questions/partner_under16_value_check_spec.rb b/spec/models/form/sales/questions/partner_under16_value_check_spec.rb index 5be3aa9c7..638d49044 100644 --- a/spec/models/form/sales/questions/partner_under16_value_check_spec.rb +++ b/spec/models/form/sales/questions/partner_under16_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::PartnerUnder16ValueCheck, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/percentage_discount_value_check_spec.rb b/spec/models/form/sales/questions/percentage_discount_value_check_spec.rb index 72f4f0cbb..3ec9f96ae 100644 --- a/spec/models/form/sales/questions/percentage_discount_value_check_spec.rb +++ b/spec/models/form/sales/questions/percentage_discount_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::PercentageDiscountValueCheck, type: :mode end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/person_age_known_spec.rb b/spec/models/form/sales/questions/person_age_known_spec.rb index 27023b372..66247d075 100644 --- a/spec/models/form/sales/questions/person_age_known_spec.rb +++ b/spec/models/form/sales/questions/person_age_known_spec.rb @@ -17,7 +17,7 @@ RSpec.describe Form::Sales::Questions::PersonAgeKnown, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/person_age_spec.rb b/spec/models/form/sales/questions/person_age_spec.rb index 55a2dc020..ff1ff0b2b 100644 --- a/spec/models/form/sales/questions/person_age_spec.rb +++ b/spec/models/form/sales/questions/person_age_spec.rb @@ -21,7 +21,7 @@ RSpec.describe Form::Sales::Questions::PersonAge, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/person_gender_identity_spec.rb b/spec/models/form/sales/questions/person_gender_identity_spec.rb index b967a7f13..e38c3c456 100644 --- a/spec/models/form/sales/questions/person_gender_identity_spec.rb +++ b/spec/models/form/sales/questions/person_gender_identity_spec.rb @@ -24,7 +24,7 @@ RSpec.describe Form::Sales::Questions::PersonGenderIdentity, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/person_known_spec.rb b/spec/models/form/sales/questions/person_known_spec.rb index d04f61203..584187ec4 100644 --- a/spec/models/form/sales/questions/person_known_spec.rb +++ b/spec/models/form/sales/questions/person_known_spec.rb @@ -17,7 +17,7 @@ RSpec.describe Form::Sales::Questions::PersonKnown, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/person_relationship_to_buyer1_spec.rb b/spec/models/form/sales/questions/person_relationship_to_buyer1_spec.rb index 57914d70d..821eed3f5 100644 --- a/spec/models/form/sales/questions/person_relationship_to_buyer1_spec.rb +++ b/spec/models/form/sales/questions/person_relationship_to_buyer1_spec.rb @@ -17,7 +17,7 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has expected check answers card number" do diff --git a/spec/models/form/sales/questions/person_student_not_child_value_check_spec.rb b/spec/models/form/sales/questions/person_student_not_child_value_check_spec.rb index f36e7ad57..bc61c464f 100644 --- a/spec/models/form/sales/questions/person_student_not_child_value_check_spec.rb +++ b/spec/models/form/sales/questions/person_student_not_child_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::PersonStudentNotChildValueCheck, type: :m end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/person_working_situation_spec.rb b/spec/models/form/sales/questions/person_working_situation_spec.rb index 97f438460..30974fba4 100644 --- a/spec/models/form/sales/questions/person_working_situation_spec.rb +++ b/spec/models/form/sales/questions/person_working_situation_spec.rb @@ -17,7 +17,7 @@ RSpec.describe Form::Sales::Questions::PersonWorkingSituation, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/postcode_for_address_matcher_spec.rb b/spec/models/form/sales/questions/postcode_for_address_matcher_spec.rb index 64a04be1b..e2a2931a9 100644 --- a/spec/models/form/sales/questions/postcode_for_address_matcher_spec.rb +++ b/spec/models/form/sales/questions/postcode_for_address_matcher_spec.rb @@ -33,7 +33,7 @@ RSpec.describe Form::Sales::Questions::PostcodeForAddressMatcher, type: :model d end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/postcode_for_full_address_spec.rb b/spec/models/form/sales/questions/postcode_for_full_address_spec.rb index 3c912c188..cf4c6c7e6 100644 --- a/spec/models/form/sales/questions/postcode_for_full_address_spec.rb +++ b/spec/models/form/sales/questions/postcode_for_full_address_spec.rb @@ -32,7 +32,7 @@ RSpec.describe Form::Sales::Questions::PostcodeForFullAddress, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/postcode_known_spec.rb b/spec/models/form/sales/questions/postcode_known_spec.rb index b6c404c56..2fdbfc670 100644 --- a/spec/models/form/sales/questions/postcode_known_spec.rb +++ b/spec/models/form/sales/questions/postcode_known_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::PostcodeKnown, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/postcode_spec.rb b/spec/models/form/sales/questions/postcode_spec.rb index b46ae6898..b33618d72 100644 --- a/spec/models/form/sales/questions/postcode_spec.rb +++ b/spec/models/form/sales/questions/postcode_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Postcode, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/previous_bedrooms_spec.rb b/spec/models/form/sales/questions/previous_bedrooms_spec.rb index da7f5de5d..2d1085646 100644 --- a/spec/models/form/sales/questions/previous_bedrooms_spec.rb +++ b/spec/models/form/sales/questions/previous_bedrooms_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::PreviousBedrooms, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/previous_la_known_spec.rb b/spec/models/form/sales/questions/previous_la_known_spec.rb index 5b2b6c396..1a97040fb 100644 --- a/spec/models/form/sales/questions/previous_la_known_spec.rb +++ b/spec/models/form/sales/questions/previous_la_known_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::PreviousLaKnown, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/previous_postcode_known_spec.rb b/spec/models/form/sales/questions/previous_postcode_known_spec.rb index 42f5ff67d..bf837acc2 100644 --- a/spec/models/form/sales/questions/previous_postcode_known_spec.rb +++ b/spec/models/form/sales/questions/previous_postcode_known_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::PreviousPostcodeKnown, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/previous_postcode_spec.rb b/spec/models/form/sales/questions/previous_postcode_spec.rb index ed7c4c60b..0ddb50c94 100644 --- a/spec/models/form/sales/questions/previous_postcode_spec.rb +++ b/spec/models/form/sales/questions/previous_postcode_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::PreviousPostcode, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/previous_tenure_buyer2_spec.rb b/spec/models/form/sales/questions/previous_tenure_buyer2_spec.rb index 4e7475fde..1779f1ece 100644 --- a/spec/models/form/sales/questions/previous_tenure_buyer2_spec.rb +++ b/spec/models/form/sales/questions/previous_tenure_buyer2_spec.rb @@ -26,7 +26,7 @@ RSpec.describe Form::Sales::Questions::PreviousTenureBuyer2, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/previous_tenure_spec.rb b/spec/models/form/sales/questions/previous_tenure_spec.rb index b0439d197..78b553e14 100644 --- a/spec/models/form/sales/questions/previous_tenure_spec.rb +++ b/spec/models/form/sales/questions/previous_tenure_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::PreviousTenure, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/prevloc_spec.rb b/spec/models/form/sales/questions/prevloc_spec.rb index 3e9ae3238..4db1e3890 100644 --- a/spec/models/form/sales/questions/prevloc_spec.rb +++ b/spec/models/form/sales/questions/prevloc_spec.rb @@ -30,7 +30,7 @@ RSpec.describe Form::Sales::Questions::Prevloc, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end context "with 2022/23 form" do diff --git a/spec/models/form/sales/questions/prevown_spec.rb b/spec/models/form/sales/questions/prevown_spec.rb index f813d22ec..b086534d7 100644 --- a/spec/models/form/sales/questions/prevown_spec.rb +++ b/spec/models/form/sales/questions/prevown_spec.rb @@ -43,7 +43,7 @@ RSpec.describe Form::Sales::Questions::Prevown, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/prevshared_spec.rb b/spec/models/form/sales/questions/prevshared_spec.rb index 70b971401..9e6184b02 100644 --- a/spec/models/form/sales/questions/prevshared_spec.rb +++ b/spec/models/form/sales/questions/prevshared_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Prevshared, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/privacy_notice_spec.rb b/spec/models/form/sales/questions/privacy_notice_spec.rb index 879ca9a45..263623ea9 100644 --- a/spec/models/form/sales/questions/privacy_notice_spec.rb +++ b/spec/models/form/sales/questions/privacy_notice_spec.rb @@ -36,7 +36,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/property_building_type_spec.rb b/spec/models/form/sales/questions/property_building_type_spec.rb index e2c0f8aa3..39048845c 100644 --- a/spec/models/form/sales/questions/property_building_type_spec.rb +++ b/spec/models/form/sales/questions/property_building_type_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::PropertyBuildingType, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/property_local_authority_spec.rb b/spec/models/form/sales/questions/property_local_authority_spec.rb index 1ebe2b13a..4c3b24064 100644 --- a/spec/models/form/sales/questions/property_local_authority_spec.rb +++ b/spec/models/form/sales/questions/property_local_authority_spec.rb @@ -30,7 +30,7 @@ RSpec.describe Form::Sales::Questions::PropertyLocalAuthority, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end context "with 2022/23 form" do diff --git a/spec/models/form/sales/questions/property_number_of_bedrooms_spec.rb b/spec/models/form/sales/questions/property_number_of_bedrooms_spec.rb index 98a219859..5008b8c50 100644 --- a/spec/models/form/sales/questions/property_number_of_bedrooms_spec.rb +++ b/spec/models/form/sales/questions/property_number_of_bedrooms_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::PropertyNumberOfBedrooms, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/property_unit_type_spec.rb b/spec/models/form/sales/questions/property_unit_type_spec.rb index 524e077a4..69cb30ad1 100644 --- a/spec/models/form/sales/questions/property_unit_type_spec.rb +++ b/spec/models/form/sales/questions/property_unit_type_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::PropertyUnitType, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/property_wheelchair_accessible_spec.rb b/spec/models/form/sales/questions/property_wheelchair_accessible_spec.rb index f6ec156e6..54c27f7bb 100644 --- a/spec/models/form/sales/questions/property_wheelchair_accessible_spec.rb +++ b/spec/models/form/sales/questions/property_wheelchair_accessible_spec.rb @@ -34,7 +34,7 @@ RSpec.describe Form::Sales::Questions::PropertyWheelchairAccessible, type: :mode end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/purchase_price_spec.rb b/spec/models/form/sales/questions/purchase_price_spec.rb index 7dde97940..b89bdb284 100644 --- a/spec/models/form/sales/questions/purchase_price_spec.rb +++ b/spec/models/form/sales/questions/purchase_price_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::PurchasePrice, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/purchaser_code_spec.rb b/spec/models/form/sales/questions/purchaser_code_spec.rb index 96a18f7d9..8c5eeb081 100644 --- a/spec/models/form/sales/questions/purchaser_code_spec.rb +++ b/spec/models/form/sales/questions/purchaser_code_spec.rb @@ -36,6 +36,6 @@ RSpec.describe Form::Sales::Questions::PurchaserCode, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end end diff --git a/spec/models/form/sales/questions/resale_spec.rb b/spec/models/form/sales/questions/resale_spec.rb index 29927f61b..71e4b82e4 100644 --- a/spec/models/form/sales/questions/resale_spec.rb +++ b/spec/models/form/sales/questions/resale_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Resale, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/retirement_value_check_spec.rb b/spec/models/form/sales/questions/retirement_value_check_spec.rb index 318faa5d9..af5239011 100644 --- a/spec/models/form/sales/questions/retirement_value_check_spec.rb +++ b/spec/models/form/sales/questions/retirement_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::RetirementValueCheck, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/sale_date_check_spec.rb b/spec/models/form/sales/questions/sale_date_check_spec.rb index c37b2e870..c3342f04d 100644 --- a/spec/models/form/sales/questions/sale_date_check_spec.rb +++ b/spec/models/form/sales/questions/sale_date_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::SaleDateCheck, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/sale_date_spec.rb b/spec/models/form/sales/questions/sale_date_spec.rb index 3bffee4d8..bbd602aa7 100644 --- a/spec/models/form/sales/questions/sale_date_spec.rb +++ b/spec/models/form/sales/questions/sale_date_spec.rb @@ -28,6 +28,6 @@ RSpec.describe Form::Sales::Questions::SaleDate, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end end diff --git a/spec/models/form/sales/questions/savings_nk_spec.rb b/spec/models/form/sales/questions/savings_nk_spec.rb index 90134413f..0a8d1a140 100644 --- a/spec/models/form/sales/questions/savings_nk_spec.rb +++ b/spec/models/form/sales/questions/savings_nk_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::SavingsNk, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/savings_spec.rb b/spec/models/form/sales/questions/savings_spec.rb index 61d97322c..632e5574f 100644 --- a/spec/models/form/sales/questions/savings_spec.rb +++ b/spec/models/form/sales/questions/savings_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Savings, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/savings_value_check_spec.rb b/spec/models/form/sales/questions/savings_value_check_spec.rb index 3794147de..d38d27f03 100644 --- a/spec/models/form/sales/questions/savings_value_check_spec.rb +++ b/spec/models/form/sales/questions/savings_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::SavingsValueCheck, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/shared_ownership_deposit_value_check_spec.rb b/spec/models/form/sales/questions/shared_ownership_deposit_value_check_spec.rb index c33892f28..e9e86bd42 100644 --- a/spec/models/form/sales/questions/shared_ownership_deposit_value_check_spec.rb +++ b/spec/models/form/sales/questions/shared_ownership_deposit_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::SharedOwnershipDepositValueCheck, type: : end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/shared_ownership_type_spec.rb b/spec/models/form/sales/questions/shared_ownership_type_spec.rb index 1700fb277..4771241e5 100644 --- a/spec/models/form/sales/questions/shared_ownership_type_spec.rb +++ b/spec/models/form/sales/questions/shared_ownership_type_spec.rb @@ -35,7 +35,7 @@ RSpec.describe Form::Sales::Questions::SharedOwnershipType, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint_text" do diff --git a/spec/models/form/sales/questions/staircase_bought_spec.rb b/spec/models/form/sales/questions/staircase_bought_spec.rb index 027619751..e5cf16a6c 100644 --- a/spec/models/form/sales/questions/staircase_bought_spec.rb +++ b/spec/models/form/sales/questions/staircase_bought_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::StaircaseBought, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/staircase_owned_spec.rb b/spec/models/form/sales/questions/staircase_owned_spec.rb index e74bb2ecf..a9b252f05 100644 --- a/spec/models/form/sales/questions/staircase_owned_spec.rb +++ b/spec/models/form/sales/questions/staircase_owned_spec.rb @@ -43,7 +43,7 @@ RSpec.describe Form::Sales::Questions::StaircaseOwned, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/staircase_owned_value_check_spec.rb b/spec/models/form/sales/questions/staircase_owned_value_check_spec.rb index 4538ebc62..0119e725b 100644 --- a/spec/models/form/sales/questions/staircase_owned_value_check_spec.rb +++ b/spec/models/form/sales/questions/staircase_owned_value_check_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::StaircaseOwnedValueCheck, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/staircase_sale_spec.rb b/spec/models/form/sales/questions/staircase_sale_spec.rb index 5e373ca4e..f4457811b 100644 --- a/spec/models/form/sales/questions/staircase_sale_spec.rb +++ b/spec/models/form/sales/questions/staircase_sale_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::StaircaseSale, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/staircase_spec.rb b/spec/models/form/sales/questions/staircase_spec.rb index a9c3b8722..a4b176d8a 100644 --- a/spec/models/form/sales/questions/staircase_spec.rb +++ b/spec/models/form/sales/questions/staircase_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Staircase, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/town_or_city_spec.rb b/spec/models/form/sales/questions/town_or_city_spec.rb index 4905f44d6..dfa3ddffc 100644 --- a/spec/models/form/sales/questions/town_or_city_spec.rb +++ b/spec/models/form/sales/questions/town_or_city_spec.rb @@ -32,7 +32,7 @@ RSpec.describe Form::Sales::Questions::TownOrCity, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/uprn_confirmation_spec.rb b/spec/models/form/sales/questions/uprn_confirmation_spec.rb index d4917ee67..b6e9195e0 100644 --- a/spec/models/form/sales/questions/uprn_confirmation_spec.rb +++ b/spec/models/form/sales/questions/uprn_confirmation_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::UprnConfirmation, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/uprn_known_spec.rb b/spec/models/form/sales/questions/uprn_known_spec.rb index 663971191..9b25defc8 100644 --- a/spec/models/form/sales/questions/uprn_known_spec.rb +++ b/spec/models/form/sales/questions/uprn_known_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::UprnKnown, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct answer_options" do diff --git a/spec/models/form/sales/questions/uprn_selection_spec.rb b/spec/models/form/sales/questions/uprn_selection_spec.rb index 1b9aaba39..621a3955e 100644 --- a/spec/models/form/sales/questions/uprn_selection_spec.rb +++ b/spec/models/form/sales/questions/uprn_selection_spec.rb @@ -49,7 +49,7 @@ RSpec.describe Form::Sales::Questions::UprnSelection, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/form/sales/questions/uprn_spec.rb b/spec/models/form/sales/questions/uprn_spec.rb index 217011661..4f3eeb3c7 100644 --- a/spec/models/form/sales/questions/uprn_spec.rb +++ b/spec/models/form/sales/questions/uprn_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Uprn, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct question_number" do diff --git a/spec/models/form/sales/questions/value_spec.rb b/spec/models/form/sales/questions/value_spec.rb index 3937aa1b8..ad3d2c4c9 100644 --- a/spec/models/form/sales/questions/value_spec.rb +++ b/spec/models/form/sales/questions/value_spec.rb @@ -28,7 +28,7 @@ RSpec.describe Form::Sales::Questions::Value, type: :model do end it "is not marked as derived" do - expect(question.derived?).to be false + expect(question.derived?(nil)).to be false end it "has the correct hint" do diff --git a/spec/models/sales_log_spec.rb b/spec/models/sales_log_spec.rb index 5685ac58c..abab23c2e 100644 --- a/spec/models/sales_log_spec.rb +++ b/spec/models/sales_log_spec.rb @@ -561,6 +561,20 @@ RSpec.describe SalesLog, type: :model do expect(record_from_db["deposit"]).to eq(nil) end + it "does not derive deposit if the mortgage use is unknown" do + Timecop.freeze(2024, 5, 2) + sales_log.update!(value: 123_400, deposit: nil, 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["deposit"]).to eq(nil) + end + + it "clears deposit when setting mortgage used to yes from no for outright sales" 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) + record_from_db = described_class.find(sales_log.id) + expect(record_from_db["deposit"]).to eq(nil) + 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)