aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/compliance_control_spec.rb24
1 files changed, 21 insertions, 3 deletions
diff --git a/spec/models/compliance_control_spec.rb b/spec/models/compliance_control_spec.rb
index e11873144..226e7ae74 100644
--- a/spec/models/compliance_control_spec.rb
+++ b/spec/models/compliance_control_spec.rb
@@ -1,14 +1,32 @@
require 'rails_helper'
RSpec.describe ComplianceControl, type: :model do
+
+ let(:compliance_control) { create :compliance_control }
+
it 'should have a valid factory' do
- expect(FactoryGirl.build(:compliance_control)).to be_valid
+ expect(compliance_control).to be_valid
end
it { should belong_to :compliance_control_set }
it { should have_one(:compliance_control_block).dependent(:destroy) }
- it { should validate_presence_of :criticity }
- it { should validate_presence_of :name }
it { should validate_presence_of :code }
+ it { should validate_presence_of :origin_code }
+
+ it 'should validate_presence_of criticity' do
+ compliance_control.criticity = nil
+ expect(compliance_control).not_to be_valid
+ end
+
+ it 'should validate_presence_of name' do
+ compliance_control.name = nil
+ expect(compliance_control).not_to be_valid
+ end
+
+ #TODO dont know why the 'shortcuts' below to validates presence dont work
+ # That's why we dont it 'manually'
+ # it { should validate_presence_of :criticity }
+ # it { should validate_presence_of :name }
+
end