berkeley_library-alma 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,266 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?><searchRetrieveResponse xmlns="http://www.loc.gov/zing/srw/">
2
+ <version>1.2</version>
3
+ <numberOfRecords>15</numberOfRecords>
4
+ <records>
5
+ <record>
6
+ <recordSchema>marcxml</recordSchema>
7
+ <recordPacking>xml</recordPacking>
8
+ <recordData>
9
+ <record xmlns="http://www.loc.gov/MARC21/slim">
10
+ <leader>00338nam a2200097 a 4500</leader>
11
+ <controlfield tag="001">991008719659706532</controlfield>
12
+ <controlfield tag="008">^^</controlfield>
13
+ <datafield ind1=" " ind2=" " tag="035">
14
+ <subfield code="a">(CUY)UCB-b214199459-01ucs_ber</subfield>
15
+ </datafield>
16
+ <datafield ind1="1" ind2=" " tag="100">
17
+ <subfield code="a">Kelly, Ellsworth,</subfield>
18
+ <subfield code="d">1923-2015</subfield>
19
+ </datafield>
20
+ <datafield ind1="1" ind2="0" tag="245">
21
+ <subfield code="a">Red-orange over blue</subfield>
22
+ <subfield code="h">[graphic]</subfield>
23
+ </datafield>
24
+ <datafield ind1="1" ind2="0" tag="245">
25
+ <subfield code="a">Rouge-Orange sur Bleu</subfield>
26
+ </datafield>
27
+ <datafield ind1=" " ind2=" " tag="300">
28
+ <subfield code="a">1 lithograph :</subfield>
29
+ <subfield code="b">col.</subfield>
30
+ </datafield>
31
+ <datafield ind1=" " ind2=" " tag="996">
32
+ <subfield code="a">b214199459</subfield>
33
+ <subfield code="b">Updated: 08-14-18</subfield>
34
+ <subfield code="c">Created: 07-09-14</subfield>
35
+ <subfield code="d">CatDate: - -</subfield>
36
+ <subfield code="9">LOCAL</subfield>
37
+ </datafield>
38
+ <datafield ind1=" " ind2=" " tag="AVA">
39
+ <subfield code="0">991008719659706532</subfield>
40
+ <subfield code="8">22721557370006532</subfield>
41
+ <subfield code="a">01UCS_BER</subfield>
42
+ <subfield code="b">MORR</subfield>
43
+ <subfield code="c">Morrison</subfield>
44
+ <subfield code="e">available</subfield>
45
+ <subfield code="f">1</subfield>
46
+ <subfield code="g">0</subfield>
47
+ <subfield code="i">UCB_Campus</subfield>
48
+ <subfield code="j">mo</subfield>
49
+ <subfield code="k">#</subfield>
50
+ <subfield code="p">1</subfield>
51
+ <subfield code="q">Morrison Library</subfield>
52
+ </datafield>
53
+ </record>
54
+ </recordData>
55
+ <recordIdentifier>991008719659706532</recordIdentifier>
56
+ <recordPosition>11</recordPosition>
57
+ </record>
58
+ <record>
59
+ <recordSchema>marcxml</recordSchema>
60
+ <recordPacking>xml</recordPacking>
61
+ <recordData>
62
+ <record xmlns="http://www.loc.gov/MARC21/slim">
63
+ <leader>00273nam a2200085 a 4500</leader>
64
+ <controlfield tag="001">991005668209706532</controlfield>
65
+ <controlfield tag="008">^^</controlfield>
66
+ <datafield ind1=" " ind2=" " tag="035">
67
+ <subfield code="a">(CUY)UCB-b207766708-01ucs_ber</subfield>
68
+ </datafield>
69
+ <datafield ind1="1" ind2=" " tag="100">
70
+ <subfield code="a">Beutlich, Tadek.</subfield>
71
+ </datafield>
72
+ <datafield ind1="1" ind2="0" tag="245">
73
+ <subfield code="a">River</subfield>
74
+ <subfield code="h">[graphic]</subfield>
75
+ </datafield>
76
+ <datafield ind1=" " ind2=" " tag="300">
77
+ <subfield code="a">1 lithograph :</subfield>
78
+ <subfield code="b">col.</subfield>
79
+ </datafield>
80
+ <datafield ind1=" " ind2=" " tag="996">
81
+ <subfield code="a">b207766708</subfield>
82
+ <subfield code="b">Updated: 11-01-13</subfield>
83
+ <subfield code="c">Created: 11-01-13</subfield>
84
+ <subfield code="d">CatDate: - -</subfield>
85
+ <subfield code="9">LOCAL</subfield>
86
+ </datafield>
87
+ <datafield ind1=" " ind2=" " tag="AVA">
88
+ <subfield code="0">991005668209706532</subfield>
89
+ <subfield code="8">22928389410006532</subfield>
90
+ <subfield code="a">01UCS_BER</subfield>
91
+ <subfield code="b">MORR</subfield>
92
+ <subfield code="c">Morrison</subfield>
93
+ <subfield code="e">available</subfield>
94
+ <subfield code="f">1</subfield>
95
+ <subfield code="g">0</subfield>
96
+ <subfield code="i">UCB_Campus</subfield>
97
+ <subfield code="j">mo</subfield>
98
+ <subfield code="k">#</subfield>
99
+ <subfield code="p">1</subfield>
100
+ <subfield code="q">Morrison Library</subfield>
101
+ </datafield>
102
+ </record>
103
+ </recordData>
104
+ <recordIdentifier>991005668209706532</recordIdentifier>
105
+ <recordPosition>12</recordPosition>
106
+ </record>
107
+ <record>
108
+ <recordSchema>marcxml</recordSchema>
109
+ <recordPacking>xml</recordPacking>
110
+ <recordData>
111
+ <record xmlns="http://www.loc.gov/MARC21/slim">
112
+ <leader>00340nam a2200097 a 4500</leader>
113
+ <controlfield tag="001">991008363529706532</controlfield>
114
+ <controlfield tag="008">^^</controlfield>
115
+ <datafield ind1=" " ind2=" " tag="035">
116
+ <subfield code="a">(CUY)UCB-b213512956-01ucs_ber</subfield>
117
+ </datafield>
118
+ <datafield ind1="1" ind2=" " tag="100">
119
+ <subfield code="a">Wang, Gai.</subfield>
120
+ </datafield>
121
+ <datafield ind1="1" ind2="0" tag="245">
122
+ <subfield code="a">Rock with butterfly</subfield>
123
+ <subfield code="h">[graphic]</subfield>
124
+ </datafield>
125
+ <datafield ind1=" " ind2=" " tag="300">
126
+ <subfield code="a">1 woodblock print :</subfield>
127
+ <subfield code="b">col.</subfield>
128
+ </datafield>
129
+ <datafield ind1="0" ind2=" " tag="740">
130
+ <subfield code="a">Mustard seed garden painting manual</subfield>
131
+ </datafield>
132
+ <datafield ind1=" " ind2=" " tag="996">
133
+ <subfield code="a">b213512956</subfield>
134
+ <subfield code="b">Updated: 06-06-14</subfield>
135
+ <subfield code="c">Created: 06-05-14</subfield>
136
+ <subfield code="d">CatDate: - -</subfield>
137
+ <subfield code="9">LOCAL</subfield>
138
+ </datafield>
139
+ <datafield ind1=" " ind2=" " tag="AVA">
140
+ <subfield code="0">991008363529706532</subfield>
141
+ <subfield code="8">22703998890006532</subfield>
142
+ <subfield code="a">01UCS_BER</subfield>
143
+ <subfield code="b">MORR</subfield>
144
+ <subfield code="c">Morrison</subfield>
145
+ <subfield code="e">available</subfield>
146
+ <subfield code="f">1</subfield>
147
+ <subfield code="g">0</subfield>
148
+ <subfield code="i">UCB_Campus</subfield>
149
+ <subfield code="j">mo</subfield>
150
+ <subfield code="k">#</subfield>
151
+ <subfield code="p">1</subfield>
152
+ <subfield code="q">Morrison Library</subfield>
153
+ </datafield>
154
+ </record>
155
+ </recordData>
156
+ <recordIdentifier>991008363529706532</recordIdentifier>
157
+ <recordPosition>13</recordPosition>
158
+ </record>
159
+ <record>
160
+ <recordSchema>marcxml</recordSchema>
161
+ <recordPacking>xml</recordPacking>
162
+ <recordData>
163
+ <record xmlns="http://www.loc.gov/MARC21/slim">
164
+ <leader>00337nam a2200097 a 4500</leader>
165
+ <controlfield tag="001">991008402049706532</controlfield>
166
+ <controlfield tag="008">^^</controlfield>
167
+ <datafield ind1=" " ind2=" " tag="035">
168
+ <subfield code="a">(CUY)UCB-b213523097-01ucs_ber</subfield>
169
+ </datafield>
170
+ <datafield ind1="1" ind2=" " tag="100">
171
+ <subfield code="a">Wang, Gai.</subfield>
172
+ </datafield>
173
+ <datafield ind1="1" ind2="0" tag="245">
174
+ <subfield code="a">Rock with sparrows</subfield>
175
+ <subfield code="h">[graphic]</subfield>
176
+ </datafield>
177
+ <datafield ind1=" " ind2=" " tag="300">
178
+ <subfield code="a">1 woodblock print :</subfield>
179
+ <subfield code="b">col.</subfield>
180
+ </datafield>
181
+ <datafield ind1="0" ind2=" " tag="740">
182
+ <subfield code="a">Mustard seed garden painting manual</subfield>
183
+ </datafield>
184
+ <datafield ind1=" " ind2=" " tag="996">
185
+ <subfield code="a">b213523097</subfield>
186
+ <subfield code="b">Updated: 06-06-14</subfield>
187
+ <subfield code="c">Created: 06-06-14</subfield>
188
+ <subfield code="d">CatDate: - -</subfield>
189
+ <subfield code="9">LOCAL</subfield>
190
+ </datafield>
191
+ <datafield ind1=" " ind2=" " tag="AVA">
192
+ <subfield code="0">991008402049706532</subfield>
193
+ <subfield code="8">22871109920006532</subfield>
194
+ <subfield code="a">01UCS_BER</subfield>
195
+ <subfield code="b">MORR</subfield>
196
+ <subfield code="c">Morrison</subfield>
197
+ <subfield code="e">available</subfield>
198
+ <subfield code="f">1</subfield>
199
+ <subfield code="g">0</subfield>
200
+ <subfield code="i">UCB_Campus</subfield>
201
+ <subfield code="j">mo</subfield>
202
+ <subfield code="k">#</subfield>
203
+ <subfield code="p">1</subfield>
204
+ <subfield code="q">Morrison Library</subfield>
205
+ </datafield>
206
+ </record>
207
+ </recordData>
208
+ <recordIdentifier>991008402049706532</recordIdentifier>
209
+ <recordPosition>14</recordPosition>
210
+ </record>
211
+ <record>
212
+ <recordSchema>marcxml</recordSchema>
213
+ <recordPacking>xml</recordPacking>
214
+ <recordData>
215
+ <record xmlns="http://www.loc.gov/MARC21/slim">
216
+ <leader>00292nam a2200085 a 4500</leader>
217
+ <controlfield tag="001">991008719819706532</controlfield>
218
+ <controlfield tag="008">^^</controlfield>
219
+ <datafield ind1=" " ind2=" " tag="035">
220
+ <subfield code="a">(CUY)UCB-b214199502-01ucs_ber</subfield>
221
+ </datafield>
222
+ <datafield ind1="1" ind2=" " tag="100">
223
+ <subfield code="a">Saitō, Kiyoshi,</subfield>
224
+ <subfield code="d">1907-1997.</subfield>
225
+ </datafield>
226
+ <datafield ind1="1" ind2="0" tag="245">
227
+ <subfield code="a">Ryoan-ji, Kyoto</subfield>
228
+ <subfield code="h">[graphic]</subfield>
229
+ </datafield>
230
+ <datafield ind1=" " ind2=" " tag="300">
231
+ <subfield code="a">1 woodcut :</subfield>
232
+ <subfield code="b">col.</subfield>
233
+ </datafield>
234
+ <datafield ind1=" " ind2=" " tag="996">
235
+ <subfield code="a">b214199502</subfield>
236
+ <subfield code="b">Updated: 05-15-17</subfield>
237
+ <subfield code="c">Created: 07-09-14</subfield>
238
+ <subfield code="d">CatDate: - -</subfield>
239
+ <subfield code="9">LOCAL</subfield>
240
+ </datafield>
241
+ <datafield ind1=" " ind2=" " tag="AVA">
242
+ <subfield code="0">991008719819706532</subfield>
243
+ <subfield code="8">22892415050006532</subfield>
244
+ <subfield code="a">01UCS_BER</subfield>
245
+ <subfield code="b">MORR</subfield>
246
+ <subfield code="c">Morrison</subfield>
247
+ <subfield code="e">available</subfield>
248
+ <subfield code="f">1</subfield>
249
+ <subfield code="g">0</subfield>
250
+ <subfield code="i">UCB_Campus</subfield>
251
+ <subfield code="j">mo</subfield>
252
+ <subfield code="k">#</subfield>
253
+ <subfield code="p">1</subfield>
254
+ <subfield code="q">Morrison Library</subfield>
255
+ </datafield>
256
+ </record>
257
+ </recordData>
258
+ <recordIdentifier>991008719819706532</recordIdentifier>
259
+ <recordPosition>15</recordPosition>
260
+ </record>
261
+ </records>
262
+ <extraResponseData xmlns:xb="http://www.exlibris.com/repository/search/xmlbeans/">
263
+ <xb:exact>true</xb:exact>
264
+ <xb:responseDate>2022-05-05T12:53:30-0700</xb:responseDate>
265
+ </extraResponseData>
266
+ </searchRetrieveResponse>
@@ -0,0 +1,98 @@
1
+ require 'spec_helper'
2
+
3
+ module BerkeleyLibrary
4
+ module Alma
5
+ describe SRU do
6
+ before { Config.default! }
7
+ after { Config.send(:clear!) }
8
+
9
+ describe :get_marc_records do
10
+ describe 'unpaginated' do
11
+ let(:mms_ids) { %w[991005668209706532 991005668359706532] }
12
+
13
+ before do
14
+ sru_query_value = mms_ids.map { |id| RecordId.parse(id) }.map(&:sru_query_value).join(' or ')
15
+ sru_query_uri = SRU.sru_query_uri(sru_query_value)
16
+ stub_request(:get, sru_query_uri).to_return(body: File.read('spec/data/availability-sru.xml'))
17
+ end
18
+
19
+ it 'returns all MARC records' do
20
+ reader = SRU.get_marc_records(*mms_ids)
21
+ marc_records = reader.to_a
22
+ expect(marc_records.size).to eq(mms_ids.size)
23
+ expect(marc_records.map(&:record_id)).to contain_exactly(*mms_ids)
24
+ end
25
+ end
26
+
27
+ describe 'paginated' do
28
+ let(:mms_ids) do
29
+ %w[
30
+ 991005668209706532
31
+ 991005668359706532
32
+ 991005930379706532
33
+ 991005931249706532
34
+ 991007853589706532
35
+ 991007902439706532
36
+ 991007903029706532
37
+ 991008363529706532
38
+ 991008364649706532
39
+ 991008401919706532
40
+ 991008402049706532
41
+ 991008718379706532
42
+ 991008719659706532
43
+ 991008719819706532
44
+ 991009071149706532
45
+ ]
46
+ end
47
+
48
+ let(:sru_query_value) { mms_ids.map { |id| RecordId.parse(id) }.map(&:sru_query_value).join(' or ') }
49
+ let(:query_uri_page_1) { SRU.sru_query_uri(sru_query_value) }
50
+ let(:query_uri_page_2) { BerkeleyLibrary::Util::URIs.append(query_uri_page_1, '&startRecord=11') }
51
+
52
+ before do
53
+ stub_request(:get, query_uri_page_1).to_return(body: File.read('spec/data/availability-sru-page-1.xml'))
54
+ end
55
+
56
+ it 'returns all the MARC records' do
57
+ stub_request(:get, query_uri_page_2).to_return(body: File.read('spec/data/availability-sru-page-2.xml'))
58
+
59
+ reader = SRU.get_marc_records(*mms_ids)
60
+ marc_records = reader.to_a
61
+ expect(marc_records.size).to eq(mms_ids.size)
62
+ expect(marc_records.map(&:record_id)).to contain_exactly(*mms_ids)
63
+ end
64
+
65
+ it 'does not freeze records by default' do
66
+ stub_request(:get, query_uri_page_2).to_return(body: File.read('spec/data/availability-sru-page-2.xml'))
67
+
68
+ reader = SRU.get_marc_records(*mms_ids)
69
+ reader.to_a.each do |record|
70
+ expect(record.frozen?).to eq(false)
71
+ end
72
+ end
73
+
74
+ it 'can freeze records' do
75
+ stub_request(:get, query_uri_page_2).to_return(body: File.read('spec/data/availability-sru-page-2.xml'))
76
+
77
+ reader = SRU.get_marc_records(*mms_ids, freeze: true)
78
+ reader.to_a.each do |record|
79
+ expect(record.frozen?).to eq(true)
80
+ end
81
+ end
82
+
83
+ it 'is lazy' do
84
+ reader = SRU.get_marc_records(*mms_ids)
85
+ marc_records = reader.take(10).to_a
86
+ expect(marc_records.size).to eq(10)
87
+ retrieved_ids = marc_records.map(&:record_id).uniq
88
+ expect(retrieved_ids.size).to eq(10)
89
+
90
+ # order is not guaranteed, so we don't necessarily get the first 10
91
+ retrieved_ids.each { |id| expect(mms_ids).to include(id) }
92
+ end
93
+
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,75 @@
1
+ require 'spec_helper'
2
+
3
+ module BerkeleyLibrary
4
+ module Alma
5
+ module SRU
6
+ describe XMLReader do
7
+ let(:sru_xml_1) { File.read('spec/data/availability-sru-page-1.xml') }
8
+ let(:sru_xml_2) { File.read('spec/data/availability-sru-page-2.xml') }
9
+
10
+ let(:reader) { XMLReader.read(sru_xml_2) }
11
+ let(:expected_ids) { %w[991008719659706532 991005668209706532 991008363529706532 991008402049706532 991008719819706532] }
12
+
13
+ it 'reads the records' do
14
+ records = reader.to_a
15
+ expect(records.size).to eq(expected_ids.size)
16
+ expect(records.map(&:record_id)).to eq(expected_ids)
17
+ end
18
+
19
+ describe :new do
20
+ it 'raises an error for unreadable sources' do
21
+ not_xml = Object.new
22
+ expect { XMLReader.read(not_xml) }.to raise_error(ArgumentError)
23
+ end
24
+ end
25
+
26
+ describe :num_records do
27
+ it 'returns the <numberOfRecords/> value' do
28
+ reader.first # make sure we've gotten far enough in the doc to parse
29
+ expect(reader.num_records).to eq(15)
30
+ end
31
+ end
32
+
33
+ describe :last_record_position do
34
+ it 'returns the (1-indexed) position of the most recent record' do
35
+ position_base = 11
36
+ reader.each_with_index do |_, i|
37
+ expect(reader.last_record_position).to eq(position_base + i)
38
+ end
39
+ end
40
+ end
41
+
42
+ describe :last_record_id do
43
+ it 'returns the ID of the most recent record' do
44
+ reader.each do |record|
45
+ expect(reader.last_record_id).to eq(record.record_id)
46
+ end
47
+ end
48
+ end
49
+
50
+ describe :next_record_position do
51
+ it 'returns nil if there is no next page' do
52
+ reader.to_a # read all records
53
+ expect(reader.next_record_position).to be_nil
54
+ end
55
+
56
+ it 'returns the record position of the next page' do
57
+ reader = XMLReader.read(sru_xml_1)
58
+ reader.to_a # read all records
59
+ expect(reader.next_record_position).to eq(11)
60
+ end
61
+ end
62
+
63
+ describe :records_yielded do
64
+ it 'returns the number of records yielded' do
65
+ expect(reader.records_yielded).to eq(0)
66
+ reader.each_with_index do |_, i|
67
+ expect(reader.records_yielded).to eq(i)
68
+ end
69
+ expect(reader.records_yielded).to eq(5)
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berkeley_library-alma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Moles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-04 00:00:00.000000000 Z
11
+ date: 2022-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: berkeley_library-logging
@@ -47,7 +47,7 @@ dependencies:
47
47
  version: '0.1'
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
- version: 0.1.1
50
+ version: 0.1.2
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -57,7 +57,7 @@ dependencies:
57
57
  version: '0.1'
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: 0.1.1
60
+ version: 0.1.2
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: nokogiri
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -277,6 +277,8 @@ files:
277
277
  - lib/berkeley_library/alma/module_info.rb
