aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/compliance_control_set_copier_spec.rb3
-rw-r--r--spec/models/compliance_check_spec.rb4
-rw-r--r--spec/workers/compliance_control_set_copy_worker_spec.rb15
3 files changed, 21 insertions, 1 deletions
diff --git a/spec/lib/compliance_control_set_copier_spec.rb b/spec/lib/compliance_control_set_copier_spec.rb
index d1a56cd7f..954b1f73e 100644
--- a/spec/lib/compliance_control_set_copier_spec.rb
+++ b/spec/lib/compliance_control_set_copier_spec.rb
@@ -75,6 +75,7 @@ RSpec.describe ComplianceControlSetCopier do
let!( :control ){ create :compliance_control,
compliance_control_set: cc_set,
compliance_control_block: cc_block,
+ iev_enabled_check: false,
name: 'control' }
let( :cck_set ) { ComplianceCheckSet.last }
@@ -92,7 +93,7 @@ RSpec.describe ComplianceControlSetCopier do
expect( cck_block.condition_attributes ).to eq(cc_block.condition_attributes)
# Control/Check
- att_names = %w{ control_attributes code criticity comment origin_code }
+ att_names = %w{control_attributes code criticity comment origin_code iev_enabled_check}
expected = control.attributes.values_at(*att_names) << mk_name(control.name)
actual = cck.attributes.values_at(*(att_names << 'name'))
diff --git a/spec/models/compliance_check_spec.rb b/spec/models/compliance_check_spec.rb
index ffa59245c..cfceaa094 100644
--- a/spec/models/compliance_check_spec.rb
+++ b/spec/models/compliance_check_spec.rb
@@ -4,6 +4,10 @@ RSpec.describe ComplianceCheck, type: :model do
expect(FactoryGirl.build(:compliance_check)).to be_valid
end
+ it 'should rely on IEV by default' do
+ expect(FactoryGirl.build(:compliance_check).iev_enabled_check).to be_truthy
+ end
+
it 'has STI disabled' do
expect( described_class.inheritance_column ).to be_blank
end
diff --git a/spec/workers/compliance_control_set_copy_worker_spec.rb b/spec/workers/compliance_control_set_copy_worker_spec.rb
index 0ff721e75..7605555a7 100644
--- a/spec/workers/compliance_control_set_copy_worker_spec.rb
+++ b/spec/workers/compliance_control_set_copy_worker_spec.rb
@@ -13,6 +13,9 @@ RSpec.describe ComplianceControlSetCopyWorker do
allow_any_instance_of(
ComplianceControlSetCopier
).to receive(:copy).and_return(check_set)
+ allow(
+ check_set
+ ).to receive(:should_call_iev?).and_return(true)
stub_validation_request
end
@@ -32,4 +35,16 @@ RSpec.describe ComplianceControlSetCopyWorker do
expect(stub_validation_request).to have_been_requested
end
+
+ context "when JAVA is not needed" do
+ before do
+ expect(check_set).to receive(:should_call_iev?).and_return(false)
+ end
+
+ it "should not call it" do
+ expect(stub_validation_request).to_not have_been_requested
+ expect(check_set).to receive :perform_internal_checks
+ ComplianceControlSetCopyWorker.new.perform(control_set_id, referential_id)
+ end
+ end
end