Sha256: acfbae3187b02c7cfc4d2a1b1b83755c0bbfee94ccdf013eeb26e438c6a3d34a

Contents?: true

Size: 1.64 KB

Versions: 3

Compression:

Stored size: 1.64 KB

Contents

require 'spec_helper'
module Exlibris
  module Aleph
    describe Holdings, vcr: {cassette_name: 'record', record: :new_episodes} do
      let(:record_id) { 'NYU01000864162' }
      subject(:holdings) { Holdings.new(record_id) }
      it { should be_an Holdings }
      describe '#record_id' do
        subject { holdings.record_id }
        it { should eq record_id }
      end
      describe '#each' do
        subject { holdings.each }
        it { should be_an Enumerable }
      end
      describe '#size' do
        subject { holdings.size }
        it { should eq 2 }
      end
      describe '#to_a' do
        subject { holdings.to_a }
        it { should be_an Array }
        it 'should contain Holdings' do
          subject.each do |holding|
            expect(holding).to be_a Holding
          end
        end
      end
      context 'when there is only one holding' do
        let(:record_id) { 'NYU01003415726' }
        describe '#size' do
          subject { holdings.size }
          it { should eq 1 }
        end
        describe '#to_a' do
          subject { holdings.to_a }
          it { should be_an Array }
          it 'should contain Holdings' do
            subject.each do |holding|
              expect(holding).to be_a Holding
            end
          end
        end
      end
      context 'when there are no holdings' do
        let(:record_id) { 'NYU01000000000' }
        describe '#size' do
          subject { holdings.size }
          it { should eq 0 }
        end
        describe '#to_a' do
          subject { holdings.to_a }
          it { should be_an Array }
          it { should be_empty }
        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/holdings_spec.rb
exlibris-aleph-2.0.3 spec/exlibris/aleph/holdings_spec.rb
exlibris-aleph-2.0.0 spec/exlibris/aleph/holdings_spec.rb