Browse Source

Field reimport task for major repairs (#628)

* Add major repairs to field reimport task

* Same when
pull/630/head
baarkerlounger 3 years ago committed by GitHub
parent
commit
9798c854e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      lib/tasks/data_import_field.rake
  2. 14
      spec/lib/tasks/date_import_field_spec.rb

2
lib/tasks/data_import_field.rake

@ -9,7 +9,7 @@ namespace :core do
# We only allow a reduced list of known fields to be updatable # We only allow a reduced list of known fields to be updatable
case field case field
when "tenant_code" when "tenant_code", "major_repairs"
Imports::CaseLogsFieldImportService.new(storage_service).update_field(field, path) Imports::CaseLogsFieldImportService.new(storage_service).update_field(field, path)
else else
raise "Field #{field} cannot be updated by data_import_field" raise "Field #{field} cannot be updated by data_import_field"

14
spec/lib/tasks/date_import_field_spec.rb

@ -42,6 +42,20 @@ describe "rake core:data_import_field", type: :task do
end end
end end
context "and we update the major repairs fields" do
let(:field) { "major_repairs" }
it "properly configures the storage service" do
expect(StorageService).to receive(:new).with(paas_config_service, instance_name)
task.invoke(field, fixture_path)
end
it "calls the expected update method with parameters" do
expect(import_service).to receive(:update_field).with(field, fixture_path)
task.invoke(field, fixture_path)
end
end
it "raises an exception if no parameters are provided" do it "raises an exception if no parameters are provided" do
expect { task.invoke }.to raise_error(/Usage/) expect { task.invoke }.to raise_error(/Usage/)
end end

Loading…
Cancel
Save