diff options
| author | Teddy Wing | 2017-11-08 18:39:05 +0100 | 
|---|---|---|
| committer | cedricnjanga | 2017-11-13 17:52:54 +0100 | 
| commit | 9287427e6f57b9ef3cc0c0f075c9022f4ebfab16 (patch) | |
| tree | 5c1ba2eef411e161a803f0c194a05f670d9221c6 /spec/models | |
| parent | 89f518891cff138643eaa14977aa20a3ef01930d (diff) | |
| download | chouette-core-9287427e6f57b9ef3cc0c0f075c9022f4ebfab16.tar.bz2 | |
ComplianceCheckSet#update_status: Add spec for successful children
Initial spec that checks the correct status field change when all
`ComplianceCheckResource`s are successful.
Refs #4757
Diffstat (limited to 'spec/models')
| -rw-r--r-- | spec/models/compliance_check_set_spec.rb | 16 | 
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/compliance_check_set_spec.rb b/spec/models/compliance_check_set_spec.rb index 8afea5b3e..827ddd4e4 100644 --- a/spec/models/compliance_check_set_spec.rb +++ b/spec/models/compliance_check_set_spec.rb @@ -12,4 +12,20 @@ RSpec.describe ComplianceCheckSet, type: :model do    it { should have_many :compliance_checks }    it { should have_many :compliance_check_blocks } + +  describe "#update_status" do +    it "updates :status to successful when all resources are OK" do +      check_set = create(:compliance_check_set) +      create_list( +        :compliance_check_resource, +        2, +        compliance_check_set: check_set, +        status: 'OK' +      ) + +      check_set.update_status + +      expect(check_set.status).to eq('successful') +    end +  end  end  | 
