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] assert_equal 'Status unknown', record.item_status[:messages].first[:short_message] 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 - Recall, or try Borrow Direct or ILL.', record.item_status[:messages].first[:long_message] 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 - Recall, or try Borrow Direct or ILL.', record.item_status[:messages].first[:long_message] 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[:long_message] assert_equal 'At Bindery', record.item_status[:messages].first[:short_message] 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[:long_message] end def test_item_status_1 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[:long_message] record = load_fixture("holdings_8189127.xml").records[1] assert_equal 'Not checked out (Requests: 1)', record.item_status[:messages].first[:long_message], 'status 1 with request' end def test_item_status_2 record = load_fixture("holdings_8189127.xml").records[0] assert_equal 'Checked out, due 2011-09-30 (Requests: 1). Try Borrow Direct or ILL.', record.item_status[:messages].first[:long_message], 'status 2 with request' end def test_item_status_7 record = load_fixture("holdings_5351573.xml").records[1] assert_equal 'On hold at Butler Circulation Desk (Requests: 1). Try Borrow Direct or ILL.', record.item_status[:messages].first[:long_message], 'status 7' end def test_item_status_8 record = load_fixture("holdings_7140519.xml").records[1] assert_equal 'In transit 2011-05-09. Place a hold request.', record.item_status[:messages].first[:long_message], 'status 8 in transit' end def test_item_status_9 record = load_fixture("holdings_10290623.xml").records[0] assert_equal 'In transit 2013-07-05. Place a hold request.', record.item_status[:messages].first[:long_message], 'status 9 in transit' end def test_item_status_10 record = load_fixture("holdings_1558940.xml").records[1] assert_equal 'In transit 2013-07-09 (Requests: 1). Try Borrow Direct.', record.item_status[:messages].first[:long_message], 'status 10 in transit with request' end def test_item_status_14 record = load_fixture("holdings_8828760.xml").records[0] assert_equal 'Unavailable 2011-08-12 00:37:59. Try Borrow Direct or ILL.', record.item_status[:messages].first[:long_message], 'status 14 lost' end def test_item_status_22 record = load_fixture("holdings_3708764.xml").records[0] assert_equal 'no.21 (2010) In Process 2011-02-18. Place an In Process item request.', record.item_status[:messages].first[:long_message], 'status 22 in process' end def test_determine_status record = load_fixture("holdings_299492.xml").records assert_equal 'available', record[0].item_status[:status] assert_equal 'some_available', record[1].item_status[:status] assert_equal 'not_available', record[2].item_status[:status] end end