require 'rails_helper' module Logistics module Core RSpec.describe Declarant, type: :model do it 'has a valid factory' do expect(create(:declarant)).to be_valid end it 'is invalid with no code' do expect(build(:declarant, :first_name => '')).not_to be_valid end it 'is invalid with no name' do expect(build(:declarant, :last_name => '')).not_to be_valid end it 'is invalid with no name' do expect(build(:declarant, :number => '')).not_to be_valid end it 'is invalid with duplicate entries' do declarant = create(:declarant) expect(build(:declarant, :first_name => declarant.first_name, :last_name => declarant.last_name, :number => declarant.number)).not_to be_valid end end end end