Sha256: 0d09bf2851be68d9719f441bbb5b3f66ff20fbb2069f26ae096292510b8c962e

Contents?: true

Size: 1.35 KB

Versions: 9

Compression:

Stored size: 1.35 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'
class AlephRecordTest < ActiveSupport::TestCase
  def setup
    @primo_config = YAML.load_file("#{Rails.root}/config/umlaut_config/primo.yml")
    @nyu_aleph_config = @primo_config["sources"]["nyu_aleph"]
    @rest_url = @nyu_aleph_config["rest_url"]
    @aleph_doc_library = "NYU01"
    @aleph_doc_number = "000062856"
    @bogus_url = "http://library.nyu.edu/bogus"
  end

  # Test exception handling for bogus response.
  def test_bogus_response
    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(REXML::ParseException) { aleph_record.items }
  end

  # Test search for a single Primo document.
  def test_record
    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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
umlaut-3.0.0alpha9 ./test/unit/aleph_record_test.rb
umlaut-3.0.0alpha8 ./test/unit/aleph_record_test.rb
umlaut-3.0.0alpha7 ./test/unit/aleph_record_test.rb
umlaut-3.0.0alpha6 ./test/unit/aleph_record_test.rb
umlaut-3.0.0alpha5 ./test/unit/aleph_record_test.rb
umlaut-3.0.0alpha4 ./test/unit/aleph_record_test.rb
umlaut-3.0.0alpha3 ./test/unit/aleph_record_test.rb
umlaut-3.0.0alpha2 test/unit/aleph_record_test.rb
umlaut-3.0.0alpha1 test/unit/aleph_record_test.rb