Sha256: 89ec6882fdd0a50199089d2940f48fe8ae5d685ab006b0ee71f46c62cdd7a95c

Contents?: true

Size: 833 Bytes

Versions: 9

Compression:

Stored size: 833 Bytes

Contents

require 'rails_helper'

module Logistics
  module Core
    RSpec.describe DocumentTypeOrigin, type: :model do
      it 'has a valid factory' do
        expect(create(:document_type_origin)).to be_valid
      end

      it 'is invalid without a code' do
        expect(build(:document_type_origin, code: nil)).not_to be_valid
      end

      it 'is invalid without a name' do
        expect(build(:document_type_origin, name: nil)).not_to be_valid
      end

      it 'is invalid with a duplicate code' do
        dto = create(:document_type_origin)
        expect(build(:document_type_origin, code: dto.code)).not_to be_valid
      end

      it 'is invalid with a duplicate name' do
        dto = create(:document_type_origin)
        expect(build(:document_type_origin, name: dto.name)).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/document_type_origin_spec.rb
logistics_core-21.11.1 spec/models/logistics/core/document_type_origin_spec.rb
logistics_core-21.08.1 spec/models/logistics/core/document_type_origin_spec.rb
logistics_core-21.03.1 spec/models/logistics/core/document_type_origin_spec.rb
logistics_core-20.10.3 spec/models/logistics/core/document_type_origin_spec.rb
logistics_core-20.10.2 spec/models/logistics/core/document_type_origin_spec.rb
logistics_core-20.10.1 spec/models/logistics/core/document_type_origin_spec.rb
logistics_core-20.9.1 spec/models/logistics/core/document_type_origin_spec.rb
logistics_core-20.8.1 spec/models/logistics/core/document_type_origin_spec.rb