|
|
@ -5,7 +5,7 @@ describe "rake core:data_import", type: :task do |
|
|
|
subject(:task) { Rake::Task["core:data_import"] } |
|
|
|
subject(:task) { Rake::Task["core:data_import"] } |
|
|
|
|
|
|
|
|
|
|
|
let(:instance_name) { "paas_import_instance" } |
|
|
|
let(:instance_name) { "paas_import_instance" } |
|
|
|
let(:storage_service) { instance_double(S3StorageService) } |
|
|
|
let(:storage_service) { instance_double(Storage::S3Service) } |
|
|
|
let(:paas_config_service) { instance_double(PaasConfigurationService) } |
|
|
|
let(:paas_config_service) { instance_double(PaasConfigurationService) } |
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
before do |
|
|
@ -13,7 +13,7 @@ describe "rake core:data_import", type: :task do |
|
|
|
Rake::Task.define_task(:environment) |
|
|
|
Rake::Task.define_task(:environment) |
|
|
|
task.reenable |
|
|
|
task.reenable |
|
|
|
|
|
|
|
|
|
|
|
allow(S3StorageService).to receive(:new).and_return(storage_service) |
|
|
|
allow(Storage::S3Service).to receive(:new).and_return(storage_service) |
|
|
|
allow(PaasConfigurationService).to receive(:new).and_return(paas_config_service) |
|
|
|
allow(PaasConfigurationService).to receive(:new).and_return(paas_config_service) |
|
|
|
allow(ENV).to receive(:[]) |
|
|
|
allow(ENV).to receive(:[]) |
|
|
|
allow(ENV).to receive(:[]).with("IMPORT_PAAS_INSTANCE").and_return(instance_name) |
|
|
|
allow(ENV).to receive(:[]).with("IMPORT_PAAS_INSTANCE").and_return(instance_name) |
|
|
@ -29,7 +29,7 @@ describe "rake core:data_import", type: :task do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "creates an organisation from the given XML file" do |
|
|
|
it "creates an organisation from the given XML file" do |
|
|
|
expect(S3StorageService).to receive(:new).with(paas_config_service, instance_name) |
|
|
|
expect(Storage::S3Service).to receive(:new).with(paas_config_service, instance_name) |
|
|
|
expect(Imports::OrganisationImportService).to receive(:new).with(storage_service) |
|
|
|
expect(Imports::OrganisationImportService).to receive(:new).with(storage_service) |
|
|
|
expect(import_service).to receive(:create_organisations).with(fixture_path) |
|
|
|
expect(import_service).to receive(:create_organisations).with(fixture_path) |
|
|
|
|
|
|
|
|
|
|
@ -47,7 +47,7 @@ describe "rake core:data_import", type: :task do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "creates a user from the given XML file" do |
|
|
|
it "creates a user from the given XML file" do |
|
|
|
expect(S3StorageService).to receive(:new).with(paas_config_service, instance_name) |
|
|
|
expect(Storage::S3Service).to receive(:new).with(paas_config_service, instance_name) |
|
|
|
expect(Imports::UserImportService).to receive(:new).with(storage_service) |
|
|
|
expect(Imports::UserImportService).to receive(:new).with(storage_service) |
|
|
|
expect(import_service).to receive(:create_users).with(fixture_path) |
|
|
|
expect(import_service).to receive(:create_users).with(fixture_path) |
|
|
|
|
|
|
|
|
|
|
@ -65,7 +65,7 @@ describe "rake core:data_import", type: :task do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "creates an organisation from the given XML file" do |
|
|
|
it "creates an organisation from the given XML file" do |
|
|
|
expect(S3StorageService).to receive(:new).with(paas_config_service, instance_name) |
|
|
|
expect(Storage::S3Service).to receive(:new).with(paas_config_service, instance_name) |
|
|
|
expect(Imports::DataProtectionConfirmationImportService).to receive(:new).with(storage_service) |
|
|
|
expect(Imports::DataProtectionConfirmationImportService).to receive(:new).with(storage_service) |
|
|
|
expect(import_service).to receive(:create_data_protection_confirmations).with(fixture_path) |
|
|
|
expect(import_service).to receive(:create_data_protection_confirmations).with(fixture_path) |
|
|
|
|
|
|
|
|
|
|
@ -83,7 +83,7 @@ describe "rake core:data_import", type: :task do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "creates an organisation la from the given XML file" do |
|
|
|
it "creates an organisation la from the given XML file" do |
|
|
|
expect(S3StorageService).to receive(:new).with(paas_config_service, instance_name) |
|
|
|
expect(Storage::S3Service).to receive(:new).with(paas_config_service, instance_name) |
|
|
|
expect(Imports::OrganisationRentPeriodImportService).to receive(:new).with(storage_service) |
|
|
|
expect(Imports::OrganisationRentPeriodImportService).to receive(:new).with(storage_service) |
|
|
|
expect(import_service).to receive(:create_organisation_rent_periods).with(fixture_path) |
|
|
|
expect(import_service).to receive(:create_organisation_rent_periods).with(fixture_path) |
|
|
|
|
|
|
|
|
|
|
@ -101,7 +101,7 @@ describe "rake core:data_import", type: :task do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "creates case logs from the given XML file" do |
|
|
|
it "creates case logs from the given XML file" do |
|
|
|
expect(S3StorageService).to receive(:new).with(paas_config_service, instance_name) |
|
|
|
expect(Storage::S3Service).to receive(:new).with(paas_config_service, instance_name) |
|
|
|
expect(Imports::CaseLogsImportService).to receive(:new).with(storage_service) |
|
|
|
expect(Imports::CaseLogsImportService).to receive(:new).with(storage_service) |
|
|
|
expect(import_service).to receive(:create_logs).with(fixture_path) |
|
|
|
expect(import_service).to receive(:create_logs).with(fixture_path) |
|
|
|
|
|
|
|
|
|
|
@ -119,7 +119,7 @@ describe "rake core:data_import", type: :task do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "creates a scheme from the given XML file" do |
|
|
|
it "creates a scheme from the given XML file" do |
|
|
|
expect(S3StorageService).to receive(:new).with(paas_config_service, instance_name) |
|
|
|
expect(Storage::S3Service).to receive(:new).with(paas_config_service, instance_name) |
|
|
|
expect(Imports::SchemeImportService).to receive(:new).with(storage_service) |
|
|
|
expect(Imports::SchemeImportService).to receive(:new).with(storage_service) |
|
|
|
expect(import_service).to receive(:create_schemes).with(fixture_path) |
|
|
|
expect(import_service).to receive(:create_schemes).with(fixture_path) |
|
|
|
|
|
|
|
|
|
|
@ -137,7 +137,7 @@ describe "rake core:data_import", type: :task do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "creates a scheme location from the given XML file" do |
|
|
|
it "creates a scheme location from the given XML file" do |
|
|
|
expect(S3StorageService).to receive(:new).with(paas_config_service, instance_name) |
|
|
|
expect(Storage::S3Service).to receive(:new).with(paas_config_service, instance_name) |
|
|
|
expect(Imports::SchemeLocationImportService).to receive(:new).with(storage_service) |
|
|
|
expect(Imports::SchemeLocationImportService).to receive(:new).with(storage_service) |
|
|
|
expect(import_service).to receive(:create_scheme_locations).with(fixture_path) |
|
|
|
expect(import_service).to receive(:create_scheme_locations).with(fixture_path) |
|
|
|
|
|
|
|
|
|
|
|