Sha256: d2fdcff550587c37653ed25cef441371a99fecdada0386fc17aa3b142d9baea8

Contents?: true

Size: 1.96 KB

Versions: 1

Compression:

Stored size: 1.96 KB

Contents

require "helper"
require "minitest/autorun"

class TestItem < HoldingsTestCase

  def test_has_item_count
    record = load_fixture("holdings_289196.xml").records.first
    assert_equal "391937", record.holding_id
    assert_equal '78', record.item_count
  end
  
  def test_location_exceptions
    record = load_fixture("holdings_289196.xml").records.first
    assert_kind_of Array, record.temp_locations
    assert_equal "98 (June-Dec. 1993) Shelved in Barnard. Temporarily unavailable. Try BorrowDirect or ILL", record.temp_locations.first
  end
  
  def test_no_item_statuses
    record = load_fixture("holdings_289196.xml").records[1]
    assert_equal 'none', record.item_status[:status]
  end
  
  def test_item_statuses_not_checked_out
    record = load_fixture("holdings_289196.xml").records[0]
    assert_equal 'available', record.item_status[:status]
    assert_equal 'Not checked out', record.item_status[:messages].first
  end
  
  def test_item_status_checkout_patron
    record = load_fixture("holdings_4191079.xml").records[0]
    assert_equal 'not_available', record.item_status[:status]
    assert_equal 'Checked out, due 2011-09-30 23:00:00 - Recall, or try Borrow Direct or ILL.', record.item_status[:messages].first
    record = load_fixture("holdings_4191079.xml").records[2]
    assert_equal 'some_available', record.item_status[:status]
    assert_equal 'v.2 Checked out, due 2011-09-30 23:00:00 - Recall, or try Borrow Direct or ILL.', record.item_status[:messages].first
  end
  
  def test_item_status_checkout_status_patron
    record = load_fixture("holdings_4191079.xml").records[1]
    assert_equal 'not_available', record.item_status[:status]
    assert_equal 'At Bindery. Try Borrow Direct or ILL.', record.item_status[:messages].first
    record = load_fixture("holdings_4191079.xml").records[3]
    assert_equal 'some_available', record.item_status[:status]
    assert_equal 'v.2 At Bindery. Try Borrow Direct or ILL.', record.item_status[:messages].first
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voyager_api-0.1.0 test/holdings/test_item.rb