relaton 1.15.0 → 1.15.2
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/.github/workflows/rake.yml +1 -0
- data/.github/workflows/release.yml +3 -2
- data/docs/README.adoc +1 -3
- data/lib/relaton/db.rb +4 -1
- data/lib/relaton/registry.rb +1 -1
- data/lib/relaton/version.rb +1 -1
- data/relaton.gemspec +2 -1
- data/spec/relaton/db_spec.rb +19 -24
- data/spec/relaton/registry_spec.rb +4 -0
- data/spec/relaton_spec.rb +121 -98
- data/spec/spec_helper.rb +2 -1
- data/spec/vcr_cassetes/3gpp_tr_00_01u_umts_3_0_0.yml +46 -89
- data/spec/vcr_cassetes/api_relaton_org.yml +76 -11
- data/spec/vcr_cassetes/api_relaton_org_unavailable.yml +2190 -25
- data/spec/vcr_cassetes/cc_dir_10005_2019.yml +4007 -59
- data/spec/vcr_cassetes/cie_001_1980.yml +57 -70
- data/spec/vcr_cassetes/doi_10_6028_nist_ir_8245.yml +60 -22
- data/spec/vcr_cassetes/ecma_6.yml +294 -151
- data/spec/vcr_cassetes/en_10160_1999.yml +12344 -36
- data/spec/vcr_cassetes/ieee_528_2019.yml +61 -13
- data/spec/vcr_cassetes/iso_111111119115_1.yml +30 -12
- data/spec/vcr_cassetes/iso_19115_1.yml +2461 -25
- data/spec/vcr_cassetes/iso_19115_1_2.yml +4649 -49
- data/spec/vcr_cassetes/iso_19115_all_parts.yml +2693 -25
- data/spec/vcr_cassetes/iso_19133_2005.yml +2323 -26
- data/spec/vcr_cassetes/iso_combined_applied.yml +4342 -50
- data/spec/vcr_cassetes/iso_combined_included.yml +4339 -48
- data/spec/vcr_cassetes/iso_dis.yml +1892 -25
- data/spec/vcr_cassetes/ogc_19_025r1.yml +51 -12
- data/spec/vcr_cassetes/omg_ami4ccm_1_0.yml +1094 -9
- data/spec/vcr_cassetes/rfc_8341.yml +69 -136
- metadata +22 -24
- data/spec/vcr_cassetes/async_fetch.yml +0 -4412
- data/spec/vcr_cassetes/bipm_i18n_async_fetch.yml +0 -618
- data/spec/vcr_cassetes/bipm_metrologia_29_6_373.yml +0 -294
- data/spec/vcr_cassetes/bsi_bs_en_iso_8848.yml +0 -163
- data/spec/vcr_cassetes/fisp_140.yml +0 -48
- data/spec/vcr_cassetes/gb_t_20223_2006.yml +0 -38
- data/spec/vcr_cassetes/iana_service_names_port_numbers.yml +0 -105
- data/spec/vcr_cassetes/iec_60050_102_2007.yml +0 -290
- data/spec/vcr_cassetes/iec_combined_included.yml +0 -960
- data/spec/vcr_cassetes/iho_b_11.yml +0 -74
- data/spec/vcr_cassetes/itu_combined_included.yml +0 -1348
- data/spec/vcr_cassetes/oasis_amqp_core_types_v1_0_pt1.yml +0 -84
- data/spec/vcr_cassetes/sp_800_38b.yml +0 -48
- data/spec/vcr_cassetes/threads_from_env.yml +0 -412
- data/spec/vcr_cassetes/un_rtade_cefact_2004_32.yml +0 -814
- data/spec/vcr_cassetes/w3c_json_ld11.yml +0 -233
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b6254d1d82a460fa2a410054f3c8dc2e924d00f71ec555691109407c8cf0921a
|
|
4
|
+
data.tar.gz: c75c01f97ba34e83b71dc17dd3ed15f80dd619fe31c98f3dd592e3f7616ecf28
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a86a05f6af47607c6287f090522a3cf865d669076fb199e9a061db0604036c1ad34b46e6625fe0eafb9d76547f030e27ce6e10eae41bebd58ee4c0ae871b0038
|
|
7
|
+
data.tar.gz: dc68c7c8db23fe91c6968ed3443dba32f683c5f8856bd12d84e1a1b278651a680fe0c1ef6a44986891f9e24ca0864443e426f578bb26f1333f646fe8326bdb13
|
data/.github/workflows/rake.yml
CHANGED
data/docs/README.adoc
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
= Relaton
|
|
2
2
|
|
|
3
3
|
image:https://img.shields.io/gem/v/relaton.svg["Gem Version", link="https://rubygems.org/gems/relaton"]
|
|
4
|
-
image:https://github.com/relaton/relaton/workflows/
|
|
5
|
-
image:https://github.com/relaton/relaton/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/relaton/relaton/actions?workflow=windows"]
|
|
6
|
-
image:https://github.com/relaton/relaton/workflows/ubuntu/badge.svg["Build Status (Ubuntu)", link="https://github.com/relaton/relaton/actions?workflow=ubuntu"]
|
|
4
|
+
image:https://github.com/relaton/relaton/workflows/rake/badge.svg["Build Status", link="https://github.com/relaton/relaton/actions?workflow=rake"]
|
|
7
5
|
image:https://codeclimate.com/github/relaton/relaton/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/relaton/relaton"]
|
|
8
6
|
image:https://img.shields.io/github/issues-pr-raw/relaton/relaton.svg["Pull Requests", link="https://github.com/relaton/relaton/pulls"]
|
|
9
7
|
image:https://img.shields.io/github/commits-since/relaton/relaton/latest.svg["Commits since latest",link="https://github.com/relaton/relaton/releases"]
|
data/lib/relaton/db.rb
CHANGED
|
@@ -27,6 +27,9 @@ module Relaton
|
|
|
27
27
|
def clear
|
|
28
28
|
@db&.clear
|
|
29
29
|
@local_db&.clear
|
|
30
|
+
@registry.processors.each_value do |p|
|
|
31
|
+
p.remove_index_file if p.respond_to? :remove_index_file
|
|
32
|
+
end
|
|
30
33
|
end
|
|
31
34
|
|
|
32
35
|
##
|
|
@@ -110,7 +113,7 @@ module Relaton
|
|
|
110
113
|
Util.log "[relaton] ERROR: #{args[0]} -- #{e.message}", :error
|
|
111
114
|
args[3].call nil
|
|
112
115
|
end
|
|
113
|
-
@queues[stdclass] = { queue:
|
|
116
|
+
@queues[stdclass] = { queue: SizedQueue.new(threads * 2), workers_pool: wp }
|
|
114
117
|
Thread.new { process_queue @queues[stdclass] }
|
|
115
118
|
end
|
|
116
119
|
@queues[stdclass][:queue] << [ref, year, opts, block]
|
data/lib/relaton/registry.rb
CHANGED
|
@@ -9,7 +9,7 @@ module Relaton
|
|
|
9
9
|
relaton_gb relaton_iec relaton_ietf relaton_iso relaton_itu relaton_nist
|
|
10
10
|
relaton_ogc relaton_calconnect relaton_omg relaton_un relaton_w3c
|
|
11
11
|
relaton_ieee relaton_iho relaton_bipm relaton_ecma relaton_cie relaton_bsi
|
|
12
|
-
relaton_cen relaton_iana relaton_3gpp relaton_oasis relaton_doi
|
|
12
|
+
relaton_cen relaton_iana relaton_3gpp relaton_oasis relaton_doi relaton_jis
|
|
13
13
|
].freeze
|
|
14
14
|
|
|
15
15
|
include Singleton
|
data/lib/relaton/version.rb
CHANGED
data/relaton.gemspec
CHANGED
|
@@ -43,8 +43,9 @@ Gem::Specification.new do |spec|
|
|
|
43
43
|
spec.add_dependency "relaton-ieee", "~> 1.14.0"
|
|
44
44
|
spec.add_dependency "relaton-ietf", "~> 1.14.0"
|
|
45
45
|
spec.add_dependency "relaton-iho", "~> 1.14.0"
|
|
46
|
-
spec.add_dependency "relaton-iso", "~> 1.15.
|
|
46
|
+
spec.add_dependency "relaton-iso", "~> 1.15.3"
|
|
47
47
|
spec.add_dependency "relaton-itu", "~> 1.14.0"
|
|
48
|
+
spec.add_dependency "relaton-jis", "~> 1.14.0"
|
|
48
49
|
spec.add_dependency "relaton-nist", "~> 1.14.0"
|
|
49
50
|
spec.add_dependency "relaton-oasis", "~> 1.14.0"
|
|
50
51
|
spec.add_dependency "relaton-ogc", "~> 1.14.0"
|
data/spec/relaton/db_spec.rb
CHANGED
|
@@ -8,6 +8,7 @@ RSpec.describe Relaton::Db do
|
|
|
8
8
|
it "create bibitem from YAML content" do
|
|
9
9
|
h = { "docid" => [{ "id" => "ISO 123", type: "ISO", "primary" => true }] }
|
|
10
10
|
expect(YAML).to receive(:safe_load).with(:content).and_return h
|
|
11
|
+
allow(YAML).to receive(:safe_load).and_call_original
|
|
11
12
|
item = subject.send :search_edition_year, "iso/item.yaml", :content, nil, nil
|
|
12
13
|
expect(item).to be_instance_of RelatonIsoBib::IsoBibliographicItem
|
|
13
14
|
end
|
|
@@ -165,10 +166,11 @@ RSpec.describe Relaton::Db do
|
|
|
165
166
|
|
|
166
167
|
it "doesn't use cache" do
|
|
167
168
|
db = Relaton::Db.new nil, nil
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
docid = RelatonBib::DocumentIdentifier.new id: "ISO 19115-1", type: "ISO"
|
|
170
|
+
item = RelatonIsoBib::IsoBibliographicItem.new docid: [docid]
|
|
171
|
+
expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 19115-1", nil, {}).and_return item
|
|
172
|
+
bib = db.fetch("ISO 19115-1", nil, {})
|
|
173
|
+
expect(bib).to be_instance_of RelatonIsoBib::IsoBibliographicItem
|
|
172
174
|
end
|
|
173
175
|
|
|
174
176
|
it "fetch when no local db" do
|
|
@@ -203,33 +205,27 @@ RSpec.describe Relaton::Db do
|
|
|
203
205
|
"ITU-T Y.1911", "ITU-T Y.2012", "ITU-T Y.2206", "ITU-T O.172",
|
|
204
206
|
"ITU-T G.780/Y.1351", "ITU-T G.711", "ITU-T G.1011"]
|
|
205
207
|
results = []
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
end
|
|
210
|
-
Timeout.timeout(60) { refs.size.times { results << queue.pop } }
|
|
208
|
+
refs.each do |ref|
|
|
209
|
+
expect(db).to receive(:fetch).with(ref, nil, {}).and_return :result
|
|
210
|
+
db.fetch_async(ref) { |r| queue << [r, ref] }
|
|
211
211
|
end
|
|
212
|
+
Timeout.timeout(60) { refs.size.times { results << queue.pop } }
|
|
212
213
|
results.each do |result|
|
|
213
|
-
expect(result[0]).to
|
|
214
|
+
expect(result[0]).to be :result
|
|
214
215
|
end
|
|
215
216
|
end
|
|
216
217
|
|
|
217
218
|
it "BIPM i18n" do
|
|
218
|
-
expect(File).to receive(:exist?).with(/index\.yaml/).and_return false
|
|
219
|
-
allow(File).to receive(:exist?).and_call_original
|
|
220
|
-
# refs = ["CGPM Resolution 1889-00", "CGPM Résolution 1889-00",
|
|
221
|
-
# "CGPM Réunion 9", "CGPM Meeting 9"]
|
|
222
219
|
refs = ["CGPM -- Resolution (1889)", "CGPM -- Résolution (1889)",
|
|
223
220
|
"CGPM -- Réunion 9 (1948)", "CGPM -- Meeting 9 (1948)"]
|
|
224
221
|
results = []
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
end
|
|
229
|
-
Timeout.timeout(60) { refs.size.times { results << queue.pop } }
|
|
222
|
+
refs.each do |ref|
|
|
223
|
+
expect(db).to receive(:fetch).with(ref, nil, {}).and_return :result
|
|
224
|
+
db.fetch_async(ref) { |r| queue << [r, ref] }
|
|
230
225
|
end
|
|
226
|
+
Timeout.timeout(60) { refs.size.times { results << queue.pop } }
|
|
231
227
|
results.each do |result|
|
|
232
|
-
expect(result[0]).to
|
|
228
|
+
expect(result[0]).to be :result
|
|
233
229
|
end
|
|
234
230
|
end
|
|
235
231
|
|
|
@@ -262,10 +258,9 @@ RSpec.describe Relaton::Db do
|
|
|
262
258
|
expect(ENV).to receive(:[]).with("RELATON_FETCH_PARALLEL").and_return(1)
|
|
263
259
|
allow(ENV).to receive(:[]).and_call_original
|
|
264
260
|
expect(Relaton::WorkersPool).to receive(:new).with(1).and_call_original
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
end
|
|
261
|
+
expect(db).to receive(:fetch).with("ITU-T G.993.5", nil, {})
|
|
262
|
+
db.fetch_async("ITU-T G.993.5") { |r| queue << r }
|
|
263
|
+
Timeout.timeout(50) { queue.pop }
|
|
269
264
|
end
|
|
270
265
|
end
|
|
271
266
|
end
|
|
@@ -105,6 +105,10 @@ RSpec.describe Relaton::Registry do
|
|
|
105
105
|
expect(Relaton::Registry.instance.by_type("DOI")).to be_instance_of RelatonDoi::Processor
|
|
106
106
|
expect(Relaton::Registry.instance.processor_by_ref("doi:10.1000/182")).to be_instance_of RelatonDoi::Processor
|
|
107
107
|
end
|
|
108
|
+
|
|
109
|
+
it "JIS" do
|
|
110
|
+
expect(Relaton::Registry.instance.by_type("JIS")).to be_instance_of RelatonJis::Processor
|
|
111
|
+
end
|
|
108
112
|
end
|
|
109
113
|
|
|
110
114
|
it "find processot by dataset" do
|
data/spec/relaton_spec.rb
CHANGED
|
@@ -12,20 +12,11 @@ RSpec.describe Relaton::Db do
|
|
|
12
12
|
|
|
13
13
|
context "gets an ISO reference" do
|
|
14
14
|
it "and caches it" do
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
expect(File.exist?("testcache")).to be true
|
|
21
|
-
expect(File.exist?("testcache2")).to be true
|
|
22
|
-
testcache = Relaton::DbCache.new "testcache"
|
|
23
|
-
expect(testcache["ISO(ISO 19115-1)"]).to include "<project-number part=\"1\">" \
|
|
24
|
-
"ISO 19115</project-number>"
|
|
25
|
-
testcache = Relaton::DbCache.new "testcache2"
|
|
26
|
-
expect(testcache["ISO(ISO 19115-1)"]).to include "<project-number part=\"1\">" \
|
|
27
|
-
"ISO 19115</project-number>"
|
|
28
|
-
end
|
|
15
|
+
docid = RelatonBib::DocumentIdentifier.new(id: "ISO 19115-1", type: "ISO")
|
|
16
|
+
item = RelatonIsoBib::IsoBibliographicItem.new docid: [docid], fetched: Date.today.to_s
|
|
17
|
+
expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 19115-1", nil, {}).and_return item
|
|
18
|
+
bib = @db.fetch("ISO 19115-1", nil, {})
|
|
19
|
+
expect(bib).to be_instance_of RelatonIsoBib::IsoBibliographicItem
|
|
29
20
|
bib = @db.fetch("ISO 19115-1", nil, {})
|
|
30
21
|
expect(bib).to be_instance_of RelatonIsoBib::IsoBibliographicItem
|
|
31
22
|
end
|
|
@@ -34,8 +25,9 @@ RSpec.describe Relaton::Db do
|
|
|
34
25
|
VCR.use_cassette "iso_19133_2005" do
|
|
35
26
|
bib = @db.fetch("ISO 19133:2005")
|
|
36
27
|
expect(bib).to be_instance_of RelatonIsoBib::IsoBibliographicItem
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
xml = bib.to_xml
|
|
29
|
+
expect(xml).to include 'id="ISO19133-2005"'
|
|
30
|
+
expect(xml).to include 'type="standard"'
|
|
39
31
|
testcache = Relaton::DbCache.new "testcache"
|
|
40
32
|
expect(
|
|
41
33
|
testcache.valid_entry?("ISO(ISO 19133:2005)", Date.today.year.to_s),
|
|
@@ -68,41 +60,40 @@ RSpec.describe Relaton::Db do
|
|
|
68
60
|
end
|
|
69
61
|
|
|
70
62
|
context "IEC" do
|
|
63
|
+
before do
|
|
64
|
+
docid = RelatonBib::DocumentIdentifier.new(id: "IEC 60050-102:2007", type: "IEC")
|
|
65
|
+
item = RelatonIec::IecBibliographicItem.new docid: [docid]
|
|
66
|
+
expect(RelatonIec::IecBibliography).to receive(:get).with("IEC 60050-102:2007", nil, {}).and_return item
|
|
67
|
+
end
|
|
68
|
+
|
|
71
69
|
it "get by reference" do
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
expect(bib.docidentifier[0].id).to eq "IEC 60050-102:2007"
|
|
75
|
-
end
|
|
70
|
+
bib = @db.fetch "IEC 60050-102:2007"
|
|
71
|
+
expect(bib.docidentifier[0].id).to eq "IEC 60050-102:2007"
|
|
76
72
|
end
|
|
77
73
|
|
|
78
74
|
it "get by URN" do
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
expect(bib.docidentifier[0].id).to eq "IEC 60050-102:2007"
|
|
82
|
-
end
|
|
75
|
+
bib = @db.fetch "urn:iec:std:iec:60050-102:2007:::"
|
|
76
|
+
expect(bib.docidentifier[0].id).to eq "IEC 60050-102:2007"
|
|
83
77
|
end
|
|
84
78
|
end
|
|
85
79
|
|
|
86
80
|
context "NIST references" do
|
|
87
|
-
before(:each) do
|
|
88
|
-
nist_fr = /\.relaton\/nist\/pubs-export\.zip/
|
|
89
|
-
expect(File).to receive(:exist?).with(nist_fr).and_return false
|
|
90
|
-
expect(File).to receive(:exist?).and_call_original.at_least :once
|
|
91
|
-
# expect(FileUtils).to receive(:mv).with kind_of(String), nist_fr
|
|
92
|
-
end
|
|
93
|
-
|
|
94
81
|
it "gets FISP" do
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
82
|
+
docid = RelatonBib::DocumentIdentifier.new(id: "NIST FIPS 140", type: "NIST")
|
|
83
|
+
item = RelatonNist::NistBibliographicItem.new docid: [docid]
|
|
84
|
+
expect(RelatonNist::NistBibliography).to receive(:get).with("NIST FIPS 140", nil, {}).and_return item
|
|
85
|
+
bib = @db.fetch "NIST FIPS 140"
|
|
86
|
+
expect(bib).to be_instance_of RelatonNist::NistBibliographicItem
|
|
87
|
+
expect(bib.docidentifier[0].id).to eq "NIST FIPS 140"
|
|
99
88
|
end
|
|
100
89
|
|
|
101
90
|
it "gets SP" do
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
91
|
+
docid = RelatonBib::DocumentIdentifier.new(id: "NIST SP 800-38B", type: "NIST")
|
|
92
|
+
item = RelatonNist::NistBibliographicItem.new docid: [docid]
|
|
93
|
+
expect(RelatonNist::NistBibliography).to receive(:get).with("NIST SP 800-38B", nil, {}).and_return item
|
|
94
|
+
bib = @db.fetch "NIST SP 800-38B"
|
|
95
|
+
expect(bib).to be_instance_of RelatonNist::NistBibliographicItem
|
|
96
|
+
expect(bib.docidentifier[0].id).to eq "NIST SP 800-38B"
|
|
106
97
|
end
|
|
107
98
|
end
|
|
108
99
|
|
|
@@ -191,7 +182,7 @@ RSpec.describe Relaton::Db do
|
|
|
191
182
|
VCR.use_cassette "rfc_8341" do
|
|
192
183
|
bib = @db.fetch "RFC 8341", nil, {}
|
|
193
184
|
expect(bib).to be_instance_of RelatonIetf::IetfBibliographicItem
|
|
194
|
-
expect(bib.to_xml).to
|
|
185
|
+
expect(bib.to_xml).to match(/<bibitem id="RFC8341" type="standard" schema-version="v[\d.]+">/)
|
|
195
186
|
expect(File.exist?("testcache")).to be true
|
|
196
187
|
expect(File.exist?("testcache2")).to be true
|
|
197
188
|
testcache = Relaton::DbCache.new "testcache"
|
|
@@ -244,17 +235,21 @@ RSpec.describe Relaton::Db do
|
|
|
244
235
|
end
|
|
245
236
|
|
|
246
237
|
it "get UN reference" do
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
238
|
+
docid = RelatonBib::DocumentIdentifier.new(id: "UN TRADE/CEFACT/2004/32", type: "UN")
|
|
239
|
+
item = RelatonUn::UnBibliographicItem.new docid: [docid], session: RelatonUn::Session.new(session_number: "1")
|
|
240
|
+
expect(RelatonUn::UnBibliography).to receive(:get).with("UN TRADE/CEFACT/2004/32", nil, {}).and_return item
|
|
241
|
+
bib = @db.fetch "UN TRADE/CEFACT/2004/32", nil, {}
|
|
242
|
+
expect(bib).to be_instance_of RelatonUn::UnBibliographicItem
|
|
243
|
+
expect(bib.docidentifier.first.id).to eq "UN TRADE/CEFACT/2004/32"
|
|
251
244
|
end
|
|
252
245
|
|
|
253
246
|
it "get W3C reference" do
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
247
|
+
docid = RelatonBib::DocumentIdentifier.new(id: "W3C REC-json-ld11-20200716", type: "W3C")
|
|
248
|
+
item = RelatonW3c::W3cBibliographicItem.new docid: [docid]
|
|
249
|
+
expect(RelatonW3c::W3cBibliography).to receive(:get).with("W3C REC-json-ld11-20200716", nil, {}).and_return item
|
|
250
|
+
bib = @db.fetch "W3C REC-json-ld11-20200716", nil, {}
|
|
251
|
+
expect(bib).to be_instance_of RelatonW3c::W3cBibliographicItem
|
|
252
|
+
expect(bib.docidentifier.first.id).to eq "W3C REC-json-ld11-20200716"
|
|
258
253
|
end
|
|
259
254
|
|
|
260
255
|
it "get IEEE reference" do
|
|
@@ -265,10 +260,12 @@ RSpec.describe Relaton::Db do
|
|
|
265
260
|
end
|
|
266
261
|
|
|
267
262
|
it "get IHO reference" do
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
263
|
+
docid = RelatonBib::DocumentIdentifier.new(id: "IHO B-11", type: "IHO")
|
|
264
|
+
item = RelatonIho::IhoBibliographicItem.new docid: [docid]
|
|
265
|
+
expect(RelatonIho::IhoBibliography).to receive(:get).with("IHO B-11", nil, {}).and_return item
|
|
266
|
+
bib = @db.fetch "IHO B-11"
|
|
267
|
+
expect(bib).to be_instance_of RelatonIho::IhoBibliographicItem
|
|
268
|
+
expect(bib.docidentifier.first.id).to eq "IHO B-11"
|
|
272
269
|
end
|
|
273
270
|
|
|
274
271
|
it "get ECMA reference" do
|
|
@@ -286,10 +283,11 @@ RSpec.describe Relaton::Db do
|
|
|
286
283
|
end
|
|
287
284
|
|
|
288
285
|
it "get BSI reference" do
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
286
|
+
docid = RelatonBib::DocumentIdentifier.new(id: "BSI BS EN ISO 8848", type: "BSI")
|
|
287
|
+
item = RelatonBsi::BsiBibliographicItem.new docid: [docid]
|
|
288
|
+
expect(RelatonBsi::BsiBibliography).to receive(:get).with("BSI BS EN ISO 8848", nil, {}).and_return item
|
|
289
|
+
bib = @db.fetch "BSI BS EN ISO 8848"
|
|
290
|
+
expect(bib).to be_instance_of RelatonBsi::BsiBibliographicItem
|
|
293
291
|
end
|
|
294
292
|
|
|
295
293
|
it "get CEN reference" do
|
|
@@ -300,10 +298,11 @@ RSpec.describe Relaton::Db do
|
|
|
300
298
|
end
|
|
301
299
|
|
|
302
300
|
it "get IANA reference" do
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
301
|
+
docid = RelatonBib::DocumentIdentifier.new(id: "IANA service-names-port-numbers", type: "IANA")
|
|
302
|
+
item = RelatonIana::IanaBibliographicItem.new docid: [docid]
|
|
303
|
+
expect(RelatonIana::IanaBibliography).to receive(:get).with("IANA service-names-port-numbers", nil, {}).and_return item
|
|
304
|
+
bib = @db.fetch "IANA service-names-port-numbers"
|
|
305
|
+
expect(bib).to be_instance_of RelatonIana::IanaBibliographicItem
|
|
307
306
|
end
|
|
308
307
|
|
|
309
308
|
it "get 3GPP reference" do
|
|
@@ -314,15 +313,20 @@ RSpec.describe Relaton::Db do
|
|
|
314
313
|
end
|
|
315
314
|
|
|
316
315
|
it "get OASIS reference" do
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
316
|
+
docid = RelatonBib::DocumentIdentifier.new(id: "OASIS amqp-core-types-v1.0-Pt1", type: "OASIS")
|
|
317
|
+
item = RelatonOasis::OasisBibliographicItem.new docid: [docid]
|
|
318
|
+
expect(RelatonOasis::OasisBibliography).to receive(:get).with("OASIS amqp-core-types-v1.0-Pt1", nil, {}).and_return item
|
|
319
|
+
bib = @db.fetch "OASIS amqp-core-types-v1.0-Pt1"
|
|
320
|
+
expect(bib).to be_instance_of RelatonOasis::OasisBibliographicItem
|
|
321
321
|
end
|
|
322
322
|
|
|
323
|
-
it "get BIPM reference"
|
|
323
|
+
it "get BIPM reference" do
|
|
324
|
+
docid = RelatonBib::DocumentIdentifier.new(id: "BIPM Metrologia 29 6 373", type: "BIPM")
|
|
325
|
+
item = RelatonBipm::BipmBibliographicItem.new docid: [docid]
|
|
326
|
+
expect(RelatonBipm::BipmBibliography).to receive(:get).with("BIPM Metrologia 29 6 373", nil, {}).and_return item
|
|
324
327
|
bib = @db.fetch "BIPM Metrologia 29 6 373"
|
|
325
328
|
expect(bib).to be_instance_of RelatonBipm::BipmBibliographicItem
|
|
329
|
+
expect(bib.docidentifier.first.id).to eq "BIPM Metrologia 29 6 373"
|
|
326
330
|
end
|
|
327
331
|
|
|
328
332
|
it "get DOI reference", vcr: "doi_10_6028_nist_ir_8245" do
|
|
@@ -359,49 +363,68 @@ RSpec.describe Relaton::Db do
|
|
|
359
363
|
|
|
360
364
|
context "IEC" do
|
|
361
365
|
it "included" do
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
366
|
+
item = RelatonIec::IecBibliographicItem.new docid: [RelatonBib::DocumentIdentifier.new(id: "IEC 60027-1", type: "IEC")]
|
|
367
|
+
expect(RelatonIec::IecBibliography).to receive(:get).with("IEC 60027-1", nil, {}).and_return item
|
|
368
|
+
item1 = RelatonIec::IecBibliographicItem.new docid: [RelatonBib::DocumentIdentifier.new(id: "IEC 60027-1/AMD1:1997", type: "IEC")]
|
|
369
|
+
expect(RelatonIec::IecBibliography).to receive(:get).with("IEC 60027-1/Amd 1", nil, {}).and_return item1
|
|
370
|
+
item2 = RelatonIec::IecBibliographicItem.new docid: [RelatonBib::DocumentIdentifier.new(id: "IEC 60027-1/AMD2:2005", type: "IEC")]
|
|
371
|
+
expect(RelatonIec::IecBibliography).to receive(:get).with("IEC 60027-1/Amd 2", nil, {}).and_return item2
|
|
372
|
+
bib = @db.fetch "IEC 60027-1, Amd 1, Amd 2"
|
|
373
|
+
expect(bib.docidentifier[0].id).to eq "IEC 60027-1, Amd 1, Amd 2"
|
|
374
|
+
expect(bib.relation[0].type).to eq "updates"
|
|
375
|
+
expect(bib.relation[0].bibitem.docidentifier[0].id).to eq "IEC 60027-1"
|
|
376
|
+
expect(bib.relation[1].type).to eq "complements"
|
|
377
|
+
expect(bib.relation[1].description.content).to eq "amendment"
|
|
378
|
+
expect(bib.relation[1].bibitem.docidentifier[0].id).to eq "IEC 60027-1/AMD1:1997"
|
|
379
|
+
expect(bib.relation[2].type).to eq "complements"
|
|
380
|
+
expect(bib.relation[2].description.content).to eq "amendment"
|
|
381
|
+
expect(bib.relation[2].bibitem.docidentifier[0].id).to eq "IEC 60027-1/AMD2:2005"
|
|
374
382
|
end
|
|
375
383
|
end
|
|
376
384
|
|
|
377
385
|
context "ITU" do
|
|
378
386
|
it "included" do
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
387
|
+
docid = RelatonBib::DocumentIdentifier.new(id: "ITU-T G.989.2", type: "ITU")
|
|
388
|
+
group = RelatonItu::ItuGroup.new(name: "Group")
|
|
389
|
+
ed = RelatonItu::EditorialGroup.new(bureau: "Bureau", group: group)
|
|
390
|
+
item = RelatonItu::ItuBibliographicItem.new docid: [docid], editorialgroup: ed
|
|
391
|
+
expect(RelatonItu::ItuBibliography).to receive(:get).with("ITU-T G.989.2", nil, {}).and_return item
|
|
392
|
+
docid1 = RelatonBib::DocumentIdentifier.new(id: "ITU-T G.989.2 Amd 1", type: "ITU")
|
|
393
|
+
item1 = RelatonItu::ItuBibliographicItem.new docid: [docid1], editorialgroup: ed
|
|
394
|
+
expect(RelatonItu::ItuBibliography).to receive(:get).with("ITU-T G.989.2 Amd 1", nil, {}).and_return item1
|
|
395
|
+
docid2 = RelatonBib::DocumentIdentifier.new(id: "ITU-T G.989.2 Amd 2", type: "ITU")
|
|
396
|
+
item2 = RelatonItu::ItuBibliographicItem.new docid: [docid2], editorialgroup: ed
|
|
397
|
+
expect(RelatonItu::ItuBibliography).to receive(:get).with("ITU-T G.989.2 Amd 2", nil, {}).and_return item2
|
|
398
|
+
bib = @db.fetch "ITU-T G.989.2, Amd 1, Amd 2"
|
|
399
|
+
expect(bib.docidentifier[0].id).to eq "ITU-T G.989.2, Amd 1, Amd 2"
|
|
400
|
+
expect(bib.relation[0].type).to eq "updates"
|
|
401
|
+
expect(bib.relation[0].bibitem.docidentifier[0].id).to eq "ITU-T G.989.2"
|
|
402
|
+
expect(bib.relation[1].type).to eq "complements"
|
|
403
|
+
expect(bib.relation[1].description.content).to eq "amendment"
|
|
404
|
+
expect(bib.relation[1].bibitem.docidentifier[0].id).to eq "ITU-T G.989.2 Amd 1"
|
|
405
|
+
expect(bib.relation[2].type).to eq "complements"
|
|
406
|
+
expect(bib.relation[2].description.content).to eq "amendment"
|
|
407
|
+
expect(bib.relation[2].bibitem.docidentifier[0].id).to eq "ITU-T G.989.2 Amd 2"
|
|
391
408
|
end
|
|
392
409
|
end
|
|
393
410
|
|
|
394
411
|
context "NIST" do
|
|
395
412
|
it "included" do
|
|
396
|
-
VCR.use_cassette "nist_combined_included" do
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
413
|
+
# VCR.use_cassette "nist_combined_included" do
|
|
414
|
+
doci = RelatonBib::DocumentIdentifier.new(id: "SP 800-38A", type: "NIST")
|
|
415
|
+
item = RelatonNist::NistBibliographicItem.new docid: [doci]
|
|
416
|
+
expect(RelatonNist::NistBibliography).to receive(:get).with("NIST SP 800-38A", nil, {}).and_return item
|
|
417
|
+
docid1 = RelatonBib::DocumentIdentifier.new(id: "SP 800-38A-Add", type: "NIST")
|
|
418
|
+
item1 = RelatonNist::NistBibliographicItem.new docid: [docid1]
|
|
419
|
+
expect(RelatonNist::NistBibliography).to receive(:get).with("NIST SP 800-38A/Add", nil, {}).and_return item1
|
|
420
|
+
bib = @db.fetch "NIST SP 800-38A, Add"
|
|
421
|
+
expect(bib.docidentifier[0].id).to eq "NIST SP 800-38A, Add"
|
|
422
|
+
expect(bib.relation[0].type).to eq "updates"
|
|
423
|
+
expect(bib.relation[0].bibitem.docidentifier[0].id).to eq "SP 800-38A"
|
|
424
|
+
expect(bib.relation[1].type).to eq "complements"
|
|
425
|
+
expect(bib.relation[1].description.content).to eq "amendment"
|
|
426
|
+
expect(bib.relation[1].bibitem.docidentifier[0].id).to eq "SP 800-38A-Add"
|
|
427
|
+
# end
|
|
405
428
|
end
|
|
406
429
|
end
|
|
407
430
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "bundler/setup"
|
|
3
|
+
# require "bundler/setup"
|
|
4
4
|
require "fileutils"
|
|
5
5
|
require "rspec/matchers"
|
|
6
6
|
require "equivalent-xml"
|
|
@@ -14,6 +14,7 @@ VCR.configure do |c|
|
|
|
14
14
|
re_record_interval: 7 * 24 * 3600,
|
|
15
15
|
record: :once,
|
|
16
16
|
allow_playback_repeats: true,
|
|
17
|
+
preserve_exact_body_bytes: true,
|
|
17
18
|
}
|
|
18
19
|
c.hook_into :webmock
|
|
19
20
|
c.configure_rspec_metadata!
|