Sha256: 7e2e05bac2dc9a8f71715dec2077aafccd3fd4e578b43227eefee5e5ca2a3fa7

Contents?: true

Size: 1.64 KB

Versions: 3

Compression:

Stored size: 1.64 KB

Contents

require 'spec_helper'
module Exlibris
  module Aleph
    describe Holding, vcr: {cassette_name: 'record', record: :new_episodes} do
      let(:record_id) { 'NYU01000864162' }
      let(:id) { 'NYU60002367980' }
      let(:tables_manager) { TablesManager.instance }
      subject(:holding) { Holding.new(record_id, id) }
      it { should be_a Holding }
      describe '#record_id' do
        subject { holding.record_id }
        it { should eq record_id }
      end
      describe '#id' do
        subject { holding.id }
        it { should eq id }
      end
      describe '#metadata' do
        subject { holding.metadata }
        it { should be_a Holding::Metadata }
      end
      describe '#collection' do
        let(:sub_libraries) { tables_manager.sub_libraries }
        let(:sub_library) do
          sub_libraries.find do |sub_library|
            sub_library.code == 'CU'
          end
        end
        let(:collections) { tables_manager.collections }
        let(:admin_library) { sub_library.admin_library }
        let(:collection) do
          collections[admin_library].find do |collection|
            collection.code == 'MAIN' && collection.sub_library == sub_library
          end
        end
        subject { holding.collection }
        it { should be_a Collection }
        it { should eq collection }
      end
      context 'when the holding does not exist' do
        let(:id) { 'ADM60' }
        describe '#metadata' do
          subject { holding.metadata }
          it { should be_nil }
        end
        describe '#collection' do
          subject { holding.collection }
          it { should be_nil }
        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/holding_spec.rb
exlibris-aleph-2.0.3 spec/exlibris/aleph/holding_spec.rb
exlibris-aleph-2.0.0 spec/exlibris/aleph/holding_spec.rb