Skip to content
This repository has been archived by the owner on Jul 24, 2020. It is now read-only.

Commit

Permalink
Avoid needlessly persisting to db in equipment model spec
Browse files Browse the repository at this point in the history
Resolves #1665
-change spec to build_stubbed instead of build
  • Loading branch information
zeffman authored and Chris Cadden committed Jul 19, 2018
1 parent b5d0a66 commit 8b0b2fe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spec/models/equipment_model_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def mock_eq_model(**attrs)
it { is_expected.to accept_nested_attributes_for(:checkout_procedures) }
it { is_expected.to have_and_belong_to_many(:associated_equipment_models) }
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_uniqueness_of(:name) }
it { is_expected.to validate_presence_of(:description) }
it { is_expected.to belong_to(:category) }
it 'requires an associated category' do
Expand All @@ -36,6 +35,11 @@ def mock_eq_model(**attrs)
end
end

describe 'validations requiring peristance' do
subject { FactoryGirl.build(:equipment_model) }
it { is_expected.to validate_uniqueness_of(:name) }
end

describe 'attribute-specific validations' do
shared_examples 'integer attribute' do |attr|
it 'is valid with an integer value' do
Expand Down

0 comments on commit 8b0b2fe

Please sign in to comment.