aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-10-26 12:26:48 +0200
committerTeddy Wing2017-10-30 17:48:58 +0100
commit48a0641066d1b7c534b45e36c921e4b2a708138a (patch)
tree96035b8318d0ca9cdddab953f66903cb745d94d4
parent718d9ab7f8d5b1cd125ee341bd098c41615a0cbd (diff)
downloadchouette-core-48a0641066d1b7c534b45e36c921e4b2a708138a.tar.bz2
Add ComplianceControlSetCopyWorker
A new worker that launches the work to copy a `ComplianceControlSet` to a `ComplianceCheckSet`. Currently only handles a single control set and referential pair. Probably want to extend this to handle multiple lists of these objects. Also need to add in a call to the Java API to validate the check. Refs #4782
-rw-r--r--app/workers/compliance_control_set_copy_worker.rb7
-rw-r--r--spec/workers/compliance_control_set_copy_worker_spec.rb12
2 files changed, 19 insertions, 0 deletions
diff --git a/app/workers/compliance_control_set_copy_worker.rb b/app/workers/compliance_control_set_copy_worker.rb
new file mode 100644
index 000000000..ec47651ea
--- /dev/null
+++ b/app/workers/compliance_control_set_copy_worker.rb
@@ -0,0 +1,7 @@
+class ComplianceControlSetCopyWorker
+ include Sidekiq::Worker
+
+ def perform(control_set_id, referential_id)
+ ComplianceControlSetCopier.new.copy(control_set_id, referential_id)
+ end
+end
diff --git a/spec/workers/compliance_control_set_copy_worker_spec.rb b/spec/workers/compliance_control_set_copy_worker_spec.rb
new file mode 100644
index 000000000..69161200c
--- /dev/null
+++ b/spec/workers/compliance_control_set_copy_worker_spec.rb
@@ -0,0 +1,12 @@
+RSpec.describe ComplianceControlSetCopyWorker do
+ it "calls ComplianceControlSetCopier" do
+ control_set_id = 55
+ referential_id = 99
+
+ expect_any_instance_of(
+ ComplianceControlSetCopier
+ ).to receive(:copy).with(control_set_id, referential_id)
+
+ ComplianceControlSetCopyWorker.new.perform(control_set_id, referential_id)
+ end
+end