aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
diff options
context:
space:
mode:
authorTeddy Wing2017-11-08 18:39:05 +0100
committercedricnjanga2017-11-13 17:52:54 +0100
commit9287427e6f57b9ef3cc0c0f075c9022f4ebfab16 (patch)
tree5c1ba2eef411e161a803f0c194a05f670d9221c6 /spec/models
parent89f518891cff138643eaa14977aa20a3ef01930d (diff)
downloadchouette-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.rb16
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