Sha256: b5c564a075f5dbe1c5ee6920b64d6afcd014370ab86a0a076456026a95200d2f

Contents?: true

Size: 1.99 KB

Versions: 3

Compression:

Stored size: 1.99 KB

Contents

require 'spec_helper'
module Exlibris
  module Aleph
    class Patron
      class Record
        class Item
          describe CirculationPolicy do
            let(:hold_request) { 'N' }
            let(:short_loan) { 'N' }
            let(:photocopy_request) { 'N' }
            let(:booking_request) { 'N' }
            let(:arg) { double }
            before do
              allow(arg).to receive(:hold_request).and_return(hold_request)
              allow(arg).to receive(:short_loan).and_return(short_loan)
              allow(arg).to receive(:photocopy_request).and_return(photocopy_request)
              allow(arg).to receive(:booking_request).and_return(booking_request)
            end
            let(:privileges) { CirculationPolicy::Privileges.new(arg) }
            let(:pickup_locations) do
              [
                PickupLocation.new('PICK1', 'Pickup Location 1'),
                PickupLocation.new('PICK2', 'Pickup Location 2')
              ]
            end
            subject(:circulation_policy) { CirculationPolicy.new(privileges, *pickup_locations) }
            describe '#privileges' do
              subject { circulation_policy.privileges }
              it { should eq privileges }
            end
            describe '#pickup_locations' do
              subject { circulation_policy.pickup_locations }
              it { should be_an Array }
              it { should_not be_empty }
              it { should eq pickup_locations }
              context 'when initialized with no pickup locations' do
                let(:circulation_policy) { CirculationPolicy.new(privileges) }
                it { should be_empty }
              end
            end
            context 'when the privileges argument is not a CirculationPolicy::Privileges' do
              let(:privileges) { 'invalid' }
              it 'should raise an ArgumentError' do
                expect { subject }.to raise_error ArgumentError
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
exlibris-aleph-2.0.4 spec/exlibris/aleph/patron/record/item/circulation_policy_spec.rb
exlibris-aleph-2.0.3 spec/exlibris/aleph/patron/record/item/circulation_policy_spec.rb
exlibris-aleph-2.0.0 spec/exlibris/aleph/patron/record/item/circulation_policy_spec.rb