278
278
  - lib/berkeley_library/alma/record_id.rb
279
279
  - lib/berkeley_library/alma/sru.rb
280
+ - lib/berkeley_library/alma/sru/sru.rb
281
+ - lib/berkeley_library/alma/sru/xml_reader.rb
280
282
  - rakelib/bundle.rake
281
283
  - rakelib/coverage.rake
282
284
  - rakelib/gem.rake
@@ -285,6 +287,8 @@ files:
285
287
  - spec/.rubocop.yml
286
288
  - spec/data/991054360089706532-sru.xml
287
289
  - spec/data/C084093187-sru.xml
290
+ - spec/data/availability-sru-page-1.xml
291
+ - spec/data/availability-sru-page-2.xml
288
292
  - spec/data/availability-sru.xml
289
293
  - spec/data/b110824349-sru.xml
290
294
  - spec/data/bibs_with_check_digits.txt
@@ -293,7 +297,8 @@ files:
293
297
  - spec/lib/berkeley_library/alma/config_spec.rb
294
298
  - spec/lib/berkeley_library/alma/mms_id_spec.rb
295
299
  - spec/lib/berkeley_library/alma/record_id_spec.rb
296
- - spec/lib/berkeley_library/alma/sru_spec.rb
300
+ - spec/lib/berkeley_library/alma/sru/sru_spec.rb
301
+ - spec/lib/berkeley_library/alma/sru/xml_reader_spec.rb
297
302
  - spec/spec_helper.rb
