Sha256: 932aaa39e13c2107074a9d76c32d7646522a38ebe838bea825fd583f81f01a48

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 KB

Contents

require 'test_helper'
class RecordTest < ActiveSupport::TestCase
  def setup
    @rest_url = "http://aleph.library.nyu.edu:1891/rest-dlf"
    @aleph_doc_library = "NYU01"
    @aleph_doc_number = "000062856"
    @bogus_url = "http://library.nyu.edu/bogus"
  end

  # Test exception handling for bogus url
  test "bogus_response" do
    VCR.turned_off do
      aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @bogus_url)
      assert_raise(RuntimeError) { aleph_record.bib }
      assert_raise(RuntimeError) { aleph_record.holdings }
      assert_raise(MultiXml::ParseError) { aleph_record.items }
    end
  end

  # Test record.
  test "record" do
    VCR.use_cassette('record') do
      aleph_record = Exlibris::Aleph::Record.new(@aleph_doc_library, @aleph_doc_number, @rest_url)
      bib = aleph_record.bib
      assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling bib: #{aleph_record.error}")
      holdings = aleph_record.holdings
      assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling holdings: #{aleph_record.error}")
      items = aleph_record.items
      assert_nil(aleph_record.error, "Failure in #{aleph_record.class} while calling items: #{aleph_record.error}")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
exlibris-aleph-0.1.6 test/unit/record_test.rb
exlibris-aleph-0.1.5 test/unit/record_test.rb
exlibris-aleph-0.1.4 test/unit/record_test.rb
exlibris-aleph-0.1.3 test/unit/record_test.rb