Sha256: f67567a32618fc0257bbdd5263b2166385aebd231e22bea37b989cac5285ae63

Contents?: true

Size: 807 Bytes

Versions: 9

Compression:

Stored size: 807 Bytes

Contents

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
logistics_core-21.11.2 spec/models/logistics/core/declarant_spec.rb
logistics_core-21.11.1 spec/models/logistics/core/declarant_spec.rb
logistics_core-21.08.1 spec/models/logistics/core/declarant_spec.rb
logistics_core-21.03.1 spec/models/logistics/core/declarant_spec.rb
logistics_core-20.10.3 spec/models/logistics/core/declarant_spec.rb
logistics_core-20.10.2 spec/models/logistics/core/declarant_spec.rb
logistics_core-20.10.1 spec/models/logistics/core/declarant_spec.rb
logistics_core-20.9.1 spec/models/logistics/core/declarant_spec.rb
logistics_core-20.8.1 spec/models/logistics/core/declarant_spec.rb