diff options
| author | Teddy Wing | 2017-11-08 18:44:43 +0100 | 
|---|---|---|
| committer | cedricnjanga | 2017-11-13 17:52:54 +0100 | 
| commit | fb0e5a43f77e9a150956851df63820f463f813a4 (patch) | |
| tree | 5c4b3a354b440f17362ba3c642a82980b5062104 /spec/models | |
| parent | 9287427e6f57b9ef3cc0c0f075c9022f4ebfab16 (diff) | |
| download | chouette-core-fb0e5a43f77e9a150956851df63820f463f813a4.tar.bz2 | |
ComplianceCheckSet#update_status spec: Add failure status cases
Add test cases for status update when `ComplianceCheckResource` are
"ERROR" and "WARNING". If a single Resource is "ERROR" or "WARNING",
then the `ComplianceCheckSet` becomes "failed" or "warning".
Refs #4757
Diffstat (limited to 'spec/models')
| -rw-r--r-- | spec/models/compliance_check_set_spec.rb | 36 | 
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/models/compliance_check_set_spec.rb b/spec/models/compliance_check_set_spec.rb index 827ddd4e4..b00a97636 100644 --- a/spec/models/compliance_check_set_spec.rb +++ b/spec/models/compliance_check_set_spec.rb @@ -27,5 +27,41 @@ RSpec.describe ComplianceCheckSet, type: :model do        expect(check_set.status).to eq('successful')      end + +    it "updates :status to failed when one resource is ERROR" do +      check_set = create(:compliance_check_set) +      create( +        :compliance_check_resource, +        compliance_check_set: check_set, +        status: 'OK' +      ) +      create( +        :compliance_check_resource, +        compliance_check_set: check_set, +        status: 'ERROR' +      ) + +      check_set.update_status + +      expect(check_set.status).to eq('failed') +    end + +    it "updates :status to warning when one resource is WARNING" do +      check_set = create(:compliance_check_set) +      create( +        :compliance_check_resource, +        compliance_check_set: check_set, +        status: 'OK' +      ) +      create( +        :compliance_check_resource, +        compliance_check_set: check_set, +        status: 'WARNING' +      ) + +      check_set.update_status + +      expect(check_set.status).to eq('warning') +    end    end  end  | 
