Browse Source

CLDC-3676: update other specs

CLDC-3676-remove-all-pre-2025-validations
samyou-softwire 1 week ago
parent
commit
80fae612b2
  1. 4
      spec/models/bulk_upload_spec.rb
  2. 12
      spec/models/lettings_log_spec.rb
  3. 16
      spec/models/sales_log_spec.rb

4
spec/models/bulk_upload_spec.rb

@ -38,7 +38,7 @@ RSpec.describe BulkUpload, type: :model do
let(:log) { build(:sales_log, saledate:, bulk_upload:) } let(:log) { build(:sales_log, saledate:, bulk_upload:) }
it "has the correct number of value checks to be set as confirmed" do it "has the correct number of value checks to be set as confirmed" do
expect(bulk_upload.fields_to_confirm(log)).to match_array %w[value_value_check monthly_charges_value_check percentage_discount_value_check income1_value_check income2_value_check combined_income_value_check retirement_value_check old_persons_shared_ownership_value_check buyer_livein_value_check wheel_value_check mortgage_value_check savings_value_check deposit_value_check staircase_bought_value_check stairowned_value_check hodate_check shared_ownership_deposit_value_check extrabor_value_check grant_value_check discounted_sale_value_check deposit_and_mortgage_value_check multiple_partners_value_check partner_under_16_value_check] expect(bulk_upload.fields_to_confirm(log)).to match_array %w[value_value_check monthly_charges_value_check percentage_discount_value_check income1_value_check income2_value_check combined_income_value_check retirement_value_check old_persons_shared_ownership_value_check buyer_livein_value_check wheel_value_check mortgage_value_check savings_value_check deposit_value_check staircase_bought_value_check stairowned_value_check hodate_check grant_value_check deposit_and_mortgage_value_check multiple_partners_value_check partner_under_16_value_check]
end end
end end
end end
@ -59,7 +59,7 @@ RSpec.describe BulkUpload, type: :model do
let(:log) { build(:sales_log, saledate:, bulk_upload:) } let(:log) { build(:sales_log, saledate:, bulk_upload:) }
it "has the correct number of value checks to be set as confirmed" do it "has the correct number of value checks to be set as confirmed" do
expect(bulk_upload.fields_to_confirm(log)).to match_array %w[value_value_check monthly_charges_value_check percentage_discount_value_check income1_value_check income2_value_check combined_income_value_check retirement_value_check old_persons_shared_ownership_value_check buyer_livein_value_check wheel_value_check mortgage_value_check savings_value_check deposit_value_check staircase_bought_value_check stairowned_value_check hodate_check shared_ownership_deposit_value_check extrabor_value_check grant_value_check discounted_sale_value_check deposit_and_mortgage_value_check multiple_partners_value_check partner_under_16_value_check] expect(bulk_upload.fields_to_confirm(log)).to match_array %w[value_value_check monthly_charges_value_check percentage_discount_value_check income1_value_check income2_value_check combined_income_value_check retirement_value_check old_persons_shared_ownership_value_check buyer_livein_value_check wheel_value_check mortgage_value_check savings_value_check deposit_value_check staircase_bought_value_check stairowned_value_check hodate_check grant_value_check deposit_and_mortgage_value_check multiple_partners_value_check partner_under_16_value_check]
end end
end end
end end

12
spec/models/lettings_log_spec.rb

@ -90,22 +90,10 @@ RSpec.describe LettingsLog do
expect(validator).to receive(:validate_irproduct_other) expect(validator).to receive(:validate_irproduct_other)
end end
it "validates partner count" do
expect(validator).to receive(:validate_partner_count)
end
it "validates person age matches economic status" do it "validates person age matches economic status" do
expect(validator).to receive(:validate_person_age_matches_economic_status) expect(validator).to receive(:validate_person_age_matches_economic_status)
end end
it "validates person age matches relationship" do
expect(validator).to receive(:validate_person_age_matches_relationship)
end
it "validates person age and relationship matches economic status" do
expect(validator).to receive(:validate_person_age_and_relationship_matches_economic_status)
end
it "validates bedroom number" do it "validates bedroom number" do
expect(validator).to receive(:validate_shared_housing_rooms) expect(validator).to receive(:validate_shared_housing_rooms)
end end

16
spec/models/sales_log_spec.rb

@ -45,26 +45,10 @@ RSpec.describe SalesLog, type: :model do
sales_log.update(age1: 25) sales_log.update(age1: 25)
end end
it "validates partner count" do
expect(validator).to receive(:validate_partner_count)
end
it "validates person age matches economic status" do it "validates person age matches economic status" do
expect(validator).to receive(:validate_person_age_matches_economic_status) expect(validator).to receive(:validate_person_age_matches_economic_status)
end end
it "validates person age matches relationship" do
expect(validator).to receive(:validate_person_age_matches_relationship)
end
it "validates person age and relationship matches economic status" do
expect(validator).to receive(:validate_person_age_and_relationship_matches_economic_status)
end
it "validates child is over 12 years younger than lead tenant" do
expect(validator).to receive(:validate_child_12_years_younger)
end
it "calls the form to clear any invalid answers" do it "calls the form to clear any invalid answers" do
expect(sales_log.form).to receive(:reset_not_routed_questions_and_invalid_answers) expect(sales_log.form).to receive(:reset_not_routed_questions_and_invalid_answers)
end end

Loading…
Cancel
Save