Browse Source

feat: setup to replicate failures to fix

pull/1689/head
natdeanlewissoftwire 2 years ago
parent
commit
f3d1d615da
  1. 2
      app/models/form.rb
  2. 8
      spec/factories/sales_log.rb
  3. 6
      spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb

2
app/models/form.rb

@ -9,7 +9,7 @@ class Form
@end_date = if start_year && start_year.to_i > 2022
Time.zone.local(start_year + 1, 6, 9)
else
Time.zone.local(start_year + 1, 8, 7)
Time.zone.local(start_year + 1, 6, 7)
end
@setup_sections = type == "sales" ? [Form::Sales::Sections::Setup.new(nil, nil, self)] : [Form::Lettings::Sections::Setup.new(nil, nil, self)]
@form_sections = sections_in_form.map { |sec| sec.new(nil, nil, self) }

8
spec/factories/sales_log.rb

@ -2,14 +2,14 @@ FactoryBot.define do
factory :sales_log do
created_by { FactoryBot.create(:user) }
owning_organisation { created_by.organisation }
created_at { Time.utc(2023, 2, 8, 16, 52, 15) }
updated_at { Time.utc(2023, 2, 8, 16, 52, 15) }
created_at { Time.zone.today }
updated_at { Time.zone.today }
trait :in_progress do
purchid { "PC123" }
ownershipsch { 2 }
type { 8 }
jointpur { 2 }
saledate { Time.utc(2023, 2, 2, 10, 36, 49) }
saledate { Time.zone.today }
end
trait :shared_ownership do
ownershipsch { 1 }
@ -39,7 +39,7 @@ FactoryBot.define do
purchid { rand(999_999_999).to_s }
ownershipsch { 2 }
type { 8 }
saledate { Time.utc(2023, 2, 2, 10, 36, 49) }
saledate { Time.zone.today }
jointpur { 1 }
beds { 2 }
jointmore { 1 }

6
spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb

@ -13,7 +13,7 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do
let(:managing_org) { create(:organisation, :with_old_visible_id) }
let(:scheme) { create(:scheme, :with_old_visible_id, owning_organisation: owning_org) }
let(:location) { create(:location, :with_old_visible_id, scheme:) }
let(:mock_interrupion_ids) {}
let(:mock_interruption_ids) {}
let(:setup_section_params) do
{
@ -148,7 +148,7 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do
end
before do
mock_interrupion_ids
mock_interruption_ids
create(:organisation_relationship, parent_organisation: owning_org, child_organisation: managing_org)
end
@ -993,7 +993,7 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do
context "when soft validation is triggered and the mappings for errors are not defined" do
let(:attributes) { setup_section_params.merge({ field_12: 22, field_35: 5 }) }
# rubocop:disable RSpec/AnyInstance
let(:mock_interrupion_ids) { allow_any_instance_of(Form::Page).to receive(:interruption_screen_question_ids).and_return(%w[fake_question_id]) }
let(:mock_interruption_ids) { allow_any_instance_of(Form::Page).to receive(:interruption_screen_question_ids).and_return(%w[fake_question_id]) }
# rubocop:enable RSpec/AnyInstance
it "does not crash" do

Loading…
Cancel
Save