|
|
|
@ -9,7 +9,7 @@ RSpec.describe Imports::SalesLogsFieldImportService do |
|
|
|
let(:fixture_directory) { "spec/fixtures/imports/sales_logs" } |
|
|
|
let(:fixture_directory) { "spec/fixtures/imports/sales_logs" } |
|
|
|
let(:sales_log_filename) { "shared_ownership_sales_log" } |
|
|
|
let(:sales_log_filename) { "shared_ownership_sales_log" } |
|
|
|
let(:sales_log_file) { File.open("#{fixture_directory}/#{sales_log_filename}.xml") } |
|
|
|
let(:sales_log_file) { File.open("#{fixture_directory}/#{sales_log_filename}.xml") } |
|
|
|
let(:organisation) { create(:organisation, old_visible_id: "1", id: "101") } |
|
|
|
let(:organisation) { create(:organisation, old_visible_id: "1") } |
|
|
|
let(:old_user_id) { "c3061a2e6ea0b702e6f6210d5c52d2a92612d2aa" } |
|
|
|
let(:old_user_id) { "c3061a2e6ea0b702e6f6210d5c52d2a92612d2aa" } |
|
|
|
|
|
|
|
|
|
|
|
let(:remote_folder) { "sales_logs" } |
|
|
|
let(:remote_folder) { "sales_logs" } |
|
|
|
@ -88,9 +88,9 @@ RSpec.describe Imports::SalesLogsFieldImportService do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "updates the sales_log owning_organisation_id value" do |
|
|
|
it "updates the sales_log owning_organisation_id value" do |
|
|
|
expect(logger).to receive(:info).with(/sales log \d+'s owning_organisation_id value has been set to 101/) |
|
|
|
expect(logger).to receive(:info).with("sales log #{sales_log.id}'s owning_organisation_id value has been set to #{organisation.id}") |
|
|
|
expect { import_service.send(:update_field, field, remote_folder) } |
|
|
|
expect { import_service.send(:update_field, field, remote_folder) } |
|
|
|
.to(change { sales_log.reload.owning_organisation_id }.from(nil).to(101)) |
|
|
|
.to(change { sales_log.reload.owning_organisation_id }.from(nil).to(organisation.id)) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|