require 'rails_helper' module Mks module Edm RSpec.describe EquipmentLocation, type: :model do it 'has a valid factory' do expect(create(:equipment_location)).to be_valid end it 'is invalid with no code' do expect(build(:equipment_location, code: nil)).not_to be_valid end it 'is invalid with no name' do expect(build(:equipment_location, name: nil)).not_to be_valid end it 'is invalid with duplicate code' do su = create(:equipment_location) expect(build(:equipment_location, code: su.code)).not_to be_valid end end end end