diff options
| author | Teddy Wing | 2017-10-30 17:42:40 +0100 |
|---|---|---|
| committer | Teddy Wing | 2017-10-30 17:48:58 +0100 |
| commit | f7d48398f5cb2ad714691bd630619b02c8958ac5 (patch) | |
| tree | 2091fbe3afe406ab0139f909574075a3fcc1c91d | |
| parent | 17dcf8fe67972f6287fdac40a4477ef8b63ae1b9 (diff) | |
| download | chouette-core-f7d48398f5cb2ad714691bd630619b02c8958ac5.tar.bz2 | |
ComplianceControlSetCopyWorker: Pass ComplianceCheckSet ID to Java
Previously I had been passing the `ComplianceControlSet` ID to the Java
API. The API actually expects the ID of the `ComplianceCheckSet`.
In order to get this ID, have the `ComplianceControlSetCopier` return
the `ComplianceCheckSet` that it creates, and use that to pass the the
ID to the Java API.
Refs #4782
| -rw-r--r-- | app/workers/compliance_control_set_copy_worker.rb | 4 | ||||
| -rw-r--r-- | lib/compliance_control_set_copier.rb | 2 | ||||
| -rw-r--r-- | spec/workers/compliance_control_set_copy_worker_spec.rb | 1 |
3 files changed, 5 insertions, 2 deletions
diff --git a/app/workers/compliance_control_set_copy_worker.rb b/app/workers/compliance_control_set_copy_worker.rb index 92ec5b903..d18bb0c88 100644 --- a/app/workers/compliance_control_set_copy_worker.rb +++ b/app/workers/compliance_control_set_copy_worker.rb @@ -2,10 +2,10 @@ class ComplianceControlSetCopyWorker include Sidekiq::Worker def perform(control_set_id, referential_id) - ComplianceControlSetCopier.new.copy(control_set_id, referential_id) + check_set = ComplianceControlSetCopier.new.copy(control_set_id, referential_id) begin - Net::HTTP.get(URI("#{Rails.configuration.iev_url}/boiv_iev/referentials/validator/new?id=#{control_set_id}")) + Net::HTTP.get(URI("#{Rails.configuration.iev_url}/boiv_iev/referentials/validator/new?id=#{check_set.id}")) rescue Exception => e logger.error "IEV server error : #{e.message}" logger.error e.backtrace.inspect diff --git a/lib/compliance_control_set_copier.rb b/lib/compliance_control_set_copier.rb index 20518ee0e..58d40cdbf 100644 --- a/lib/compliance_control_set_copier.rb +++ b/lib/compliance_control_set_copier.rb @@ -11,6 +11,8 @@ class ComplianceControlSetCopier @referential_id = referential_id check_organisation_coherence! copy_set + + cck_set end diff --git a/spec/workers/compliance_control_set_copy_worker_spec.rb b/spec/workers/compliance_control_set_copy_worker_spec.rb index fcd1918c7..72a030292 100644 --- a/spec/workers/compliance_control_set_copy_worker_spec.rb +++ b/spec/workers/compliance_control_set_copy_worker_spec.rb @@ -19,6 +19,7 @@ RSpec.describe ComplianceControlSetCopyWorker do :get, "#{Rails.configuration.iev_url}/boiv_iev/referentials/validator/new?id=#{control_set_id}" ) + allow_any_instance_of(ComplianceControlSetCopier).to receive(:copy).and_return(check_set) ComplianceControlSetCopyWorker.new.perform(control_set_id, referential_id) |
