diff options
| author | Zog | 2018-06-01 12:10:11 +0200 |
|---|---|---|
| committer | Zog | 2018-06-01 12:10:11 +0200 |
| commit | 1e6b830a083e4c30f9f65c7fa51a9f066742f66d (patch) | |
| tree | 5bd2e7e6b6685246f95f8b887f451ec9d050a5c3 /spec | |
| parent | 12b974e13538b9f1952e4282c88d1b1a913c7f84 (diff) | |
| download | chouette-core-6979-ruby-controls-sets.tar.bz2 | |
Refs #6979; Flag controls intended to be handled by the Java third-party app6979-ruby-controls-sets
And prevent calls to the java API when it is not needed
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/lib/compliance_control_set_copier_spec.rb | 3 | ||||
| -rw-r--r-- | spec/models/compliance_check_spec.rb | 4 | ||||
| -rw-r--r-- | spec/workers/compliance_control_set_copy_worker_spec.rb | 15 |
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 |
