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