aboutsummaryrefslogtreecommitdiffstats
path: root/spec/workers
diff options
context:
space:
mode:
authorTeddy Wing2017-10-30 14:59:04 +0100
committerTeddy Wing2017-10-30 17:48:58 +0100
commit17dcf8fe67972f6287fdac40a4477ef8b63ae1b9 (patch)
tree4815308c04760ccca87bf3e1104af8bf039a674c /spec/workers
parent48a0641066d1b7c534b45e36c921e4b2a708138a (diff)
downloadchouette-core-17dcf8fe67972f6287fdac40a4477ef8b63ae1b9.tar.bz2
ComplianceControlSetCopyWorker: Call Java validation API
Call the Java API URL to launch a validation after having copied the `ComplianceControlSet` into a `ComplianceCheckSet`. Copied the format with error logging from `NetexImport#launch_java_import`. In the test, make the ID variables global by putting them in `let`s. Add `config.iev_url` to the Rails `test` environment so that we can access this from our tests. TODO: I just realised I'm sending the wrong ID. I should be sending the check set ID. Refs #4782
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/compliance_control_set_copy_worker_spec.rb21
1 files changed, 18 insertions, 3 deletions
diff --git a/spec/workers/compliance_control_set_copy_worker_spec.rb b/spec/workers/compliance_control_set_copy_worker_spec.rb
index 69161200c..fcd1918c7 100644
--- a/spec/workers/compliance_control_set_copy_worker_spec.rb
+++ b/spec/workers/compliance_control_set_copy_worker_spec.rb
@@ -1,12 +1,27 @@
RSpec.describe ComplianceControlSetCopyWorker do
- it "calls ComplianceControlSetCopier" do
- control_set_id = 55
- referential_id = 99
+ let(:control_set_id) { 55 }
+ let(:referential_id) { 99 }
+
+ before(:each) do
+ allow_any_instance_of(ComplianceControlSetCopier).to receive(:copy)
+ end
+ it "calls ComplianceControlSetCopier" do
expect_any_instance_of(
ComplianceControlSetCopier
).to receive(:copy).with(control_set_id, referential_id)
ComplianceControlSetCopyWorker.new.perform(control_set_id, referential_id)
end
+
+ it "calls the Java API to launch validation" do
+ validation_request = stub_request(
+ :get,
+ "#{Rails.configuration.iev_url}/boiv_iev/referentials/validator/new?id=#{control_set_id}"
+ )
+
+ ComplianceControlSetCopyWorker.new.perform(control_set_id, referential_id)
+
+ expect(validation_request).to have_been_requested
+ end
end