This repository was archived by the owner on Jul 24, 2020. It is now read-only.
Commit 6047360 1 parent 0e87e1a commit 6047360 Copy full SHA for 6047360
File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ def mock_eq_model(**attrs)
13
13
end
14
14
15
15
describe 'basic validations' do
16
- subject { EquipmentModel . new ( ordering : 1 ) }
16
+ let! ( :model ) { mock_eq_model }
17
17
it { is_expected . to have_and_belong_to_many ( :requirements ) }
18
18
it { is_expected . to have_many ( :equipment_items ) }
19
19
it { is_expected . to have_many ( :reservations ) }
@@ -23,17 +23,20 @@ def mock_eq_model(**attrs)
23
23
it { is_expected . to accept_nested_attributes_for ( :checkout_procedures ) }
24
24
it { is_expected . to have_and_belong_to_many ( :associated_equipment_models ) }
25
25
it { is_expected . to validate_presence_of ( :name ) }
26
- it { is_expected . to validate_uniqueness_of ( :name ) }
27
26
it { is_expected . to validate_presence_of ( :description ) }
28
27
it { is_expected . to belong_to ( :category ) }
29
28
it { is_expected . to validate_presence_of ( :ordering ) }
30
29
it 'requires an associated category' do
31
- model = mock_eq_model
32
30
model . category = nil
33
31
expect ( model . valid? ) . to be_falsey
34
32
end
35
33
end
36
34
35
+ describe 'validations requiring peristance' do
36
+ subject { FactoryGirl . build ( :equipment_model ) }
37
+ it { is_expected . to validate_uniqueness_of ( :name ) }
38
+ end
39
+
37
40
describe 'attribute-specific validations' do
38
41
shared_examples 'integer attribute' do |attr |
39
42
it 'is valid with an integer value' do
You can’t perform that action at this time.
0 commit comments