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 | |
| 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
| -rw-r--r-- | app/models/compliance_check_set.rb | 2 | ||||
| -rw-r--r-- | spec/models/compliance_check_set_spec.rb | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/app/models/compliance_check_set.rb b/app/models/compliance_check_set.rb index 536afc705..1dc02853a 100644 --- a/app/models/compliance_check_set.rb +++ b/app/models/compliance_check_set.rb @@ -18,4 +18,6 @@ class ComplianceCheckSet < ActiveRecord::Base where('created_at BETWEEN :begin AND :end', begin: period_range.begin, end: period_range.end) end + def update_status + end end 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 |
