|
|
|
@ -58,12 +58,16 @@ RSpec.describe Imports::ImportReportService do
|
|
|
|
|
let(:institutions_csv) { CSV.parse("Institution name,Id,Old Completed lettings logs,Old In progress lettings logs,Old Completed sales logs,Old In progress sales logs\norg1,1,2,1,4,3\norg2,2,5,6,5,7", headers: true) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
create(:organisation, old_visible_id: "1", name: "org1") |
|
|
|
|
org1 = create(:organisation, old_visible_id: "1", name: "org1") |
|
|
|
|
create(:organisation, old_visible_id: "2", name: "org2") |
|
|
|
|
create(:lettings_log, :completed, owning_organisation: org1, old_id: "fake_old_id") |
|
|
|
|
create(:lettings_log, :completed, owning_organisation: org1, old_id: nil) |
|
|
|
|
create(:sales_log, :completed, owning_organisation: org1, old_id: "fake_sales_old_id") |
|
|
|
|
create(:sales_log, :completed, owning_organisation: org1, old_id: nil) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "generates a report with imported logs" do |
|
|
|
|
expect(storage_service).to receive(:write_file).with("MigratedLogsReport_report_suffix.csv", "\uFEFFInstitution name,Id,Old Completed lettings logs,Old In progress lettings logs,Old Completed sales logs,Old In progress sales logs,New Completed lettings logs,New In Progress lettings logs,New Completed sales logs,New In Progress sales logs\norg1,1,2,1,4,3,0,0,0,0\norg2,2,5,6,5,7,0,0,0,0\n") |
|
|
|
|
expect(storage_service).to receive(:write_file).with("MigratedLogsReport_report_suffix.csv", "\uFEFFInstitution name,Id,Old Completed lettings logs,Old In progress lettings logs,Old Completed sales logs,Old In progress sales logs,New Completed lettings logs,New In Progress lettings logs,New Completed sales logs,New In Progress sales logs\norg1,1,2,1,4,3,1,0,1,0\norg2,2,5,6,5,7,0,0,0,0\n") |
|
|
|
|
report_service.generate_logs_report("report_suffix.csv") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
@ -89,6 +93,8 @@ RSpec.describe Imports::ImportReportService do
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
create(:organisation_relationship, parent_organisation: organisation, child_organisation: organisation2) |
|
|
|
|
create(:sales_log, owning_organisation: organisation, created_by: unassigned_user, purchid: "purchid_2", old_id: nil) |
|
|
|
|
create(:lettings_log, owning_organisation: organisation, managing_organisation: organisation2, created_by: unassigned_user, tenancycode: "tenancycode_2", old_id: nil) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "writes a report with all unassigned logs" do |
|
|
|
|