298
303
  homepage: https://github.com/BerkeleyLibrary/alma
299
304
  licenses:
@@ -322,6 +327,8 @@ test_files:
322
327
  - spec/.rubocop.yml
323
328
  - spec/data/991054360089706532-sru.xml
324
329
  - spec/data/C084093187-sru.xml
330
+ - spec/data/availability-sru-page-1.xml
331
+ - spec/data/availability-sru-page-2.xml
325
332
  - spec/data/availability-sru.xml
326
333
  - spec/data/b110824349-sru.xml
327
334
  - spec/data/bibs_with_check_digits.txt
@@ -330,5 +337,6 @@ test_files:
330
337
  - spec/lib/berkeley_library/alma/config_spec.rb
331
338
  - spec/lib/berkeley_library/alma/mms_id_spec.rb
332
339
  - spec/lib/berkeley_library/alma/record_id_spec.rb
333
- - spec/lib/berkeley_library/alma/sru_spec.rb
340
+ - spec/lib/berkeley_library/alma/sru/sru_spec.rb
341
+ - spec/lib/berkeley_library/alma/sru/xml_reader_spec.rb
334
342
  - spec/spec_helper.rb
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module BerkeleyLibrary
4
- module Alma
5
- describe SRU do
6
- before { Config.default! }
7
- after { Config.send(:clear!) }
8
-
9
- describe :get_marc_records do
10
- let(:mms_ids) { %w[991005668209706532 991005668359706532] }
11
-
12
- before do
13
- sru_query_value = mms_ids.map { |id| RecordId.parse(id) }.map(&:sru_query_value).join(' or ')
14
- sru_query_uri = SRU.sru_query_uri(sru_query_value)
15
- stub_request(:get, sru_query_uri).to_return(body: File.read('spec/data/availability-sru.xml'))
16
- end
17
-
18
- it 'returns the MARC records' do
19
- reader = SRU.get_marc_records(*mms_ids)
20
- expect(reader).to be_a(MARC::XMLReader)
21
-
22
- marc_records = reader.to_a
23
- expect(marc_records.size).to eq(mms_ids.size)
24
- expect(marc_records.map(&:record_id)).to contain_exactly(*mms_ids)
25
- end
26
- end
27
- end
28
- end
29
- end