Sha256: cdc709514463e37ef67c6417cc591210a3f44a9ac620735793f70046e7d80c5d

Contents?: true

Size: 1008 Bytes

Versions: 4

Compression:

Stored size: 1008 Bytes

Contents

require 'rails_helper'

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

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

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

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

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

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

      it 'sets minimum acquisition time to 0 by default' do
        eq = create(:equipment, minimum_acquisition_time: nil)
        expect(eq.minimum_acquisition_time).to eq 0
      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_spec.rb
mks_edm-1.0.4 spec/models/mks/edm/equipment_spec.rb
mks_edm-1.0.2 spec/models/mks/edm/equipment_spec.rb
mks_edm-1.0.1 spec/models/mks/edm/equipment_spec.rb