|
|
|
@ -256,6 +256,32 @@ RSpec.describe Exports::LettingsLogExportService do
|
|
|
|
|
|
|
|
|
|
export_service.export_xml_lettings_logs(collection_year: 2022) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "and previous full exports are different for previous years" do |
|
|
|
|
let(:expected_zip_filename) { "core_2021_2022_apr_mar_f0007_inc0004.zip" } |
|
|
|
|
let(:expected_zip_filename2) { "core_2022_2023_apr_mar_f0001_inc0001.zip" } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
LogsExport.new(started_at: Time.zone.yesterday, base_number: 7, increment_number: 3, collection: 2021).save! |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "generates multiple ZIP export files with different base numbers in the filenames" do |
|
|
|
|
expect(storage_service).to receive(:write_file).with(expected_zip_filename, any_args) |
|
|
|
|
expect(storage_service).to receive(:write_file).with(expected_zip_filename2, any_args) |
|
|
|
|
expect(Rails.logger).to receive(:info).with("Building export run for 2021") |
|
|
|
|
expect(Rails.logger).to receive(:info).with("Creating core_2021_2022_apr_mar_f0007_inc0004 - 1 logs") |
|
|
|
|
expect(Rails.logger).to receive(:info).with("Added core_2021_2022_apr_mar_f0007_inc0004_pt001.xml") |
|
|
|
|
expect(Rails.logger).to receive(:info).with("Writing core_2021_2022_apr_mar_f0007_inc0004.zip") |
|
|
|
|
expect(Rails.logger).to receive(:info).with("Building export run for 2022") |
|
|
|
|
expect(Rails.logger).to receive(:info).with("Creating core_2022_2023_apr_mar_f0001_inc0001 - 1 logs") |
|
|
|
|
expect(Rails.logger).to receive(:info).with("Added core_2022_2023_apr_mar_f0001_inc0001_pt001.xml") |
|
|
|
|
expect(Rails.logger).to receive(:info).with("Writing core_2022_2023_apr_mar_f0001_inc0001.zip") |
|
|
|
|
expect(Rails.logger).to receive(:info).with("Building export run for 2023") |
|
|
|
|
expect(Rails.logger).to receive(:info).with("Creating core_2023_2024_apr_mar_f0001_inc0001 - 0 logs") |
|
|
|
|
|
|
|
|
|
export_service.export_xml_lettings_logs |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|