exlibris-aleph 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +199 -82
- data/Rakefile +8 -14
- data/lib/exlibris-aleph.rb +0 -3
- data/lib/exlibris/aleph/admin_library.rb +27 -0
- data/lib/exlibris/aleph/api/base.rb +27 -0
- data/lib/exlibris/aleph/api/client/base.rb +86 -0
- data/lib/exlibris/aleph/api/client/patron.rb +20 -0
- data/lib/exlibris/aleph/api/client/patron/address.rb +22 -0
- data/lib/exlibris/aleph/api/client/patron/record.rb +23 -0
- data/lib/exlibris/aleph/api/client/patron/record/item.rb +26 -0
- data/lib/exlibris/aleph/api/client/patron/record/item/create_hold.rb +31 -0
- data/lib/exlibris/aleph/api/client/patron/record/item/create_hold/parameters.rb +55 -0
- data/lib/exlibris/aleph/api/client/patron/record/item/hold.rb +29 -0
- data/lib/exlibris/aleph/api/client/patron/status.rb +22 -0
- data/lib/exlibris/aleph/api/client/record.rb +21 -0
- data/lib/exlibris/aleph/api/client/record/filters.rb +23 -0
- data/lib/exlibris/aleph/api/client/record/holding.rb +23 -0
- data/lib/exlibris/aleph/api/client/record/holdings.rb +23 -0
- data/lib/exlibris/aleph/api/client/record/item.rb +23 -0
- data/lib/exlibris/aleph/api/client/record/items.rb +23 -0
- data/lib/exlibris/aleph/api/reader/base.rb +15 -0
- data/lib/exlibris/aleph/api/reader/patron.rb +19 -0
- data/lib/exlibris/aleph/api/reader/patron/address.rb +90 -0
- data/lib/exlibris/aleph/api/reader/patron/record.rb +38 -0
- data/lib/exlibris/aleph/api/reader/patron/record/item.rb +77 -0
- data/lib/exlibris/aleph/api/reader/patron/record/item/create_hold.rb +33 -0
- data/lib/exlibris/aleph/api/reader/patron/record/item/hold.rb +56 -0
- data/lib/exlibris/aleph/api/reader/patron/status.rb +33 -0
- data/lib/exlibris/aleph/api/reader/record.rb +10 -0
- data/lib/exlibris/aleph/api/reader/record/item.rb +45 -0
- data/lib/exlibris/aleph/collection.rb +26 -0
- data/lib/exlibris/aleph/config.rb +17 -57
- data/lib/exlibris/aleph/holding.rb +59 -0
- data/lib/exlibris/aleph/holding/metadata.rb +28 -0
- data/lib/exlibris/aleph/holdings.rb +51 -0
- data/lib/exlibris/aleph/item.rb +138 -0
- data/lib/exlibris/aleph/item/call_number.rb +14 -0
- data/lib/exlibris/aleph/item/circulation_policy.rb +30 -0
- data/lib/exlibris/aleph/item/circulation_policy/display.rb +16 -0
- data/lib/exlibris/aleph/item/circulation_policy/identifier.rb +34 -0
- data/lib/exlibris/aleph/item/circulation_policy/privileges.rb +72 -0
- data/lib/exlibris/aleph/item/circulation_status.rb +31 -0
- data/lib/exlibris/aleph/item/display_mask.rb +19 -0
- data/lib/exlibris/aleph/item/opac_note.rb +17 -0
- data/lib/exlibris/aleph/item/processing_status.rb +23 -0
- data/lib/exlibris/aleph/item/queue.rb +32 -0
- data/lib/exlibris/aleph/item/status.rb +23 -0
- data/lib/exlibris/aleph/items.rb +51 -0
- data/lib/exlibris/aleph/metadata.rb +25 -0
- data/lib/exlibris/aleph/patron.rb +18 -82
- data/lib/exlibris/aleph/patron/address.rb +56 -0
- data/lib/exlibris/aleph/patron/circulation_policy.rb +26 -0
- data/lib/exlibris/aleph/patron/circulation_policy/identifier.rb +29 -0
- data/lib/exlibris/aleph/patron/circulation_policy/privileges.rb +56 -0
- data/lib/exlibris/aleph/patron/record.rb +39 -0
- data/lib/exlibris/aleph/patron/record/circulation_policy.rb +18 -0
- data/lib/exlibris/aleph/patron/record/circulation_policy/privileges.rb +42 -0
- data/lib/exlibris/aleph/patron/record/item.rb +63 -0
- data/lib/exlibris/aleph/patron/record/item/circulation_policy.rb +21 -0
- data/lib/exlibris/aleph/patron/record/item/circulation_policy/privileges.rb +39 -0
- data/lib/exlibris/aleph/patron/record/item/create_hold.rb +43 -0
- data/lib/exlibris/aleph/patron/record/item/hold.rb +41 -0
- data/lib/exlibris/aleph/patron/status.rb +19 -0
- data/lib/exlibris/aleph/pickup_location.rb +12 -0
- data/lib/exlibris/aleph/record.rb +14 -43
- data/lib/exlibris/aleph/record/metadata.rb +8 -0
- data/lib/exlibris/aleph/sub_library.rb +30 -0
- data/lib/exlibris/aleph/table/base.rb +22 -0
- data/lib/exlibris/aleph/table/collections.rb +17 -0
- data/lib/exlibris/aleph/table/item/circulation_policies.rb +65 -0
- data/lib/exlibris/aleph/table/item/display_masks.rb +19 -0
- data/lib/exlibris/aleph/table/patron/circulation_policies.rb +47 -0
- data/lib/exlibris/aleph/table/patron/statuses.rb +19 -0
- data/lib/exlibris/aleph/table/reader/base.rb +57 -0
- data/lib/exlibris/aleph/table/reader/collections.rb +35 -0
- data/lib/exlibris/aleph/table/reader/item_circulation_policies.rb +50 -0
- data/lib/exlibris/aleph/table/reader/item_display_masks.rb +19 -0
- data/lib/exlibris/aleph/table/reader/matcher/base.rb +30 -0
- data/lib/exlibris/aleph/table/reader/matcher/collections.rb +17 -0
- data/lib/exlibris/aleph/table/reader/matcher/item_circulation_policies.rb +17 -0
- data/lib/exlibris/aleph/table/reader/matcher/item_display_masks.rb +17 -0
- data/lib/exlibris/aleph/table/reader/matcher/patron_circulation_policies.rb +17 -0
- data/lib/exlibris/aleph/table/reader/matcher/patron_statuses.rb +17 -0
- data/lib/exlibris/aleph/table/reader/matcher/sub_libraries.rb +17 -0
- data/lib/exlibris/aleph/table/reader/patron_circulation_policies.rb +51 -0
- data/lib/exlibris/aleph/table/reader/patron_statuses.rb +19 -0
- data/lib/exlibris/aleph/table/reader/row/base.rb +25 -0
- data/lib/exlibris/aleph/table/reader/row/collections.rb +13 -0
- data/lib/exlibris/aleph/table/reader/row/item_circulation_policies.rb +17 -0
- data/lib/exlibris/aleph/table/reader/row/item_display_masks.rb +13 -0
- data/lib/exlibris/aleph/table/reader/row/patron_circulation_policies.rb +20 -0
- data/lib/exlibris/aleph/table/reader/row/patron_statuses.rb +13 -0
- data/lib/exlibris/aleph/table/reader/row/sub_libraries.rb +13 -0
- data/lib/exlibris/aleph/table/reader/sub_libraries.rb +32 -0
- data/lib/exlibris/aleph/table/sub_libraries.rb +11 -0
- data/lib/exlibris/aleph/tables_manager.rb +66 -0
- data/lib/exlibris/aleph/version.rb +1 -1
- data/spec/exlibris/aleph/admin_library_spec.rb +83 -0
- data/spec/exlibris/aleph/api/base_spec.rb +23 -0
- data/spec/exlibris/aleph/api/client/base_spec.rb +40 -0
- data/spec/exlibris/aleph/api/client/patron/address_spec.rb +40 -0
- data/spec/exlibris/aleph/api/client/patron/record/item/create_hold/parameters_spec.rb +101 -0
- data/spec/exlibris/aleph/api/client/patron/record/item/create_hold_spec.rb +102 -0
- data/spec/exlibris/aleph/api/client/patron/record/item/hold_spec.rb +89 -0
- data/spec/exlibris/aleph/api/client/patron/record/item_spec.rb +52 -0
- data/spec/exlibris/aleph/api/client/patron/record_spec.rb +45 -0
- data/spec/exlibris/aleph/api/client/patron/status_spec.rb +40 -0
- data/spec/exlibris/aleph/api/client/patron_spec.rb +38 -0
- data/spec/exlibris/aleph/api/client/record/filters_spec.rb +46 -0
- data/spec/exlibris/aleph/api/client/record/holding_spec.rb +41 -0
- data/spec/exlibris/aleph/api/client/record/holdings_spec.rb +46 -0
- data/spec/exlibris/aleph/api/client/record/item_spec.rb +41 -0
- data/spec/exlibris/aleph/api/client/record/items_spec.rb +46 -0
- data/spec/exlibris/aleph/api/client/record_spec.rb +43 -0
- data/spec/exlibris/aleph/api/reader/base_spec.rb +18 -0
- data/spec/exlibris/aleph/api/reader/patron/address_spec.rb +151 -0
- data/spec/exlibris/aleph/api/reader/patron/record/item/create_hold_spec.rb +65 -0
- data/spec/exlibris/aleph/api/reader/patron/record/item/hold_spec.rb +145 -0
- data/spec/exlibris/aleph/api/reader/patron/record/item_spec.rb +266 -0
- data/spec/exlibris/aleph/api/reader/patron/record_spec.rb +98 -0
- data/spec/exlibris/aleph/api/reader/patron/status_spec.rb +57 -0
- data/spec/exlibris/aleph/api/reader/patron_spec.rb +28 -0
- data/spec/exlibris/aleph/api/reader/record/item_spec.rb +178 -0
- data/spec/exlibris/aleph/collection_spec.rb +95 -0
- data/spec/exlibris/aleph/config_spec.rb +17 -0
- data/spec/exlibris/aleph/holding/metadata_spec.rb +57 -0
- data/spec/exlibris/aleph/holding_spec.rb +53 -0
- data/spec/exlibris/aleph/holdings_spec.rb +59 -0
- data/spec/exlibris/aleph/item/call_number_spec.rb +20 -0
- data/spec/exlibris/aleph/item/circulation_policy/display_spec.rb +33 -0
- data/spec/exlibris/aleph/item/circulation_policy/identifier_spec.rb +154 -0
- data/spec/exlibris/aleph/item/circulation_policy/privileges_spec.rb +183 -0
- data/spec/exlibris/aleph/item/circulation_policy_spec.rb +146 -0
- data/spec/exlibris/aleph/item/circulation_status_spec.rb +83 -0
- data/spec/exlibris/aleph/item/display_mask_spec.rb +72 -0
- data/spec/exlibris/aleph/item/opac_note_spec.rb +19 -0
- data/spec/exlibris/aleph/item/processing_status_spec.rb +75 -0
- data/spec/exlibris/aleph/item/queue_spec.rb +31 -0
- data/spec/exlibris/aleph/item/status_spec.rb +80 -0
- data/spec/exlibris/aleph/item_spec.rb +97 -0
- data/spec/exlibris/aleph/items_spec.rb +59 -0
- data/spec/exlibris/aleph/metadata_spec.rb +118 -0
- data/spec/exlibris/aleph/patron/address_spec.rb +68 -0
- data/spec/exlibris/aleph/patron/circulation_policy/identifier_spec.rb +115 -0
- data/spec/exlibris/aleph/patron/circulation_policy/privileges_spec.rb +128 -0
- data/spec/exlibris/aleph/patron/circulation_policy_spec.rb +119 -0
- data/spec/exlibris/aleph/patron/record/circulation_policy/privileges_spec.rb +88 -0
- data/spec/exlibris/aleph/patron/record/circulation_policy_spec.rb +37 -0
- data/spec/exlibris/aleph/patron/record/item/circulation_policy/privileges_spec.rb +76 -0
- data/spec/exlibris/aleph/patron/record/item/circulation_policy_spec.rb +52 -0
- data/spec/exlibris/aleph/patron/record/item/create_hold_spec.rb +49 -0
- data/spec/exlibris/aleph/patron/record/item/hold_spec.rb +41 -0
- data/spec/exlibris/aleph/patron/record/item_spec.rb +64 -0
- data/spec/exlibris/aleph/patron/record_spec.rb +30 -0
- data/spec/exlibris/aleph/patron/status_spec.rb +72 -0
- data/spec/exlibris/aleph/patron_spec.rb +28 -0
- data/spec/exlibris/aleph/pickup_location_spec.rb +19 -0
- data/spec/exlibris/aleph/record/metadata_spec.rb +120 -0
- data/spec/exlibris/aleph/record_spec.rb +44 -0
- data/spec/exlibris/aleph/sub_library_spec.rb +110 -0
- data/spec/exlibris/aleph/table/base_spec.rb +17 -0
- data/spec/exlibris/aleph/table/collections_spec.rb +24 -0
- data/spec/exlibris/aleph/table/item/circulation_policies_spec.rb +65 -0
- data/spec/exlibris/aleph/table/item/display_masks_spec.rb +26 -0
- data/spec/exlibris/aleph/table/patron/circulation_policies_spec.rb +47 -0
- data/spec/exlibris/aleph/table/patron/statuses_spec.rb +26 -0
- data/spec/exlibris/aleph/table/reader/base_spec.rb +28 -0
- data/spec/exlibris/aleph/table/reader/collections_spec.rb +33 -0
- data/spec/exlibris/aleph/table/reader/item_circulation_policies_spec.rb +33 -0
- data/spec/exlibris/aleph/table/reader/item_display_masks_spec.rb +27 -0
- data/spec/exlibris/aleph/table/reader/matcher/base_spec.rb +32 -0
- data/spec/exlibris/aleph/table/reader/matcher/collections_spec.rb +39 -0
- data/spec/exlibris/aleph/table/reader/matcher/item_circulation_policies_spec.rb +39 -0
- data/spec/exlibris/aleph/table/reader/matcher/item_display_masks_spec.rb +40 -0
- data/spec/exlibris/aleph/table/reader/matcher/patron_circulation_policies_spec.rb +40 -0
- data/spec/exlibris/aleph/table/reader/matcher/patron_statuses_spec.rb +40 -0
- data/spec/exlibris/aleph/table/reader/matcher/sub_libraries_spec.rb +40 -0
- data/spec/exlibris/aleph/table/reader/patron_circulation_policies_spec.rb +27 -0
- data/spec/exlibris/aleph/table/reader/patron_statuses_spec.rb +27 -0
- data/spec/exlibris/aleph/table/reader/row/base_spec.rb +20 -0
- data/spec/exlibris/aleph/table/reader/row/collections_spec.rb +37 -0
- data/spec/exlibris/aleph/table/reader/row/item_circulation_policies_spec.rb +89 -0
- data/spec/exlibris/aleph/table/reader/row/item_display_masks_spec.rb +29 -0
- data/spec/exlibris/aleph/table/reader/row/patron_circulation_policies_spec.rb +115 -0
- data/spec/exlibris/aleph/table/reader/row/patron_statuses_spec.rb +29 -0
- data/spec/exlibris/aleph/table/reader/row/sub_libraries_spec.rb +41 -0
- data/spec/exlibris/aleph/table/reader/sub_libraries_spec.rb +36 -0
- data/spec/exlibris/aleph/table/sub_libraries_spec.rb +19 -0
- data/spec/exlibris/aleph/tables_manager_spec.rb +120 -0
- data/spec/exlibris/aleph_spec.rb +5 -0
- data/spec/spec_helper.rb +27 -0
- data/spec/support/mnt/aleph_tab/adm50/tab/filename +0 -0
- data/{test → spec/support}/mnt/aleph_tab/alephe/tab/tab_sub_library.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/pc_tab_exp_field_extended.eng +0 -0
- data/{test/mnt/aleph_tab → spec/support/mnt/aleph_tab/nyu50/tab}/tab15.eng +2 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab16 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab31 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab37 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab40.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab_www_item_desc.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/pc_tab_exp_field_extended.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab15.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab16 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab31 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab37 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab40.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab_www_item_desc.eng +0 -0
- data/spec/vcr_cassettes/patron.yml +1443 -0
- data/spec/vcr_cassettes/record.yml +763 -0
- metadata +351 -165
- data/lib/exlibris/aleph/abstract.rb +0 -28
- data/lib/exlibris/aleph/rest/base.rb +0 -56
- data/lib/exlibris/aleph/tab_helper.rb +0 -303
- data/lib/exlibris/aleph/tabs_parser/base.rb +0 -49
- data/lib/exlibris/aleph/tabs_parser/pc_tab_exp_field_extended.rb +0 -20
- data/lib/exlibris/aleph/tabs_parser/sub_library.rb +0 -32
- data/lib/exlibris/aleph/tabs_parser/tab15_by_item_process_status.rb +0 -33
- data/lib/exlibris/aleph/tabs_parser/tab15_by_item_status.rb +0 -33
- data/lib/exlibris/aleph/tabs_parser/tab31.rb +0 -39
- data/lib/exlibris/aleph/tabs_parser/tab37.rb +0 -63
- data/lib/exlibris/aleph/tabs_parser/tab40.rb +0 -20
- data/lib/exlibris/aleph/tabs_parser/tab_sub_library.rb +0 -21
- data/lib/exlibris/aleph/tabs_parser/tab_www_item_desc.rb +0 -20
- data/lib/exlibris/aleph/task_installer.rb +0 -25
- data/lib/exlibris/aleph/write_attributes.rb +0 -38
- data/lib/exlibris/aleph/xml_util.rb +0 -50
- data/lib/exlibris/aleph/xservice/bor_auth.rb +0 -47
- data/lib/tasks/exlibris-aleph_tasks.rake +0 -48
- data/test/config/aleph/alephe/sub_libraries.yml +0 -801
- data/test/config/aleph/nyu50/collections.yml +0 -1168
- data/test/config/aleph/nyu50/item_permissions_by_item_process_status.yml +0 -61876
- data/test/config/aleph/nyu50/item_permissions_by_item_status.yml +0 -17319
- data/test/config/aleph/nyu50/items.yml +0 -617
- data/test/config/aleph/nyu50/patron_permissions.yml +0 -19720
- data/test/config/aleph/nyu50/patrons.yml +0 -249
- data/test/config/aleph/nyu50/pickup_locations.yml +0 -2910
- data/test/config/aleph/nyu51/collections.yml +0 -41
- data/test/config/aleph/nyu51/item_permissions_by_item_process_status.yml +0 -7689
- data/test/config/aleph/nyu51/item_permissions_by_item_status.yml +0 -430
- data/test/config/aleph/nyu51/items.yml +0 -617
- data/test/config/aleph/nyu51/patron_permissions.yml +0 -6588
- data/test/config/aleph/nyu51/patrons.yml +0 -237
- data/test/config/aleph/nyu51/pickup_locations.yml +0 -456
- data/test/config_test.rb +0 -24
- data/test/exlibris-aleph_test.rb +0 -7
- data/test/mnt/aleph_tab/nyu50/tab/tab15.eng +0 -4742
- data/test/mnt/aleph_tab/pc_tab_exp_field_extended.eng +0 -158
- data/test/mnt/aleph_tab/tab16 +0 -3792
- data/test/mnt/aleph_tab/tab31 +0 -998
- data/test/mnt/aleph_tab/tab37 +0 -405
- data/test/mnt/aleph_tab/tab40.eng +0 -335
- data/test/mnt/aleph_tab/tab_sub_library.eng +0 -378
- data/test/mnt/aleph_tab/tab_www_item_desc.eng +0 -208
- data/test/patron_test.rb +0 -98
- data/test/record_benchmarks.rb +0 -26
- data/test/record_test.rb +0 -64
- data/test/support/config.yml +0 -2
- data/test/tab_helper_benchmarks.rb +0 -53
- data/test/tab_helper_test.rb +0 -192
- data/test/test_helper.rb +0 -46
- data/test/vcr_cassettes/bor_auth.yml +0 -42
- data/test/vcr_cassettes/patron.yml +0 -142
- data/test/vcr_cassettes/patron_address.yml +0 -45
- data/test/vcr_cassettes/patron_bogus_url.yml +0 -731
- data/test/vcr_cassettes/patron_error.yml +0 -93
- data/test/vcr_cassettes/record.yml +0 -146
- data/test/vcr_cassettes/record_bogus_url.yml +0 -690
- data/test/xservice/bor_auth_test.rb +0 -28
@@ -0,0 +1,128 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Exlibris
|
3
|
+
module Aleph
|
4
|
+
class Patron
|
5
|
+
class CirculationPolicy
|
6
|
+
describe Privileges do
|
7
|
+
let(:row) { double }
|
8
|
+
let(:borrow) { 'Y' }
|
9
|
+
let(:photocopy) { 'Y' }
|
10
|
+
let(:request) { 'Y' }
|
11
|
+
let(:request_multiple) { 'Y' }
|
12
|
+
let(:request_on_shelf) { 'Y' }
|
13
|
+
let(:renew) { 'Y' }
|
14
|
+
let(:book) { 'Y' }
|
15
|
+
let(:rush_cataloging) { 'Y' }
|
16
|
+
before do
|
17
|
+
allow(row).to receive(:borrow).and_return(borrow)
|
18
|
+
allow(row).to receive(:photocopy).and_return(photocopy)
|
19
|
+
allow(row).to receive(:request).and_return(request)
|
20
|
+
allow(row).to receive(:request_multiple).and_return(request_multiple)
|
21
|
+
allow(row).to receive(:request_on_shelf).and_return(request_on_shelf)
|
22
|
+
allow(row).to receive(:renew).and_return(renew)
|
23
|
+
allow(row).to receive(:book).and_return(book)
|
24
|
+
allow(row).to receive(:rush_cataloging).and_return(rush_cataloging)
|
25
|
+
end
|
26
|
+
subject(:privileges) { Privileges.new(row) }
|
27
|
+
it { should be_a Privileges }
|
28
|
+
describe '#borrow' do
|
29
|
+
subject { privileges.borrow }
|
30
|
+
it { should eq borrow }
|
31
|
+
end
|
32
|
+
describe '#can_borrow?' do
|
33
|
+
subject { privileges.can_borrow? }
|
34
|
+
it { should be_true }
|
35
|
+
context 'when the patron cannot borrow' do
|
36
|
+
let(:borrow) { 'N' }
|
37
|
+
it { should be_false }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
describe '#photocopy' do
|
41
|
+
subject { privileges.photocopy }
|
42
|
+
it { should eq photocopy }
|
43
|
+
end
|
44
|
+
describe '#can_photocopy?' do
|
45
|
+
subject { privileges.can_photocopy? }
|
46
|
+
it { should be_true }
|
47
|
+
context 'when the patron cannot photocopy' do
|
48
|
+
let(:photocopy) { 'N' }
|
49
|
+
it { should be_false }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
describe '#request' do
|
53
|
+
subject { privileges.request }
|
54
|
+
it { should eq request }
|
55
|
+
end
|
56
|
+
describe '#can_request?' do
|
57
|
+
subject { privileges.can_request? }
|
58
|
+
it { should be_true }
|
59
|
+
context 'when the patron cannot request' do
|
60
|
+
let(:request) { 'N' }
|
61
|
+
it { should be_false }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
describe '#request_multiple' do
|
65
|
+
subject { privileges.request_multiple }
|
66
|
+
it { should eq request_multiple }
|
67
|
+
end
|
68
|
+
describe '#can_request_multiple?' do
|
69
|
+
subject { privileges.can_request_multiple? }
|
70
|
+
it { should be_true }
|
71
|
+
context 'when the patron cannot request multiple items' do
|
72
|
+
let(:request_multiple) { 'N' }
|
73
|
+
it { should be_false }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
describe '#request_on_shelf' do
|
77
|
+
subject { privileges.request_on_shelf }
|
78
|
+
it { should eq request_on_shelf }
|
79
|
+
end
|
80
|
+
describe '#can_request_on_shelf?' do
|
81
|
+
subject { privileges.can_request_on_shelf? }
|
82
|
+
it { should be_true }
|
83
|
+
context 'when the patron cannot request on shelf items' do
|
84
|
+
let(:request_on_shelf) { 'N' }
|
85
|
+
it { should be_false }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
describe '#renew' do
|
89
|
+
subject { privileges.renew }
|
90
|
+
it { should eq renew }
|
91
|
+
end
|
92
|
+
describe '#can_renew?' do
|
93
|
+
subject { privileges.can_renew? }
|
94
|
+
it { should be_true }
|
95
|
+
context 'when the patron cannot renew items' do
|
96
|
+
let(:renew) { 'N' }
|
97
|
+
it { should be_false }
|
98
|
+
end
|
99
|
+
end
|
100
|
+
describe '#book' do
|
101
|
+
subject { privileges.book }
|
102
|
+
it { should eq book }
|
103
|
+
end
|
104
|
+
describe '#can_book?' do
|
105
|
+
subject { privileges.can_book? }
|
106
|
+
it { should be_true }
|
107
|
+
context 'when the patron cannot book items' do
|
108
|
+
let(:book) { 'N' }
|
109
|
+
it { should be_false }
|
110
|
+
end
|
111
|
+
end
|
112
|
+
describe '#rush_cataloging' do
|
113
|
+
subject { privileges.rush_cataloging }
|
114
|
+
it { should eq rush_cataloging }
|
115
|
+
end
|
116
|
+
describe '#can_rush_cataloging?' do
|
117
|
+
subject { privileges.can_rush_cataloging? }
|
118
|
+
it { should be_true }
|
119
|
+
context 'when the patron cannot rush cataloging' do
|
120
|
+
let(:rush_cataloging) { 'N' }
|
121
|
+
it { should be_false }
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Exlibris
|
3
|
+
module Aleph
|
4
|
+
class Patron
|
5
|
+
describe CirculationPolicy do
|
6
|
+
let(:status) { Status.new('01', 'Patron') }
|
7
|
+
let(:admin_library) { AdminLibrary.new('ADM50') }
|
8
|
+
let(:sub_library) { SubLibrary.new('SUB', 'Sub Library', admin_library) }
|
9
|
+
let(:identifier) { CirculationPolicy::Identifier.new(status, sub_library) }
|
10
|
+
let(:row) { double }
|
11
|
+
let(:borrow) { 'Y' }
|
12
|
+
let(:photocopy) { 'Y' }
|
13
|
+
let(:request) { 'Y' }
|
14
|
+
let(:request_multiple) { 'Y' }
|
15
|
+
let(:request_on_shelf) { 'Y' }
|
16
|
+
let(:renew) { 'Y' }
|
17
|
+
let(:book) { 'Y' }
|
18
|
+
let(:rush_cataloging) { 'Y' }
|
19
|
+
before do
|
20
|
+
allow(row).to receive(:borrow).and_return(borrow)
|
21
|
+
allow(row).to receive(:photocopy).and_return(photocopy)
|
22
|
+
allow(row).to receive(:request).and_return(borrow)
|
23
|
+
allow(row).to receive(:request_multiple).and_return(borrow)
|
24
|
+
allow(row).to receive(:request_on_shelf).and_return(borrow)
|
25
|
+
allow(row).to receive(:renew).and_return(borrow)
|
26
|
+
allow(row).to receive(:book).and_return(borrow)
|
27
|
+
allow(row).to receive(:rush_cataloging).and_return(borrow)
|
28
|
+
end
|
29
|
+
let(:privileges) { CirculationPolicy::Privileges.new(row) }
|
30
|
+
subject(:circulation_policy) { CirculationPolicy.new(identifier, privileges) }
|
31
|
+
it { should be_a CirculationPolicy }
|
32
|
+
describe '#identifier' do
|
33
|
+
subject { circulation_policy.identifier }
|
34
|
+
it { should eq identifier }
|
35
|
+
end
|
36
|
+
describe '#privileges' do
|
37
|
+
subject { circulation_policy.privileges }
|
38
|
+
it { should eq privileges }
|
39
|
+
end
|
40
|
+
describe '#==' do
|
41
|
+
subject { circulation_policy == other_object }
|
42
|
+
context 'when the other object is an Patron::CirculationPolicy' do
|
43
|
+
let(:other_identifier) { identifier }
|
44
|
+
let(:other_privileges) { privileges }
|
45
|
+
let(:other_object) { CirculationPolicy.new(other_identifier, other_privileges) }
|
46
|
+
context 'but the identifier of the other object is different' do
|
47
|
+
let(:other_status) { Status.new('02', 'Patron') }
|
48
|
+
let(:other_identifier) { CirculationPolicy::Identifier.new(other_status, sub_library) }
|
49
|
+
it { should be_false }
|
50
|
+
end
|
51
|
+
context 'and the identifier of the other object is the same' do
|
52
|
+
it { should be_true }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
context 'when the other object is not an Patron::CirculationPolicy' do
|
56
|
+
let(:other_object) { "invalid" }
|
57
|
+
it { should be_false }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
describe '#===' do
|
61
|
+
subject { circulation_policy === other_object }
|
62
|
+
context 'when the other object is an Patron::CirculationPolicy' do
|
63
|
+
let(:other_identifier) { identifier }
|
64
|
+
let(:other_privileges) { privileges }
|
65
|
+
let(:other_object) { CirculationPolicy.new(other_identifier, other_privileges) }
|
66
|
+
context 'but the identifier of the other object is different' do
|
67
|
+
let(:other_status) { Status.new('02', 'Patron') }
|
68
|
+
let(:other_identifier) { CirculationPolicy::Identifier.new(other_status, sub_library) }
|
69
|
+
it { should be_false }
|
70
|
+
end
|
71
|
+
context 'and the identifier of the other object is the same' do
|
72
|
+
it { should be_true }
|
73
|
+
end
|
74
|
+
end
|
75
|
+
context 'when the other object is not an Patron::CirculationPolicy' do
|
76
|
+
let(:other_object) { "invalid" }
|
77
|
+
it { should be_false }
|
78
|
+
end
|
79
|
+
end
|
80
|
+
describe '#eql?' do
|
81
|
+
subject { circulation_policy.eql?(other_object) }
|
82
|
+
context 'when the other object is an Patron::CirculationPolicy' do
|
83
|
+
let(:other_identifier) { identifier }
|
84
|
+
let(:other_privileges) { privileges }
|
85
|
+
let(:other_object) { CirculationPolicy.new(other_identifier, other_privileges) }
|
86
|
+
context 'but the identifier of the other object is different' do
|
87
|
+
let(:other_status) { Status.new('02', 'Patron') }
|
88
|
+
let(:other_identifier) { CirculationPolicy::Identifier.new(other_status, sub_library) }
|
89
|
+
it { should be_false }
|
90
|
+
end
|
91
|
+
context 'and the identifier of the other object is the same' do
|
92
|
+
it { should be_true }
|
93
|
+
end
|
94
|
+
end
|
95
|
+
context 'when the other object is not an Patron::CirculationPolicy' do
|
96
|
+
let(:other_object) { "invalid" }
|
97
|
+
it { should be_false }
|
98
|
+
end
|
99
|
+
end
|
100
|
+
context 'when initialized with arguments' do
|
101
|
+
context 'but the "identifier" argument is not an Patron::CirculationPolicy::Identifier' do
|
102
|
+
let(:identifier) { "invalid" }
|
103
|
+
it 'should raise an ArgumentError' do
|
104
|
+
expect { subject }.to raise_error ArgumentError
|
105
|
+
end
|
106
|
+
end
|
107
|
+
context 'and the "identifier" argument is an Patron::CirculationPolicy::Identifier' do
|
108
|
+
context 'but the "privileges" argument is not a Patron::CirculationPolicy::Privileges' do
|
109
|
+
let(:privileges) { "invalid" }
|
110
|
+
it 'should raise an ArgumentError' do
|
111
|
+
expect { subject }.to raise_error ArgumentError
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Exlibris
|
3
|
+
module Aleph
|
4
|
+
class Patron
|
5
|
+
class Record
|
6
|
+
class CirculationPolicy
|
7
|
+
describe Privileges do
|
8
|
+
let(:hold_request) { 'N' }
|
9
|
+
let(:short_loan) { 'N' }
|
10
|
+
let(:ill) { 'N' }
|
11
|
+
let(:booking_request) { 'N' }
|
12
|
+
let(:acquisition_request) { 'N' }
|
13
|
+
let(:arg) { double }
|
14
|
+
before do
|
15
|
+
allow(arg).to receive(:hold_request).and_return(hold_request)
|
16
|
+
allow(arg).to receive(:short_loan).and_return(short_loan)
|
17
|
+
allow(arg).to receive(:ill).and_return(ill)
|
18
|
+
allow(arg).to receive(:booking_request).and_return(booking_request)
|
19
|
+
allow(arg).to receive(:acquisition_request).and_return(acquisition_request)
|
20
|
+
end
|
21
|
+
subject(:privileges) { Privileges.new(arg) }
|
22
|
+
it { should be_a Privileges }
|
23
|
+
describe '#hold_request' do
|
24
|
+
subject { privileges.hold_request }
|
25
|
+
it { should eq 'N' }
|
26
|
+
end
|
27
|
+
describe '#hold_request?' do
|
28
|
+
subject { privileges.hold_request? }
|
29
|
+
it { should be_false }
|
30
|
+
context 'when the hold request value is "Y"' do
|
31
|
+
let(:hold_request) { 'Y' }
|
32
|
+
it { should be_true }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe '#short_loan' do
|
36
|
+
subject { privileges.short_loan }
|
37
|
+
it { should eq 'N' }
|
38
|
+
end
|
39
|
+
describe '#short_loan?' do
|
40
|
+
subject { privileges.short_loan? }
|
41
|
+
it { should be_false }
|
42
|
+
context 'when the short loan value is "Y"' do
|
43
|
+
let(:short_loan) { 'Y' }
|
44
|
+
it { should be_true }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
describe '#ill' do
|
48
|
+
subject { privileges.ill }
|
49
|
+
it { should eq 'N' }
|
50
|
+
end
|
51
|
+
describe '#ill?' do
|
52
|
+
subject { privileges.ill? }
|
53
|
+
it { should be_false }
|
54
|
+
context 'when the ill value is "Y"' do
|
55
|
+
let(:ill) { 'Y' }
|
56
|
+
it { should be_true }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
describe '#booking_request' do
|
60
|
+
subject { privileges.booking_request }
|
61
|
+
it { should eq 'N' }
|
62
|
+
end
|
63
|
+
describe '#booking_request?' do
|
64
|
+
subject { privileges.booking_request? }
|
65
|
+
it { should be_false }
|
66
|
+
context 'when the booking request value is "Y"' do
|
67
|
+
let(:booking_request) { 'Y' }
|
68
|
+
it { should be_true }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
describe '#acquisition_request' do
|
72
|
+
subject { privileges.acquisition_request }
|
73
|
+
it { should eq 'N' }
|
74
|
+
end
|
75
|
+
describe '#acquisition_request?' do
|
76
|
+
subject { privileges.acquisition_request? }
|
77
|
+
it { should be_false }
|
78
|
+
context 'when the acquisition request value is "Y"' do
|
79
|
+
let(:acquisition_request) { 'Y' }
|
80
|
+
it { should be_true }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Exlibris
|
3
|
+
module Aleph
|
4
|
+
class Patron
|
5
|
+
class Record
|
6
|
+
describe CirculationPolicy do
|
7
|
+
let(:hold_request) { 'N' }
|
8
|
+
let(:short_loan) { 'N' }
|
9
|
+
let(:ill) { 'N' }
|
10
|
+
let(:booking_request) { 'N' }
|
11
|
+
let(:acquisition_request) { 'N' }
|
12
|
+
let(:arg) { double }
|
13
|
+
before do
|
14
|
+
allow(arg).to receive(:hold_request).and_return(hold_request)
|
15
|
+
allow(arg).to receive(:short_loan).and_return(short_loan)
|
16
|
+
allow(arg).to receive(:ill).and_return(ill)
|
17
|
+
allow(arg).to receive(:booking_request).and_return(booking_request)
|
18
|
+
allow(arg).to receive(:acquisition_request).and_return(acquisition_request)
|
19
|
+
end
|
20
|
+
let(:privileges) { CirculationPolicy::Privileges.new(arg) }
|
21
|
+
subject(:circulation_policy) { CirculationPolicy.new(privileges) }
|
22
|
+
it { should be_a CirculationPolicy }
|
23
|
+
describe '#privileges' do
|
24
|
+
subject { circulation_policy.privileges }
|
25
|
+
it { should eq privileges }
|
26
|
+
end
|
27
|
+
context 'when the privileges argument is not a CirculationPolicy::Privileges' do
|
28
|
+
let(:privileges) { 'invalid' }
|
29
|
+
it 'should raise an ArgumentError' do
|
30
|
+
expect { subject }.to raise_error ArgumentError
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module Exlibris
|
3
|
+
module Aleph
|
4
|
+
class Patron
|
5
|
+
class Record
|
6
|
+
class Item
|
7
|
+
class CirculationPolicy
|
8
|
+
describe Privileges do
|
9
|
+
let(:hold_request) { 'N' }
|
10
|
+
let(:short_loan) { 'N' }
|
11
|
+
let(:photocopy_request) { 'N' }
|
12
|
+
let(:booking_request) { 'N' }
|
13
|
+
let(:arg) { double }
|
14
|
+
before do
|
15
|
+
allow(arg).to receive(:hold_request).and_return(hold_request)
|
16
|
+
allow(arg).to receive(:short_loan).and_return(short_loan)
|
17
|
+
allow(arg).to receive(:photocopy_request).and_return(photocopy_request)
|
18
|
+
allow(arg).to receive(:booking_request).and_return(booking_request)
|
19
|
+
end
|
20
|
+
subject(:privileges) { Privileges.new(arg) }
|
21
|
+
it { should be_a Privileges }
|
22
|
+
describe '#hold_request' do
|
23
|
+
subject { privileges.hold_request }
|
24
|
+
it { should eq 'N' }
|
25
|
+
end
|
26
|
+
describe '#hold_request?' do
|
27
|
+
subject { privileges.hold_request? }
|
28
|
+
it { should be_false }
|
29
|
+
context 'when the hold request value is "Y"' do
|
30
|
+
let(:hold_request) { 'Y' }
|
31
|
+
it { should be_true }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
describe '#short_loan' do
|
35
|
+
subject { privileges.short_loan }
|
36
|
+
it { should eq 'N' }
|
37
|
+
end
|
38
|
+
describe '#short_loan?' do
|
39
|
+
subject { privileges.short_loan? }
|
40
|
+
it { should be_false }
|
41
|
+
context 'when the short loan value is "Y"' do
|
42
|
+
let(:short_loan) { 'Y' }
|
43
|
+
it { should be_true }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
describe '#photocopy_request' do
|
47
|
+
subject { privileges.photocopy_request }
|
48
|
+
it { should eq 'N' }
|
49
|
+
end
|
50
|
+
describe '#photocopy_request?' do
|
51
|
+
subject { privileges.photocopy_request? }
|
52
|
+
it { should be_false }
|
53
|
+
context 'when the photocopy request value is "Y"' do
|
54
|
+
let(:photocopy_request) { 'Y' }
|
55
|
+
it { should be_true }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
describe '#booking_request' do
|
59
|
+
subject { privileges.booking_request }
|
60
|
+
it { should eq 'N' }
|
61
|
+
end
|
62
|
+
describe '#booking_request?' do
|
63
|
+
subject { privileges.booking_request? }
|
64
|
+
it { should be_false }
|
65
|
+
context 'when the booking request value is "Y"' do
|
66
|
+
let(:booking_request) { 'Y' }
|
67
|
+
it { should be_true }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|