Sha256: 939e2c6c2b6db7839faf08675f8b010e9231334e19df29de35dae859fd44f5cf

Contents?: true

Size: 891 Bytes

Versions: 4

Compression:

Stored size: 891 Bytes

Contents

require 'rails_helper'

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

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

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

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

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

      it 'is valid with no description' do
        expect(create(:equipment_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/equipment_type_spec.rb
mks_edm-1.0.4 spec/models/mks/edm/equipment_type_spec.rb
mks_edm-1.0.2 spec/models/mks/edm/equipment_type_spec.rb
mks_edm-1.0.1 spec/models/mks/edm/equipment_type_spec.rb