Sha256: b56f7373f4c61af45a177b0aca9377297eb4f4d43c7653db40fa20f06a00d250

Contents?: true

Size: 1.27 KB

Versions: 3

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'
module Exlibris
  module Aleph
    module API
      module Client
        describe Base do
          let(:view) { 'full' }
          let(:query) { { view: view } }
          subject(:base) { Base.new(query) }
          it { should be_a Base }
          describe Base::VALID_VIEWS do
            subject { Base::VALID_VIEWS }
            it { should be_an Array }
            it { should eq ['full', 'brief'] }
          end
          context 'when initialized without a "query" argument' do
            subject(:base) { Base.new }
            it { should be_a Base }
          end
          context 'when initialized with a "query" argument' do
            context 'but the "query" argument is invalid' do
              let(:query) { "invalid" }
              it 'should raise an ArgumentError' do
                expect { subject }.to raise_error ArgumentError
              end
            end
            context 'and the "query" argument is valid' do
              context 'but the view is invalid' do
                let(:view) { 'invalid' }
                it 'should raise an ArgumentError' do
                  expect { subject }.to raise_error ArgumentError
                end
              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/api/client/base_spec.rb
exlibris-aleph-2.0.3 spec/exlibris/aleph/api/client/base_spec.rb
exlibris-aleph-2.0.0 spec/exlibris/aleph/api/client/base_spec.rb