Browse Source

Allow adding rent periods to organisations

pull/2490/head
Kat 2 years ago
parent
commit
22ad619cf0
  1. 10
      spec/factories/organisation.rb
  2. 2
      spec/services/bulk_upload/lettings/log_creator_spec.rb
  3. 2
      spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb
  4. 2
      spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

10
spec/factories/organisation.rb

@ -14,6 +14,16 @@ FactoryBot.define do
with_dsa { true }
end
transient do
rent_periods { [] }
end
after(:create) do |organisation, evaluator|
evaluator.rent_periods.each do |rent_period|
organisation.organisation_rent_periods << build(:organisation_rent_period, rent_period:)
end
end
after(:create) do |org, evaluator|
if evaluator.with_dsa
create(

2
spec/services/bulk_upload/lettings/log_creator_spec.rb

@ -3,7 +3,7 @@ require "rails_helper"
RSpec.describe BulkUpload::Lettings::LogCreator do
subject(:service) { described_class.new(bulk_upload:, path: "") }
let(:owning_org) { create(:organisation, old_visible_id: 123) }
let(:owning_org) { create(:organisation, old_visible_id: 123, rent_periods: [2]) }
let(:user) { create(:user, organisation: owning_org) }
let(:bulk_upload) { create(:bulk_upload, :lettings, user:) }

2
spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb

@ -10,7 +10,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
let(:user) { create(:user, organisation: owning_org) }
let(:owning_org) { create(:organisation, :with_old_visible_id) }
let(:managing_org) { create(:organisation, :with_old_visible_id) }
let(:managing_org) { create(:organisation, :with_old_visible_id, rent_periods: [4]) }
let(:scheme) { create(:scheme, :with_old_visible_id, owning_organisation: owning_org) }
let(:location) { create(:location, :with_old_visible_id, scheme:) }

2
spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

@ -10,7 +10,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
let(:user) { create(:user, organisation: owning_org) }
let(:owning_org) { create(:organisation, :with_old_visible_id) }
let(:managing_org) { create(:organisation, :with_old_visible_id) }
let(:managing_org) { create(:organisation, :with_old_visible_id, rent_periods: [4, 1]) }
let(:scheme) { create(:scheme, :with_old_visible_id, owning_organisation: owning_org) }
let(:location) { create(:location, :with_old_visible_id, scheme:) }

Loading…
Cancel
Save