Browse Source

CLDC-3351: Clear deposit in situations where it is no longer derived (#2354)

* CLDC-3351: Clear deposit in situations where it is no longer derived
show-and-tell-28-3-24 v0.4.27
Robert Sullivan 9 months ago committed by GitHub
parent
commit
2e7cb56c70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      app/models/derived_variables/sales_log_variables.rb
  2. 2
      app/models/form.rb
  3. 5
      app/models/form/lettings/questions/created_by_id.rb
  4. 5
      app/models/form/lettings/questions/managing_organisation.rb
  5. 5
      app/models/form/lettings/questions/stock_owner.rb
  6. 2
      app/models/form/question.rb
  7. 2
      app/models/form/sales/questions/buyer_previous.rb
  8. 5
      app/models/form/sales/questions/created_by_id.rb
  9. 5
      app/models/form/sales/questions/deposit_amount.rb
  10. 5
      app/models/form/sales/questions/managing_organisation.rb
  11. 5
      app/models/form/sales/questions/owning_organisation_id.rb
  12. 4
      app/models/form/subsection.rb
  13. 4
      app/models/sales_log.rb
  14. 2
      spec/models/form/lettings/questions/address_line1_for_address_matcher_spec.rb
  15. 2
      spec/models/form/lettings/questions/address_line1_spec.rb
  16. 2
      spec/models/form/lettings/questions/address_line2_spec.rb
  17. 2
      spec/models/form/lettings/questions/age1_known_spec.rb
  18. 2
      spec/models/form/lettings/questions/age_known_spec.rb
  19. 2
      spec/models/form/lettings/questions/age_spec.rb
  20. 2
      spec/models/form/lettings/questions/beds_spec.rb
  21. 2
      spec/models/form/lettings/questions/care_home_charges_value_check_spec.rb
  22. 2
      spec/models/form/lettings/questions/county_spec.rb
  23. 2
      spec/models/form/lettings/questions/created_by_id_spec.rb
  24. 2
      spec/models/form/lettings/questions/declaration_spec.rb
  25. 2
      spec/models/form/lettings/questions/details_known_spec.rb
  26. 2
      spec/models/form/lettings/questions/ethnic_white_spec.rb
  27. 2
      spec/models/form/lettings/questions/gender_identity1_spec.rb
  28. 2
      spec/models/form/lettings/questions/hb_spec.rb
  29. 2
      spec/models/form/lettings/questions/homeless_spec.rb
  30. 2
      spec/models/form/lettings/questions/housingneeds_other_spec.rb
  31. 2
      spec/models/form/lettings/questions/irproduct_other_spec.rb
  32. 2
      spec/models/form/lettings/questions/is_carehome_spec.rb
  33. 2
      spec/models/form/lettings/questions/joint_spec.rb
  34. 2
      spec/models/form/lettings/questions/layear_spec.rb
  35. 2
      spec/models/form/lettings/questions/letting_allocation_spec.rb
  36. 2
      spec/models/form/lettings/questions/location_id_spec.rb
  37. 2
      spec/models/form/lettings/questions/managing_organisation_spec.rb
  38. 2
      spec/models/form/lettings/questions/multiple_partners_value_check_spec.rb
  39. 2
      spec/models/form/lettings/questions/nationality_spec.rb
  40. 2
      spec/models/form/lettings/questions/needs_type_spec.rb
  41. 2
      spec/models/form/lettings/questions/no_address_found_spec.rb
  42. 2
      spec/models/form/lettings/questions/offered_spec.rb
  43. 2
      spec/models/form/lettings/questions/partner_under16_value_check_spec.rb
  44. 2
      spec/models/form/lettings/questions/person_gender_identity_spec.rb
  45. 2
      spec/models/form/lettings/questions/person_relationship_spec.rb
  46. 2
      spec/models/form/lettings/questions/person_working_situation_spec.rb
  47. 2
      spec/models/form/lettings/questions/postcode_for_address_matcher_spec.rb
  48. 2
      spec/models/form/lettings/questions/postcode_for_full_address_spec.rb
  49. 2
      spec/models/form/lettings/questions/ppcodenk_spec.rb
  50. 2
      spec/models/form/lettings/questions/previous_la_known_spec.rb
  51. 2
      spec/models/form/lettings/questions/previous_let_type_spec.rb
  52. 2
      spec/models/form/lettings/questions/previous_tenure_renewal_spec.rb
  53. 2
      spec/models/form/lettings/questions/previous_tenure_spec.rb
  54. 2
      spec/models/form/lettings/questions/property_reference_spec.rb
  55. 2
      spec/models/form/lettings/questions/reason_renewal_spec.rb
  56. 2
      spec/models/form/lettings/questions/reason_spec.rb
  57. 2
      spec/models/form/lettings/questions/reasonpref_spec.rb
  58. 2
      spec/models/form/lettings/questions/renewal_spec.rb
  59. 2
      spec/models/form/lettings/questions/rent_type_spec.rb
  60. 2
      spec/models/form/lettings/questions/rsnvac_spec.rb
  61. 2
      spec/models/form/lettings/questions/scheme_id_spec.rb
  62. 2
      spec/models/form/lettings/questions/sheltered_spec.rb
  63. 2
      spec/models/form/lettings/questions/stock_owner_spec.rb
  64. 2
      spec/models/form/lettings/questions/tenancy_length_spec.rb
  65. 2
      spec/models/form/lettings/questions/tenancy_other_spec.rb
  66. 2
      spec/models/form/lettings/questions/tenancy_start_date_spec.rb
  67. 2
      spec/models/form/lettings/questions/tenancy_type_spec.rb
  68. 2
      spec/models/form/lettings/questions/tenant_code_spec.rb
  69. 2
      spec/models/form/lettings/questions/town_or_city_spec.rb
  70. 2
      spec/models/form/lettings/questions/uprn_confirmation_spec.rb
  71. 2
      spec/models/form/lettings/questions/uprn_known_spec.rb
  72. 2
      spec/models/form/lettings/questions/uprn_selection_spec.rb
  73. 2
      spec/models/form/lettings/questions/uprn_spec.rb
  74. 2
      spec/models/form/lettings/questions/voiddate_spec.rb
  75. 2
      spec/models/form/lettings/questions/waityear_spec.rb
  76. 2
      spec/models/form/lettings/questions/wheelchair_spec.rb
  77. 2
      spec/models/form/sales/questions/address_line1_for_address_matcher_spec.rb
  78. 2
      spec/models/form/sales/questions/address_line1_spec.rb
  79. 2
      spec/models/form/sales/questions/address_line2_spec.rb
  80. 2
      spec/models/form/sales/questions/age1_spec.rb
  81. 2
      spec/models/form/sales/questions/age2_spec.rb
  82. 2
      spec/models/form/sales/questions/armed_forces_spec.rb
  83. 2
      spec/models/form/sales/questions/armed_forces_spouse_spec.rb
  84. 2
      spec/models/form/sales/questions/buyer1_age_known_spec.rb
  85. 2
      spec/models/form/sales/questions/buyer1_ethnic_background_arab_spec.rb
  86. 2
      spec/models/form/sales/questions/buyer1_ethnic_background_asian_spec.rb
  87. 2
      spec/models/form/sales/questions/buyer1_ethnic_background_black_spec.rb
  88. 2
      spec/models/form/sales/questions/buyer1_ethnic_background_mixed_spec.rb
  89. 2
      spec/models/form/sales/questions/buyer1_ethnic_background_white_spec.rb
  90. 2
      spec/models/form/sales/questions/buyer1_ethnic_group_spec.rb
  91. 2
      spec/models/form/sales/questions/buyer1_income_known_spec.rb
  92. 2
      spec/models/form/sales/questions/buyer1_income_spec.rb
  93. 2
      spec/models/form/sales/questions/buyer1_income_value_check_spec.rb
  94. 2
      spec/models/form/sales/questions/buyer1_live_in_property_spec.rb
  95. 2
      spec/models/form/sales/questions/buyer1_mortgage_spec.rb
  96. 2
      spec/models/form/sales/questions/buyer1_nationality_spec.rb
  97. 2
      spec/models/form/sales/questions/buyer1_previous_tenure_spec.rb
  98. 2
      spec/models/form/sales/questions/buyer1_working_situation_spec.rb
  99. 2
      spec/models/form/sales/questions/buyer2_age_known_spec.rb
  100. 2
      spec/models/form/sales/questions/buyer2_ethnic_background_arab_spec.rb
  101. Some files were not shown because too many files have changed in this diff Show More

8
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

2
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

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

5
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

5
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?

2
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

2
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

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

5
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

5
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

5
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?

4
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

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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

2
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

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save