require 'rails_helper' module Logistics module Core RSpec.describe TransportMode, type: :model do it 'has a valid factory' do expect(create(:transport_mode)).to be_valid end it 'is invalid with no code' do expect(build(:transport_mode, :code => '')).not_to be_valid end it 'is invalid with no name' do expect(build(:transport_mode, :name => nil)).not_to be_valid end it 'is invalid with duplicate code' do lookup = create(:transport_mode) expect(build(:transport_mode, :code => lookup.code)).not_to be_valid end end end end