relaton 1.20.2 → 2.0.0.pre.alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CLAUDE.md +4 -2
- data/Rakefile +1 -1
- data/bin/rspec +1 -2
- data/docs/README.adoc +93 -86
- data/lib/relaton/config.rb +2 -3
- data/lib/relaton/db.rb +57 -39
- data/lib/relaton/db_cache.rb +3 -2
- data/lib/relaton/registry.rb +23 -30
- data/lib/relaton/util.rb +2 -1
- data/lib/relaton/version.rb +1 -1
- data/lib/relaton/workers_pool.rb +1 -1
- data/lib/relaton.rb +6 -7
- data/relaton.gemspec +31 -31
- data/spec/relaton/db_cache_spec.rb +1 -1
- data/spec/relaton/db_spec.rb +84 -46
- data/spec/relaton/registry_spec.rb +43 -41
- data/spec/relaton/util_spec.rb +1 -0
- data/spec/relaton_spec.rb +345 -163
- data/spec/vcr_cassetes/3gpp_tr_00_01u_umts_3_0_0.yml +12595 -13226
- data/spec/vcr_cassetes/api_relaton_org.yml +7 -7
- data/spec/vcr_cassetes/api_relaton_org_unavailable.yml +76 -78
- data/spec/vcr_cassetes/cc_dir_10005_2019.yml +48 -42
- data/spec/vcr_cassetes/cie_001_1980.yml +302 -262
- data/spec/vcr_cassetes/cipm_meeting_43.yml +1380 -1370
- data/spec/vcr_cassetes/doi_10_6028_nist_ir_8245.yml +3 -3
- data/spec/vcr_cassetes/ecma_6.yml +182 -238
- data/spec/vcr_cassetes/en_10160_1999.yml +13083 -13122
- data/spec/vcr_cassetes/gb_t_20223_2006.yml +9 -9
- data/spec/vcr_cassetes/ieee_528_2019.yml +2633 -2411
- data/spec/vcr_cassetes/iso_19115_1.yml +13692 -13957
- data/spec/vcr_cassetes/iso_19115_1_2.yml +235 -244
- data/spec/vcr_cassetes/iso_19115_1_std.yml +13690 -13955
- data/spec/vcr_cassetes/iso_19115_all_parts.yml +161 -168
- data/spec/vcr_cassetes/iso_19133_2005.yml +83 -79
- data/spec/vcr_cassetes/iso_combined_applied.yml +239 -238
- data/spec/vcr_cassetes/iso_combined_included.yml +240 -239
- data/spec/vcr_cassetes/iso_dis.yml +87 -88
- data/spec/vcr_cassetes/ogc_19_025r1.yml +248 -243
- data/spec/vcr_cassetes/omg_ami4ccm_1_0.yml +268 -1513
- data/spec/vcr_cassetes/rfc_8341.yml +1090 -1086
- metadata +62 -80
- data/lib/relaton/processor.rb +0 -46
- data/spec/relaton/processor_spec.rb +0 -113
data/spec/relaton_spec.rb
CHANGED
|
@@ -15,27 +15,31 @@ RSpec.describe Relaton::Db do
|
|
|
15
15
|
|
|
16
16
|
it "rejects an illegal reference prefix" do
|
|
17
17
|
expect { @db.fetch("XYZ XYZ", nil, {}) }.to output(
|
|
18
|
-
/\[relaton\] INFO: \(XYZ XYZ\) `XYZ XYZ` does not
|
|
18
|
+
/\[relaton\] INFO: \(XYZ XYZ\) `XYZ XYZ` does not/,
|
|
19
19
|
).to_stderr_from_any_process
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
context "gets an ISO reference" do
|
|
23
23
|
it "and caches it" do
|
|
24
|
-
docid =
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
docid = Relaton::Bib::Docidentifier.new(content: "ISO 19115-1",
|
|
25
|
+
type: "ISO")
|
|
26
|
+
item = Relaton::Iso::ItemData.new(
|
|
27
|
+
docid: [docid], fetched: Date.today.to_s,
|
|
28
|
+
)
|
|
29
|
+
expect(Relaton::Iso::Bibliography).to receive(:get)
|
|
30
|
+
.with("ISO 19115-1", nil, {}).and_return item
|
|
27
31
|
bib = @db.fetch("ISO 19115-1", nil, {})
|
|
28
|
-
expect(bib).to be_instance_of
|
|
32
|
+
expect(bib).to be_instance_of Relaton::Iso::ItemData
|
|
29
33
|
bib = @db.fetch("ISO 19115-1", nil, {})
|
|
30
|
-
expect(bib).to be_instance_of
|
|
34
|
+
expect(bib).to be_instance_of Relaton::Iso::ItemData
|
|
31
35
|
end
|
|
32
36
|
|
|
33
37
|
it "with year in code" do
|
|
34
38
|
VCR.use_cassette "iso_19133_2005" do
|
|
35
39
|
bib = @db.fetch("ISO 19133:2005")
|
|
36
|
-
expect(bib).to be_instance_of
|
|
40
|
+
expect(bib).to be_instance_of Relaton::Iso::ItemData
|
|
37
41
|
xml = bib.to_xml
|
|
38
|
-
expect(xml).to include 'id="
|
|
42
|
+
expect(xml).to include 'id="ISO191332005"'
|
|
39
43
|
expect(xml).to include 'type="standard"'
|
|
40
44
|
testcache = Relaton::DbCache.new "testcache"
|
|
41
45
|
expect(
|
|
@@ -48,14 +52,14 @@ RSpec.describe Relaton::Db do
|
|
|
48
52
|
it "implicity" do
|
|
49
53
|
VCR.use_cassette "iso_19115_all_parts" do
|
|
50
54
|
bib = @db.fetch("ISO 19115", nil, all_parts: true)
|
|
51
|
-
expect(bib.docidentifier[0].
|
|
55
|
+
expect(bib.docidentifier[0].content).to eq "ISO 19115 (all parts)"
|
|
52
56
|
end
|
|
53
57
|
end
|
|
54
58
|
|
|
55
59
|
it "explicity" do
|
|
56
60
|
VCR.use_cassette "iso_19115_all_parts" do
|
|
57
61
|
bib = @db.fetch("ISO 19115 (all parts)")
|
|
58
|
-
expect(bib.docidentifier[0].
|
|
62
|
+
expect(bib.docidentifier[0].content).to eq "ISO 19115 (all parts)"
|
|
59
63
|
end
|
|
60
64
|
end
|
|
61
65
|
end
|
|
@@ -63,46 +67,57 @@ RSpec.describe Relaton::Db do
|
|
|
63
67
|
it "gets sn ISO/DIS reference" do
|
|
64
68
|
VCR.use_cassette "iso_dis" do
|
|
65
69
|
bib = @db.fetch "ISO/DIS 14460"
|
|
66
|
-
expect(bib.docidentifier[0].
|
|
70
|
+
expect(bib.docidentifier[0].content).to eq "ISO/DIS 14460"
|
|
67
71
|
end
|
|
68
72
|
end
|
|
69
73
|
end
|
|
70
74
|
|
|
71
75
|
context "IEC" do
|
|
72
76
|
before do
|
|
73
|
-
docid =
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
docid = Relaton::Bib::Docidentifier.new(content: "IEC 60050-102:2007",
|
|
78
|
+
type: "IEC")
|
|
79
|
+
item = Relaton::Iec::ItemData.new docidentifier: [docid]
|
|
80
|
+
expect(Relaton::Iec::Bibliography).to receive(:get).with(
|
|
81
|
+
"IEC 60050-102:2007", nil, {}
|
|
82
|
+
).and_return item
|
|
76
83
|
end
|
|
77
84
|
|
|
78
85
|
it "get by reference" do
|
|
79
86
|
bib = @db.fetch "IEC 60050-102:2007"
|
|
80
|
-
expect(bib.docidentifier[0].
|
|
87
|
+
expect(bib.docidentifier[0].content).to eq "IEC 60050-102:2007"
|
|
81
88
|
end
|
|
82
89
|
|
|
83
90
|
it "get by URN" do
|
|
84
91
|
bib = @db.fetch "urn:iec:std:iec:60050-102:2007:::"
|
|
85
|
-
expect(bib.docidentifier[0].
|
|
92
|
+
expect(bib.docidentifier[0].content).to eq "IEC 60050-102:2007"
|
|
86
93
|
end
|
|
87
94
|
end
|
|
88
95
|
|
|
89
96
|
context "NIST references" do
|
|
90
97
|
it "gets FISP" do
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
require "relaton/nist"
|
|
99
|
+
docid = Relaton::Bib::Docidentifier.new(content: "NIST FIPS 140",
|
|
100
|
+
type: "NIST")
|
|
101
|
+
item = Relaton::Nist::ItemData.new docidentifier: [docid]
|
|
102
|
+
expect(Relaton::Nist::Bibliography).to receive(:get).with(
|
|
103
|
+
"NIST FIPS 140", nil, {}
|
|
104
|
+
).and_return item
|
|
94
105
|
bib = @db.fetch "NIST FIPS 140"
|
|
95
|
-
expect(bib).to be_instance_of
|
|
96
|
-
expect(bib.docidentifier[0].
|
|
106
|
+
expect(bib).to be_instance_of Relaton::Nist::ItemData
|
|
107
|
+
expect(bib.docidentifier[0].content).to eq "NIST FIPS 140"
|
|
97
108
|
end
|
|
98
109
|
|
|
99
110
|
it "gets SP" do
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
111
|
+
require "relaton/nist"
|
|
112
|
+
docid = Relaton::Bib::Docidentifier.new(content: "NIST SP 800-38B",
|
|
113
|
+
type: "NIST")
|
|
114
|
+
item = Relaton::Nist::ItemData.new docidentifier: [docid]
|
|
115
|
+
expect(Relaton::Nist::Bibliography).to receive(:get).with(
|
|
116
|
+
"NIST SP 800-38B", nil, {}
|
|
117
|
+
).and_return item
|
|
103
118
|
bib = @db.fetch "NIST SP 800-38B"
|
|
104
|
-
expect(bib).to be_instance_of
|
|
105
|
-
expect(bib.docidentifier[0].
|
|
119
|
+
expect(bib).to be_instance_of Relaton::Nist::ItemData
|
|
120
|
+
expect(bib.docidentifier[0].content).to eq "NIST SP 800-38B"
|
|
106
121
|
end
|
|
107
122
|
end
|
|
108
123
|
|
|
@@ -149,19 +164,19 @@ RSpec.describe Relaton::Db do
|
|
|
149
164
|
it "and cache it" do
|
|
150
165
|
VCR.use_cassette "gb_t_20223_2006" do
|
|
151
166
|
bib = @db.fetch "CN(GB/T 20223)", "2006", {}
|
|
152
|
-
expect(bib).to be_instance_of
|
|
167
|
+
expect(bib).to be_instance_of Relaton::Gb::ItemData
|
|
153
168
|
expect(bib.to_xml(bibdata: true)).to include <<~XML
|
|
154
|
-
<project-number>GB/T 20223</project-number>
|
|
169
|
+
<project-number origyr="2006">GB/T 20223-2006</project-number>
|
|
155
170
|
XML
|
|
156
171
|
expect(File.exist?("testcache")).to be true
|
|
157
172
|
expect(File.exist?("testcache2")).to be true
|
|
158
173
|
testcache = Relaton::DbCache.new "testcache"
|
|
159
174
|
expect(testcache["CN(GB/T 20223-2006)"]).to include <<~XML
|
|
160
|
-
<project-number>GB/T 20223</project-number>
|
|
175
|
+
<project-number origyr="2006">GB/T 20223-2006</project-number>
|
|
161
176
|
XML
|
|
162
177
|
testcache = Relaton::DbCache.new "testcache2"
|
|
163
178
|
expect(testcache["CN(GB/T 20223-2006)"]).to include <<~XML
|
|
164
|
-
<project-number>GB/T 20223</project-number>
|
|
179
|
+
<project-number origyr="2006">GB/T 20223-2006</project-number>
|
|
165
180
|
XML
|
|
166
181
|
end
|
|
167
182
|
end
|
|
@@ -169,19 +184,19 @@ RSpec.describe Relaton::Db do
|
|
|
169
184
|
it "with year" do
|
|
170
185
|
VCR.use_cassette "gb_t_20223_2006" do
|
|
171
186
|
bib = @db.fetch "CN(GB/T 20223-2006)", nil, {}
|
|
172
|
-
expect(bib).to be_instance_of
|
|
187
|
+
expect(bib).to be_instance_of Relaton::Gb::ItemData
|
|
173
188
|
expect(bib.to_xml(bibdata: true)).to include <<~XML
|
|
174
|
-
<project-number>GB/T 20223</project-number>
|
|
189
|
+
<project-number origyr="2006">GB/T 20223-2006</project-number>
|
|
175
190
|
XML
|
|
176
191
|
expect(File.exist?("testcache")).to be true
|
|
177
192
|
expect(File.exist?("testcache2")).to be true
|
|
178
193
|
testcache = Relaton::DbCache.new "testcache"
|
|
179
194
|
expect(testcache["CN(GB/T 20223-2006)"]).to include <<~XML
|
|
180
|
-
<project-number>GB/T 20223</project-number>
|
|
195
|
+
<project-number origyr="2006">GB/T 20223-2006</project-number>
|
|
181
196
|
XML
|
|
182
197
|
testcache = Relaton::DbCache.new "testcache2"
|
|
183
198
|
expect(testcache["CN(GB/T 20223-2006)"]).to include <<~XML
|
|
184
|
-
<project-number>GB/T 20223</project-number>
|
|
199
|
+
<project-number origyr="2006">GB/T 20223-2006</project-number>
|
|
185
200
|
XML
|
|
186
201
|
end
|
|
187
202
|
end
|
|
@@ -190,8 +205,10 @@ RSpec.describe Relaton::Db do
|
|
|
190
205
|
it "get RFC reference and cache it" do
|
|
191
206
|
VCR.use_cassette "rfc_8341" do
|
|
192
207
|
bib = @db.fetch "RFC 8341", nil, {}
|
|
193
|
-
expect(bib).to be_instance_of
|
|
194
|
-
expect(bib.to_xml).to match(
|
|
208
|
+
expect(bib).to be_instance_of Relaton::Ietf::ItemData
|
|
209
|
+
expect(bib.to_xml).to match(
|
|
210
|
+
/<bibitem id="RFC8341" type="standard" schema-version="v[\d.]+">/,
|
|
211
|
+
)
|
|
195
212
|
expect(File.exist?("testcache")).to be true
|
|
196
213
|
expect(File.exist?("testcache2")).to be true
|
|
197
214
|
testcache = Relaton::DbCache.new "testcache"
|
|
@@ -214,178 +231,238 @@ RSpec.describe Relaton::Db do
|
|
|
214
231
|
.at_most :once
|
|
215
232
|
allow(File).to receive(:write).and_call_original
|
|
216
233
|
VCR.use_cassette "ogc_19_025r1" do
|
|
217
|
-
|
|
218
|
-
expect(File).to receive(:exist?).with(
|
|
234
|
+
ogc_bib = "/Users/andrej/.relaton/ogc/bibliography.json"
|
|
235
|
+
expect(File).to receive(:exist?).with(ogc_bib)
|
|
236
|
+
.and_return(false).at_most :once
|
|
237
|
+
ogc_etag = "/Users/andrej/.relaton/ogc/etag.txt"
|
|
238
|
+
expect(File).to receive(:exist?).with(ogc_etag)
|
|
239
|
+
.and_return(false).at_most :once
|
|
219
240
|
allow(File).to receive(:exist?).and_call_original
|
|
220
241
|
bib = @db.fetch "OGC 19-025r1", nil, {}
|
|
221
|
-
expect(bib).to be_instance_of
|
|
242
|
+
expect(bib).to be_instance_of Relaton::Ogc::ItemData
|
|
222
243
|
end
|
|
223
244
|
end
|
|
224
245
|
|
|
225
246
|
it "get Calconnect refrence and cache it" do
|
|
226
247
|
VCR.use_cassette "cc_dir_10005_2019", match_requests_on: [:path] do
|
|
227
248
|
bib = @db.fetch "CC/DIR 10005:2019", nil, {}
|
|
228
|
-
expect(bib).to be_instance_of
|
|
249
|
+
expect(bib).to be_instance_of Relaton::Calconnect::ItemData
|
|
229
250
|
end
|
|
230
251
|
end
|
|
231
252
|
|
|
232
253
|
it "get OMG reference" do
|
|
233
254
|
VCR.use_cassette "omg_ami4ccm_1_0" do
|
|
234
255
|
bib = @db.fetch "OMG AMI4CCM 1.0", nil, {}
|
|
235
|
-
expect(bib).to be_instance_of
|
|
256
|
+
expect(bib).to be_instance_of Relaton::Bib::ItemData
|
|
236
257
|
end
|
|
237
258
|
end
|
|
238
259
|
|
|
239
260
|
# it "get UN reference" do
|
|
240
|
-
# docid = RelatonBib::DocumentIdentifier.new(
|
|
241
|
-
#
|
|
242
|
-
#
|
|
261
|
+
# docid = RelatonBib::DocumentIdentifier.new(
|
|
262
|
+
# id: "UN TRADE/CEFACT/2004/32", type: "UN",
|
|
263
|
+
# )
|
|
264
|
+
# item = RelatonUn::UnBibliographicItem.new(
|
|
265
|
+
# docid: [docid],
|
|
266
|
+
# session: RelatonUn::Session.new(session_number: "1"),
|
|
267
|
+
# )
|
|
268
|
+
# expect(RelatonUn::UnBibliography).to receive(:get)
|
|
269
|
+
# .with("UN TRADE/CEFACT/2004/32", nil, {})
|
|
270
|
+
# .and_return item
|
|
243
271
|
# bib = @db.fetch "UN TRADE/CEFACT/2004/32", nil, {}
|
|
244
|
-
# expect(bib).to be_instance_of
|
|
245
|
-
#
|
|
272
|
+
# expect(bib).to be_instance_of(
|
|
273
|
+
# RelatonUn::UnBibliographicItem,
|
|
274
|
+
# )
|
|
275
|
+
# expect(bib.docidentifier.first.id)
|
|
276
|
+
# .to eq "UN TRADE/CEFACT/2004/32"
|
|
246
277
|
# end
|
|
247
278
|
|
|
248
279
|
it "get W3C reference" do
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
280
|
+
require "relaton/w3c"
|
|
281
|
+
docid = Relaton::Bib::Docidentifier.new(
|
|
282
|
+
content: "W3C REC-json-ld11-20200716", type: "W3C",
|
|
283
|
+
)
|
|
284
|
+
item = Relaton::W3c::ItemData.new docidentifier: [docid]
|
|
285
|
+
expect(Relaton::W3c::Bibliography).to receive(:get).with(
|
|
286
|
+
"W3C REC-json-ld11-20200716", nil, {}
|
|
287
|
+
).and_return item
|
|
252
288
|
bib = @db.fetch "W3C REC-json-ld11-20200716", nil, {}
|
|
253
|
-
expect(bib).to be_instance_of
|
|
254
|
-
expect(bib.docidentifier.first.
|
|
289
|
+
expect(bib).to be_instance_of Relaton::W3c::ItemData
|
|
290
|
+
expect(bib.docidentifier.first.content).to eq "W3C REC-json-ld11-20200716"
|
|
255
291
|
end
|
|
256
292
|
|
|
257
293
|
it "get CCSDS reference" do
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
294
|
+
require "relaton/ccsds"
|
|
295
|
+
docid = Relaton::Bib::Docidentifier.new content: "CCSDS 230.2-G-1",
|
|
296
|
+
type: "CCSDS"
|
|
297
|
+
item = Relaton::Ccsds::ItemData.new docidentifier: [docid]
|
|
298
|
+
expect(Relaton::Ccsds::Bibliography).to receive(:get).with(
|
|
299
|
+
"CCSDS 230.2-G-1", nil, {}
|
|
300
|
+
).and_return item
|
|
261
301
|
bib = @db.fetch "CCSDS 230.2-G-1", nil, {}
|
|
262
|
-
expect(bib).to be_instance_of
|
|
263
|
-
expect(bib.docidentifier.first.
|
|
302
|
+
expect(bib).to be_instance_of Relaton::Ccsds::ItemData
|
|
303
|
+
expect(bib.docidentifier.first.content).to eq "CCSDS 230.2-G-1"
|
|
264
304
|
end
|
|
265
305
|
|
|
266
306
|
it "get IEEE reference", vcr: "ieee_528_2019" do
|
|
267
307
|
bib = @db.fetch "IEEE Std 528-2019"
|
|
268
|
-
expect(bib).to be_instance_of
|
|
308
|
+
expect(bib).to be_instance_of Relaton::Ieee::ItemData
|
|
269
309
|
end
|
|
270
310
|
|
|
271
311
|
it "get IHO reference" do
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
312
|
+
require "relaton/iho"
|
|
313
|
+
docid = Relaton::Bib::Docidentifier.new(content: "IHO B-11", type: "IHO")
|
|
314
|
+
item = Relaton::Iho::ItemData.new docidentifier: [docid]
|
|
315
|
+
expect(Relaton::Iho::Bibliography).to receive(:get).with("IHO B-11", nil,
|
|
316
|
+
{}).and_return item
|
|
275
317
|
bib = @db.fetch "IHO B-11"
|
|
276
|
-
expect(bib).to be_instance_of
|
|
277
|
-
expect(bib.docidentifier.first.
|
|
318
|
+
expect(bib).to be_instance_of Relaton::Iho::ItemData
|
|
319
|
+
expect(bib.docidentifier.first.content).to eq "IHO B-11"
|
|
278
320
|
end
|
|
279
321
|
|
|
280
322
|
it "get ECMA reference" do
|
|
281
323
|
VCR.use_cassette "ecma_6" do
|
|
282
324
|
bib = @db.fetch "ECMA-6"
|
|
283
|
-
expect(bib).to be_instance_of
|
|
325
|
+
expect(bib).to be_instance_of Relaton::Ecma::ItemData
|
|
284
326
|
end
|
|
285
327
|
end
|
|
286
328
|
|
|
287
329
|
it "get CIE reference" do
|
|
288
330
|
VCR.use_cassette "cie_001_1980" do
|
|
289
331
|
bib = @db.fetch "CIE 001-1980"
|
|
290
|
-
expect(bib).to be_instance_of
|
|
332
|
+
expect(bib).to be_instance_of Relaton::Cie::ItemData
|
|
291
333
|
end
|
|
292
334
|
end
|
|
293
335
|
|
|
294
336
|
it "get BSI reference" do
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
337
|
+
require "relaton/bsi"
|
|
338
|
+
docid = Relaton::Bib::Docidentifier.new(content: "BSI BS EN ISO 8848",
|
|
339
|
+
type: "BSI")
|
|
340
|
+
item = Relaton::Bsi::ItemData.new docidentifier: [docid]
|
|
341
|
+
expect(Relaton::Bsi::Bibliography).to receive(:get).with(
|
|
342
|
+
"BSI BS EN ISO 8848", nil, {}
|
|
343
|
+
).and_return item
|
|
298
344
|
bib = @db.fetch "BSI BS EN ISO 8848"
|
|
299
|
-
expect(bib).to be_instance_of
|
|
345
|
+
expect(bib).to be_instance_of Relaton::Bsi::ItemData
|
|
300
346
|
end
|
|
301
347
|
|
|
302
348
|
it "get CEN reference" do
|
|
303
349
|
VCR.use_cassette "en_10160_1999" do
|
|
304
350
|
bib = @db.fetch "EN 10160:1999"
|
|
305
|
-
expect(bib).to be_instance_of
|
|
351
|
+
expect(bib).to be_instance_of Relaton::Cen::ItemData
|
|
306
352
|
end
|
|
307
353
|
end
|
|
308
354
|
|
|
309
355
|
it "get IANA reference" do
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
356
|
+
require "relaton/iana"
|
|
357
|
+
docid = Relaton::Bib::Docidentifier.new(
|
|
358
|
+
content: "IANA service-names-port-numbers", type: "IANA",
|
|
359
|
+
)
|
|
360
|
+
item = Relaton::Iana::ItemData.new docidentifier: [docid]
|
|
361
|
+
expect(Relaton::Iana::Bibliography).to receive(:get).with(
|
|
362
|
+
"IANA service-names-port-numbers", nil, {}
|
|
363
|
+
).and_return item
|
|
313
364
|
bib = @db.fetch "IANA service-names-port-numbers"
|
|
314
|
-
expect(bib).to be_instance_of
|
|
365
|
+
expect(bib).to be_instance_of Relaton::Iana::ItemData
|
|
315
366
|
end
|
|
316
367
|
|
|
317
368
|
it "get 3GPP reference" do
|
|
318
369
|
VCR.use_cassette "3gpp_tr_00_01u_umts_3_0_0" do
|
|
319
370
|
bib = @db.fetch "3GPP TR 00.01U:UMTS/3.0.0"
|
|
320
|
-
expect(bib).to be_instance_of
|
|
371
|
+
expect(bib).to be_instance_of Relaton::ThreeGpp::ItemData
|
|
321
372
|
end
|
|
322
373
|
end
|
|
323
374
|
|
|
324
375
|
it "get OASIS reference" do
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
376
|
+
require "relaton/oasis"
|
|
377
|
+
docid = Relaton::Bib::Docidentifier.new(
|
|
378
|
+
content: "OASIS amqp-core-types-v1.0-Pt1", type: "OASIS",
|
|
379
|
+
)
|
|
380
|
+
item = Relaton::Oasis::ItemData.new docidentifier: [docid]
|
|
381
|
+
expect(Relaton::Oasis::Bibliography).to receive(:get).with(
|
|
382
|
+
"OASIS amqp-core-types-v1.0-Pt1", nil, {}
|
|
383
|
+
).and_return item
|
|
328
384
|
bib = @db.fetch "OASIS amqp-core-types-v1.0-Pt1"
|
|
329
|
-
expect(bib).to be_instance_of
|
|
385
|
+
expect(bib).to be_instance_of Relaton::Oasis::ItemData
|
|
330
386
|
end
|
|
331
387
|
|
|
332
388
|
it "get BIPM reference" do
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
389
|
+
require "relaton/bipm"
|
|
390
|
+
docid = Relaton::Bib::Docidentifier.new(
|
|
391
|
+
content: "BIPM Metrologia 29 6 373", type: "BIPM",
|
|
392
|
+
)
|
|
393
|
+
item = Relaton::Bipm::ItemData.new docidentifier: [docid]
|
|
394
|
+
expect(Relaton::Bipm::Bibliography).to receive(:get).with(
|
|
395
|
+
"BIPM Metrologia 29 6 373", nil, {}
|
|
396
|
+
).and_return item
|
|
336
397
|
bib = @db.fetch "BIPM Metrologia 29 6 373"
|
|
337
|
-
expect(bib).to be_instance_of
|
|
338
|
-
expect(bib.docidentifier.first.
|
|
398
|
+
expect(bib).to be_instance_of Relaton::Bipm::ItemData
|
|
399
|
+
expect(bib.docidentifier.first.content).to eq "BIPM Metrologia 29 6 373"
|
|
339
400
|
end
|
|
340
401
|
|
|
341
402
|
it "get DOI reference", vcr: "doi_10_6028_nist_ir_8245" do
|
|
342
403
|
bib = @db.fetch "doi:10.6028/nist.ir.8245"
|
|
343
|
-
expect(bib).to be_instance_of
|
|
404
|
+
expect(bib).to be_instance_of Relaton::Bib::ItemData
|
|
344
405
|
end
|
|
345
406
|
|
|
346
407
|
it "get JIS reference" do
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
408
|
+
require "relaton/jis"
|
|
409
|
+
docid = Relaton::Bib::Docidentifier.new(content: "JIS X 0001", type: "JIS")
|
|
410
|
+
item = Relaton::Jis::ItemData.new docidentifier: [docid]
|
|
411
|
+
expect(Relaton::Jis::Bibliography).to receive(:get).with("JIS X 0001", nil,
|
|
412
|
+
{}).and_return item
|
|
350
413
|
bib = @db.fetch "JIS X 0001"
|
|
351
|
-
expect(bib).to be_instance_of
|
|
352
|
-
expect(bib.docidentifier.first.
|
|
414
|
+
expect(bib).to be_instance_of Relaton::Jis::ItemData
|
|
415
|
+
expect(bib.docidentifier.first.content).to eq "JIS X 0001"
|
|
353
416
|
end
|
|
354
417
|
|
|
355
418
|
it "get XSF reference" do
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
419
|
+
require "relaton/xsf"
|
|
420
|
+
docid = Relaton::Bib::Docidentifier.new(content: "XEP 0001", type: "XSF")
|
|
421
|
+
item = Relaton::Bib::ItemData.new docidentifier: [docid]
|
|
422
|
+
expect(Relaton::Xsf::Bibliography).to receive(:get).with("XEP 0001", nil,
|
|
423
|
+
{}).and_return item
|
|
359
424
|
bib = @db.fetch "XEP 0001"
|
|
360
|
-
expect(bib).to be_instance_of
|
|
361
|
-
expect(bib.docidentifier.first.
|
|
425
|
+
expect(bib).to be_instance_of Relaton::Bib::ItemData
|
|
426
|
+
expect(bib.docidentifier.first.content).to eq "XEP 0001"
|
|
362
427
|
end
|
|
363
428
|
|
|
364
429
|
it "get ETSI reference" do
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
430
|
+
require "relaton/etsi"
|
|
431
|
+
docid = Relaton::Bib::Docidentifier.new(content: "ETSI EN 300 175-8",
|
|
432
|
+
type: "ETSI")
|
|
433
|
+
item = Relaton::Etsi::ItemData.new docidentifier: [docid]
|
|
434
|
+
expect(Relaton::Etsi::Bibliography).to receive(:get).with(
|
|
435
|
+
"ETSI EN 300 175-8", nil, {}
|
|
436
|
+
).and_return item
|
|
368
437
|
bib = @db.fetch "ETSI EN 300 175-8"
|
|
369
|
-
expect(bib).to be_instance_of
|
|
370
|
-
expect(bib.docidentifier.first.
|
|
438
|
+
expect(bib).to be_instance_of Relaton::Etsi::ItemData
|
|
439
|
+
expect(bib.docidentifier.first.content).to eq "ETSI EN 300 175-8"
|
|
371
440
|
end
|
|
372
441
|
|
|
373
442
|
it "get ISBN reference" do
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
443
|
+
require "relaton/isbn"
|
|
444
|
+
docid = Relaton::Bib::Docidentifier.new(content: "ISBN 978-0-580-50101-4",
|
|
445
|
+
type: "ISBN")
|
|
446
|
+
item = Relaton::Bib::ItemData.new docidentifier: [docid]
|
|
447
|
+
expect(Relaton::Isbn::OpenLibrary).to receive(:get).with(
|
|
448
|
+
"ISBN 978-0-580-50101-4", nil, {}
|
|
449
|
+
).and_return item
|
|
377
450
|
bib = @db.fetch "ISBN 978-0-580-50101-4"
|
|
378
|
-
expect(bib).to be_instance_of
|
|
379
|
-
expect(bib.docidentifier.first.
|
|
451
|
+
expect(bib).to be_instance_of Relaton::Bib::ItemData
|
|
452
|
+
expect(bib.docidentifier.first.content).to eq "ISBN 978-0-580-50101-4"
|
|
380
453
|
end
|
|
381
454
|
|
|
382
455
|
it "get PLATEAU reference" do
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
456
|
+
require "relaton/plateau"
|
|
457
|
+
docid = Relaton::Bib::Docidentifier.new(content: "PLATEAU Hanbook #01",
|
|
458
|
+
type: "PLATEAU")
|
|
459
|
+
item = Relaton::Plateau::ItemData.new docidentifier: [docid]
|
|
460
|
+
expect(Relaton::Plateau::Bibliography).to receive(:get).with(
|
|
461
|
+
"PLATEAU Hanbook #01", nil, {}
|
|
462
|
+
).and_return item
|
|
386
463
|
bib = @db.fetch "PLATEAU Hanbook #01"
|
|
387
|
-
expect(bib).to be_instance_of Relaton::Plateau::
|
|
388
|
-
expect(bib.docidentifier.first.
|
|
464
|
+
expect(bib).to be_instance_of Relaton::Plateau::ItemData
|
|
465
|
+
expect(bib.docidentifier.first.content).to eq "PLATEAU Hanbook #01"
|
|
389
466
|
end
|
|
390
467
|
|
|
391
468
|
context "get combined documents" do
|
|
@@ -393,98 +470,197 @@ RSpec.describe Relaton::Db do
|
|
|
393
470
|
it "included" do
|
|
394
471
|
VCR.use_cassette "iso_combined_included" do
|
|
395
472
|
bib = @db.fetch "ISO 19115-1:2014 + Amd 1"
|
|
396
|
-
expect(bib.docidentifier[0].
|
|
473
|
+
expect(bib.docidentifier[0].content)
|
|
474
|
+
.to eq "ISO 19115-1:2014 + Amd 1"
|
|
397
475
|
expect(bib.relation[0].type).to eq "updates"
|
|
398
|
-
|
|
476
|
+
rel0 = bib.relation[0].bibitem
|
|
477
|
+
expect(rel0.docidentifier[0].content)
|
|
478
|
+
.to eq "ISO 19115-1:2014"
|
|
399
479
|
expect(bib.relation[1].type).to eq "derivedFrom"
|
|
400
480
|
expect(bib.relation[1].description).to be_nil
|
|
401
|
-
|
|
481
|
+
rel1 = bib.relation[1].bibitem
|
|
482
|
+
expect(rel1.docidentifier[0].content)
|
|
483
|
+
.to eq "ISO 19115-1:2014/Amd 1:2018"
|
|
402
484
|
end
|
|
403
485
|
end
|
|
404
486
|
|
|
405
487
|
it "applied" do
|
|
406
488
|
VCR.use_cassette "iso_combined_applied" do
|
|
407
489
|
bib = @db.fetch "ISO 19115-1:2014, Amd 1"
|
|
408
|
-
expect(bib.docidentifier[0].
|
|
490
|
+
expect(bib.docidentifier[0].content)
|
|
491
|
+
.to eq "ISO 19115-1:2014, Amd 1"
|
|
409
492
|
expect(bib.relation[0].type).to eq "updates"
|
|
410
|
-
|
|
493
|
+
rel0 = bib.relation[0].bibitem
|
|
494
|
+
expect(rel0.docidentifier[0].content)
|
|
495
|
+
.to eq "ISO 19115-1:2014"
|
|
411
496
|
expect(bib.relation[1].type).to eq "complements"
|
|
412
|
-
expect(bib.relation[1].description.content)
|
|
413
|
-
|
|
497
|
+
expect(bib.relation[1].description.content)
|
|
498
|
+
.to eq "amendment"
|
|
499
|
+
rel1 = bib.relation[1].bibitem
|
|
500
|
+
expect(rel1.docidentifier[0].content)
|
|
501
|
+
.to eq "ISO 19115-1:2014/Amd 1:2018"
|
|
414
502
|
end
|
|
415
503
|
end
|
|
416
504
|
end
|
|
417
505
|
|
|
418
506
|
context "IEC" do
|
|
419
507
|
it "included" do
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
508
|
+
require "relaton/iec"
|
|
509
|
+
docid = Relaton::Iec::Docidentifier.new(
|
|
510
|
+
content: "IEC 60027-1", type: "IEC",
|
|
511
|
+
)
|
|
512
|
+
item = Relaton::Iec::ItemData.new(
|
|
513
|
+
docidentifier: [docid],
|
|
514
|
+
)
|
|
515
|
+
expect(Relaton::Iec::Bibliography).to receive(:get)
|
|
516
|
+
.with("IEC 60027-1", nil, {}).and_return item
|
|
517
|
+
docid1 = Relaton::Iec::Docidentifier.new(
|
|
518
|
+
content: "IEC 60027-1/AMD1:1997", type: "IEC",
|
|
519
|
+
)
|
|
520
|
+
item1 = Relaton::Iec::ItemData.new(
|
|
521
|
+
docidentifier: [docid1],
|
|
522
|
+
)
|
|
523
|
+
expect(Relaton::Iec::Bibliography).to receive(:get)
|
|
524
|
+
.with("IEC 60027-1/Amd 1", nil, {})
|
|
525
|
+
.and_return item1
|
|
526
|
+
docid2 = Relaton::Iec::Docidentifier.new(
|
|
527
|
+
content: "IEC 60027-1/AMD2:2005", type: "IEC",
|
|
528
|
+
)
|
|
529
|
+
item2 = Relaton::Iec::ItemData.new(
|
|
530
|
+
docidentifier: [docid2],
|
|
531
|
+
)
|
|
532
|
+
expect(Relaton::Iec::Bibliography).to receive(:get)
|
|
533
|
+
.with("IEC 60027-1/Amd 2", nil, {})
|
|
534
|
+
.and_return item2
|
|
426
535
|
bib = @db.fetch "IEC 60027-1, Amd 1, Amd 2"
|
|
427
|
-
expect(bib.docidentifier[0].
|
|
536
|
+
expect(bib.docidentifier[0].content)
|
|
537
|
+
.to eq "IEC 60027-1, Amd 1, Amd 2"
|
|
428
538
|
expect(bib.relation[0].type).to eq "updates"
|
|
429
|
-
|
|
539
|
+
rel0 = bib.relation[0].bibitem
|
|
540
|
+
expect(rel0.docidentifier[0].content)
|
|
541
|
+
.to eq "IEC 60027-1"
|
|
430
542
|
expect(bib.relation[1].type).to eq "complements"
|
|
431
|
-
expect(bib.relation[1].description.content)
|
|
432
|
-
|
|
543
|
+
expect(bib.relation[1].description.content)
|
|
544
|
+
.to eq "amendment"
|
|
545
|
+
rel1 = bib.relation[1].bibitem
|
|
546
|
+
expect(rel1.docidentifier[0].content)
|
|
547
|
+
.to eq "IEC 60027-1/AMD1:1997"
|
|
433
548
|
expect(bib.relation[2].type).to eq "complements"
|
|
434
|
-
expect(bib.relation[2].description.content)
|
|
435
|
-
|
|
549
|
+
expect(bib.relation[2].description.content)
|
|
550
|
+
.to eq "amendment"
|
|
551
|
+
rel2 = bib.relation[2].bibitem
|
|
552
|
+
expect(rel2.docidentifier[0].content)
|
|
553
|
+
.to eq "IEC 60027-1/AMD2:2005"
|
|
436
554
|
end
|
|
437
555
|
end
|
|
438
556
|
|
|
439
557
|
context "ITU" do
|
|
440
558
|
it "included" do
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
559
|
+
require "relaton/itu"
|
|
560
|
+
docid = Relaton::Bib::Docidentifier.new(content: "ITU-T G.989.2",
|
|
561
|
+
type: "ITU")
|
|
562
|
+
org = Relaton::Bib::Organization.new(
|
|
563
|
+
name: [Relaton::Bib::TypedLocalizedString.new(
|
|
564
|
+
content: "International Telecommunication Union",
|
|
565
|
+
)],
|
|
566
|
+
abbreviation: Relaton::Bib::LocalizedString.new(content: "ITU-T"),
|
|
567
|
+
subdivision: [Relaton::Bib::Subdivision.new(
|
|
568
|
+
type: "technical-committee",
|
|
569
|
+
subtype: "study-group",
|
|
570
|
+
name: [Relaton::Bib::TypedLocalizedString.new(content: "Group")],
|
|
571
|
+
)],
|
|
572
|
+
)
|
|
573
|
+
role = Relaton::Bib::Contributor::Role.new(
|
|
574
|
+
type: "author",
|
|
575
|
+
description: [Relaton::Bib::LocalizedMarkedUpString.new(
|
|
576
|
+
content: "committee",
|
|
577
|
+
)],
|
|
578
|
+
)
|
|
579
|
+
contrib = Relaton::Bib::Contributor.new(organization: org, role: [role])
|
|
580
|
+
item = Relaton::Itu::ItemData.new(
|
|
581
|
+
docidentifier: [docid], contributor: [contrib],
|
|
582
|
+
)
|
|
583
|
+
expect(Relaton::Itu::Bibliography).to receive(:get).with(
|
|
584
|
+
"ITU-T G.989.2", nil, {}
|
|
585
|
+
).and_return item
|
|
586
|
+
docid1 = Relaton::Bib::Docidentifier.new(
|
|
587
|
+
content: "ITU-T G.989.2 Amd 1", type: "ITU",
|
|
588
|
+
)
|
|
589
|
+
item1 = Relaton::Itu::ItemData.new(
|
|
590
|
+
docidentifier: [docid1], contributor: [contrib],
|
|
591
|
+
)
|
|
592
|
+
expect(Relaton::Itu::Bibliography).to receive(:get).with(
|
|
593
|
+
"ITU-T G.989.2 Amd 1", nil, {}
|
|
594
|
+
).and_return item1
|
|
595
|
+
docid2 = Relaton::Bib::Docidentifier.new(
|
|
596
|
+
content: "ITU-T G.989.2 Amd 2", type: "ITU",
|
|
597
|
+
)
|
|
598
|
+
item2 = Relaton::Itu::ItemData.new(
|
|
599
|
+
docidentifier: [docid2], contributor: [contrib],
|
|
600
|
+
)
|
|
601
|
+
expect(Relaton::Itu::Bibliography).to receive(:get).with(
|
|
602
|
+
"ITU-T G.989.2 Amd 2", nil, {}
|
|
603
|
+
).and_return item2
|
|
452
604
|
bib = @db.fetch "ITU-T G.989.2, Amd 1, Amd 2"
|
|
453
|
-
expect(bib.docidentifier[0].
|
|
605
|
+
expect(bib.docidentifier[0].content)
|
|
606
|
+
.to eq "ITU-T G.989.2, Amd 1, Amd 2"
|
|
454
607
|
expect(bib.relation[0].type).to eq "updates"
|
|
455
|
-
|
|
608
|
+
rel0 = bib.relation[0].bibitem
|
|
609
|
+
expect(rel0.docidentifier[0].content)
|
|
610
|
+
.to eq "ITU-T G.989.2"
|
|
456
611
|
expect(bib.relation[1].type).to eq "complements"
|
|
457
|
-
expect(bib.relation[1].description.content)
|
|
458
|
-
|
|
612
|
+
expect(bib.relation[1].description.content)
|
|
613
|
+
.to eq "amendment"
|
|
614
|
+
rel1 = bib.relation[1].bibitem
|
|
615
|
+
expect(rel1.docidentifier[0].content)
|
|
616
|
+
.to eq "ITU-T G.989.2 Amd 1"
|
|
459
617
|
expect(bib.relation[2].type).to eq "complements"
|
|
460
|
-
expect(bib.relation[2].description.content)
|
|
461
|
-
|
|
618
|
+
expect(bib.relation[2].description.content)
|
|
619
|
+
.to eq "amendment"
|
|
620
|
+
rel2 = bib.relation[2].bibitem
|
|
621
|
+
expect(rel2.docidentifier[0].content)
|
|
622
|
+
.to eq "ITU-T G.989.2 Amd 2"
|
|
462
623
|
end
|
|
463
624
|
end
|
|
464
625
|
|
|
465
626
|
context "NIST" do
|
|
466
627
|
it "included" do
|
|
467
628
|
# VCR.use_cassette "nist_combined_included" do
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
629
|
+
require "relaton/nist"
|
|
630
|
+
doci = Relaton::Bib::Docidentifier.new(content: "SP 800-38A",
|
|
631
|
+
type: "NIST")
|
|
632
|
+
item = Relaton::Nist::ItemData.new docidentifier: [doci]
|
|
633
|
+
expect(Relaton::Nist::Bibliography).to receive(:get).with(
|
|
634
|
+
"NIST SP 800-38A", nil, {}
|
|
635
|
+
).and_return item
|
|
636
|
+
docid1 = Relaton::Bib::Docidentifier.new(content: "SP 800-38A-Add",
|
|
637
|
+
type: "NIST")
|
|
638
|
+
item1 = Relaton::Nist::ItemData.new docidentifier: [docid1]
|
|
639
|
+
expect(Relaton::Nist::Bibliography).to receive(:get).with(
|
|
640
|
+
"NIST SP 800-38A/Add", nil, {}
|
|
641
|
+
).and_return item1
|
|
474
642
|
bib = @db.fetch "NIST SP 800-38A, Add"
|
|
475
|
-
expect(bib.docidentifier[0].
|
|
643
|
+
expect(bib.docidentifier[0].content).to eq "NIST SP 800-38A, Add"
|
|
476
644
|
expect(bib.relation[0].type).to eq "updates"
|
|
477
|
-
|
|
645
|
+
rel0 = bib.relation[0].bibitem
|
|
646
|
+
expect(rel0.docidentifier[0].content)
|
|
647
|
+
.to eq "SP 800-38A"
|
|
478
648
|
expect(bib.relation[1].type).to eq "complements"
|
|
479
|
-
expect(bib.relation[1].description.content)
|
|
480
|
-
|
|
649
|
+
expect(bib.relation[1].description.content)
|
|
650
|
+
.to eq "amendment"
|
|
651
|
+
rel1 = bib.relation[1].bibitem
|
|
652
|
+
expect(rel1.docidentifier[0].content)
|
|
653
|
+
.to eq "SP 800-38A-Add"
|
|
481
654
|
# end
|
|
482
655
|
end
|
|
483
656
|
end
|
|
484
657
|
end
|
|
485
658
|
|
|
486
659
|
context "version control" do
|
|
487
|
-
before(:each)
|
|
660
|
+
before(:each) do
|
|
661
|
+
@db.save_entry "iso(test_key)",
|
|
662
|
+
"<bibitem><title>test_value</title></bibitem>"
|
|
663
|
+
end
|
|
488
664
|
|
|
489
665
|
it "shoudn't clear cache if version isn't changed" do
|
|
490
666
|
testcache = @db.instance_variable_get :@db
|
|
@@ -494,11 +670,16 @@ RSpec.describe Relaton::Db do
|
|
|
494
670
|
end
|
|
495
671
|
|
|
496
672
|
it "should clear cache if version is changed" do
|
|
497
|
-
expect(File.read("testcache/iso/version",
|
|
498
|
-
|
|
673
|
+
expect(File.read("testcache/iso/version",
|
|
674
|
+
encoding: "UTF-8")).not_to eq "new_version"
|
|
675
|
+
expect(File.read("testcache2/iso/version",
|
|
676
|
+
encoding: "UTF-8")).not_to eq "new_version"
|
|
499
677
|
processor = double "processor", short: :relaton_iso
|
|
500
|
-
expect(processor).to receive(:grammar_hash)
|
|
501
|
-
|
|
678
|
+
expect(processor).to receive(:grammar_hash)
|
|
679
|
+
.and_return("new_version").exactly(2).times
|
|
680
|
+
expect(Relaton::Registry.instance)
|
|
681
|
+
.to receive(:by_type)
|
|
682
|
+
.and_return(processor).exactly(2).times
|
|
502
683
|
Relaton::Db.new "testcache", "testcache2"
|
|
503
684
|
expect(File.exist?("testcache/iso/version")).to eq false
|
|
504
685
|
expect(File.exist?("testcache2/iso/version")).to eq false
|
|
@@ -522,19 +703,20 @@ RSpec.describe Relaton::Db do
|
|
|
522
703
|
it "get document" do
|
|
523
704
|
VCR.use_cassette "api_relaton_org" do
|
|
524
705
|
bib = @db.fetch "ISO 19115-2", "2019"
|
|
525
|
-
expect(bib).to be_instance_of
|
|
706
|
+
expect(bib).to be_instance_of Relaton::Iso::ItemData
|
|
526
707
|
end
|
|
527
708
|
end
|
|
528
709
|
|
|
529
710
|
it "if unavailable then get document directly" do
|
|
530
|
-
expect(Net::HTTP).to receive(:get_response)
|
|
711
|
+
expect(Net::HTTP).to receive(:get_response)
|
|
712
|
+
.and_wrap_original do |m, *args|
|
|
531
713
|
raise Errno::ECONNREFUSED if args[0].host == "api.relaton.org"
|
|
532
714
|
|
|
533
715
|
m.call(*args)
|
|
534
716
|
end.at_least :once
|
|
535
717
|
VCR.use_cassette "api_relaton_org_unavailable" do
|
|
536
718
|
bib = @db.fetch "ISO 19115-2", "2019"
|
|
537
|
-
expect(bib).to be_instance_of
|
|
719
|
+
expect(bib).to be_instance_of Relaton::Iso::ItemData
|
|
538
720
|
end
|
|
539
721
|
end
|
|
540
722
|
end
|