diff options
| author | Luc Donnet | 2017-09-27 21:57:22 +0200 |
|---|---|---|
| committer | Luc Donnet | 2017-09-27 21:57:22 +0200 |
| commit | c86a9c0bd4e8cb7bc677051e44e1e33d1419a409 (patch) | |
| tree | 045a6a1172b31c950e824450e349015790a9889f /spec/models/compliance_control_spec.rb | |
| parent | 16fc6a184311c0ab5e1463398b91f8a716bcf4db (diff) | |
| parent | 55779bdf1737eea5e5ae79bacfebabbc249643af (diff) | |
| download | chouette-core-c86a9c0bd4e8cb7bc677051e44e1e33d1419a409.tar.bz2 | |
Merge branch 'master' of github.com:AF83/stif-boiv
Diffstat (limited to 'spec/models/compliance_control_spec.rb')
| -rw-r--r-- | spec/models/compliance_control_spec.rb | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/spec/models/compliance_control_spec.rb b/spec/models/compliance_control_spec.rb index b00ff4c5a..d7bffb0b2 100644 --- a/spec/models/compliance_control_spec.rb +++ b/spec/models/compliance_control_spec.rb @@ -1,14 +1,41 @@ 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 belong_to :compliance_control_block } + it { should have_one(:compliance_control_block).dependent(:destroy) } + + 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 + + it 'should validate_presence_of code' do + compliance_control.code = nil + expect(compliance_control).not_to be_valid + end + + it 'should validate_presence_of origin_code' do + compliance_control.origin_code = nil + expect(compliance_control).not_to be_valid + end - it { should validate_presence_of :criticity } - it { should validate_presence_of :name } - it { should validate_presence_of :code } + #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 } + # it { should validate_presence_of :code } + # it { should validate_presence_of :origin_code } + end |
