Sha256: bfbe8e4e093fb8fd1aaa928a63dcfd075bd7deee57f1b53fc77b5be47d6990bb

Contents?: true

Size: 820 Bytes

Versions: 9

Compression:

Stored size: 820 Bytes

Contents

require 'rails_helper'

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

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

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

      it 'is invalid with a duplicate code and agency category id' do
        agency = create(:agency)
        expect(build(:agency, code: agency.code, name: agency.name, agency_category: agency.agency_category)).not_to be_valid
      end

      it 'is invalid with telephone number length greater than 13' do
        expect(build(:agency, telephone: '+251911191929222')).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/agency_spec.rb
logistics_core-21.11.1 spec/models/logistics/core/agency_spec.rb
logistics_core-21.08.1 spec/models/logistics/core/agency_spec.rb
logistics_core-21.03.1 spec/models/logistics/core/agency_spec.rb
logistics_core-20.10.3 spec/models/logistics/core/agency_spec.rb
logistics_core-20.10.2 spec/models/logistics/core/agency_spec.rb
logistics_core-20.10.1 spec/models/logistics/core/agency_spec.rb
logistics_core-20.9.1 spec/models/logistics/core/agency_spec.rb
logistics_core-20.8.1 spec/models/logistics/core/agency_spec.rb