|
|
|
@ -86,14 +86,16 @@ RSpec.describe Exports::OrganisationExportService do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "and the organisation is merged" do |
|
|
|
|
let(:expected_content) { replace_entity_ids(organisation, xml_export_file.read) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
organisation.update!(merge_date: Time.zone.yesterday) |
|
|
|
|
expected_content.sub!("<active>true</active>", "<active>false</active>") |
|
|
|
|
expected_content.sub!("<merge_date/>", "<merge_date>#{organisation.merge_date.iso8601}</merge_date>") |
|
|
|
|
expected_content.sub!("<status>active</status>", "<status>merged</status>") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "generates an XML export file with the expected content within the ZIP file" do |
|
|
|
|
expected_content = replace_entity_ids(organisation, xml_export_file.read) |
|
|
|
|
expected_content.sub!("<active>true</active>", "<active>false</active>") |
|
|
|
|
expected_content.sub!("<merge_date/>", "<merge_date>#{organisation.merge_date.iso8601}</merge_date>") |
|
|
|
|
expect(storage_service).to receive(:write_file).with(expected_zip_filename, any_args) do |_, content| |
|
|
|
|
entry = Zip::File.open_buffer(content).find_entry(expected_data_filename) |
|
|
|
|
expect(entry).not_to be_nil |
|
|
|
|