diff options
| author | cedricnjanga | 2017-09-27 16:08:19 +0200 | 
|---|---|---|
| committer | cedricnjanga | 2017-09-27 16:23:22 +0200 | 
| commit | 5911206bbadb2c3c9609f8be0ce1affd6584015e (patch) | |
| tree | d0b70454259fd985f1f6b6d0bbcd5616055fac83 /spec/models/compliance_control_spec.rb | |
| parent | eb761e221efc3ce0b09bfea96415907afac33d4a (diff) | |
| download | chouette-core-5911206bbadb2c3c9609f8be0ce1affd6584015e.tar.bz2 | |
Refs #4615 Change spec and controller regarding to the ComplianceControl models changes
Diffstat (limited to 'spec/models/compliance_control_spec.rb')
| -rw-r--r-- | spec/models/compliance_control_spec.rb | 24 | 
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 | 
