Sha256: 95479a7130fbd685f2937489dbcd6c970b5bd9da26daf67414b862149b6cf349

Contents?: true

Size: 885 Bytes

Versions: 4

Compression:

Stored size: 885 Bytes

Contents

require 'rails_helper'

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

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

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

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

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

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