Sha256: 3d6e0f35e866029454e60f6aa9b82263d10a1d6a91416b5ceee9c2240ae5e62f

Contents?: true

Size: 882 Bytes

Versions: 4

Compression:

Stored size: 882 Bytes

Contents

require 'rails_helper'

module Mks
  module Edm
    RSpec.describe LocationType, type: :model do
      it 'has a valid factory' do
        expect(create(:location_type)).to be_valid
      end

      it 'is invalid with no code' do
        expect(build(:location_type, code: nil)).not_to be_valid
      end

      it 'is invalid with no name' do
        expect(build(:location_type, name: nil)).not_to be_valid
      end

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

      it 'is invalid with duplicate name' do
        su = create(:location_type)
        expect(build(:location_type, name: su.name)).not_to be_valid
      end

      it 'is valid with no description' do
        expect(create(:location_type, description: nil)).to be_valid
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mks_edm-1.0.5 spec/models/mks/edm/location_type_spec.rb
mks_edm-1.0.4 spec/models/mks/edm/location_type_spec.rb
mks_edm-1.0.2 spec/models/mks/edm/location_type_spec.rb
mks_edm-1.0.1 spec/models/mks/edm/location_type_spec.rb