relaton 1.8.pre4 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +1 -1
  3. data/.rubocop.yml +1 -1
  4. data/lib/relaton/config.rb +2 -3
  5. data/lib/relaton/db.rb +53 -110
  6. data/lib/relaton/db_cache.rb +99 -55
  7. data/lib/relaton/registry.rb +0 -1
  8. data/lib/relaton/version.rb +1 -1
  9. data/lib/relaton.rb +0 -1
  10. data/relaton.gemspec +3 -6
  11. data/spec/relaton/db_cache_spec.rb +2 -2
  12. data/spec/relaton/db_spec.rb +0 -17
  13. data/spec/relaton/regirtry_spec.rb +1 -9
  14. data/spec/relaton_spec.rb +4 -45
  15. data/spec/spec_helper.rb +0 -4
  16. data/spec/vcr_cassetes/19133_2005.yml +18 -18
  17. data/spec/vcr_cassetes/async_fetch.yml +1249 -1361
  18. data/spec/vcr_cassetes/bsi_bs_en_iso_8848.yml +17 -17
  19. data/spec/vcr_cassetes/cc_dir_10005_2019.yml +20 -20
  20. data/spec/vcr_cassetes/cie_001_1980.yml +7 -7
  21. data/spec/vcr_cassetes/ecma_6.yml +7 -7
  22. data/spec/vcr_cassetes/fisp_140.yml +10 -8
  23. data/spec/vcr_cassetes/gb_t_20223_2006.yml +8 -8
  24. data/spec/vcr_cassetes/iec_60050_102_2007.yml +27 -27
  25. data/spec/vcr_cassetes/iec_combined_included.yml +89 -89
  26. data/spec/vcr_cassetes/ieee_528_2019.yml +38 -38
  27. data/spec/vcr_cassetes/iho_b_11.yml +7 -7
  28. data/spec/vcr_cassetes/iso_111111119115_1.yml +4 -4
  29. data/spec/vcr_cassetes/iso_19115.yml +17 -17
  30. data/spec/vcr_cassetes/iso_19115_1.yml +18 -18
  31. data/spec/vcr_cassetes/iso_19115_1_2.yml +34 -34
  32. data/spec/vcr_cassetes/iso_awi_14093.yml +18 -18
  33. data/spec/vcr_cassetes/iso_combined_applied.yml +34 -34
  34. data/spec/vcr_cassetes/iso_combined_included.yml +33 -33
  35. data/spec/vcr_cassetes/itu_combined_included.yml +147 -147
  36. data/spec/vcr_cassetes/ogc_19_025r1.yml +1165 -1239
  37. data/spec/vcr_cassetes/omg_ami4ccm_1_0.yml +4 -4
  38. data/spec/vcr_cassetes/rfc_8341.yml +7 -7
  39. data/spec/vcr_cassetes/sp_800_38b.yml +10 -8
  40. data/spec/vcr_cassetes/un_rtade_cefact_2004_32.yml +31 -29
  41. data/spec/vcr_cassetes/w3c_json_ld11.yml +12 -12
  42. metadata +11 -56
  43. data/spec/vcr_cassetes/api_relaton_org.yml +0 -51
  44. data/spec/vcr_cassetes/api_relaton_org_unavailable.yml +0 -182
  45. data/spec/vcr_cassetes/cen_en_10160_1999.yml +0 -249
@@ -1,23 +1,6 @@
1
1
  RSpec.describe Relaton::Db do
2
2
  before(:each) { FileUtils.rm_rf %w[testcache testcache2] }
3
3
 
4
- # context "initialization in API mode" do
5
- # before(:each) { Relaton.configure { |c| c.api_mode = true } }
6
- # after(:each) { Relaton.configure { |c| c.api_mode = false } }
7
-
8
- # it do
9
- # db = Relaton::Db.new "cache", nil
10
- # cache = db.instance_variable_get :@db
11
- # expect(cache.dir).to eq "cache"
12
- # end
13
-
14
- # it "with default cache directory" do
15
- # db = Relaton::Db.init_bib_caches global_cache: true
16
- # cache = db.instance_variable_get :@db
17
- # expect(cache.dir).to eq "cache"
18
- # end
19
- # end
20
-
21
4
  context "modifing database" do
22
5
  let(:db) { Relaton::Db.new "testcache", "testcache2" }
23
6
 
@@ -2,7 +2,7 @@ RSpec.describe Relaton::Registry do
2
2
  it "outputs backend not present" do
3
3
  stub_const "Relaton::Registry::SUPPORTED_GEMS", ["not_supported_gem"]
4
4
  expect { Relaton::Registry.clone.instance }.to output(
5
- /backend not_supported_gem not present/,
5
+ /backend not_supported_gem not present/
6
6
  ).to_stderr
7
7
  end
8
8
 
@@ -79,13 +79,5 @@ RSpec.describe Relaton::Registry do
79
79
  it "CIE" do
80
80
  expect(Relaton::Registry.instance.by_type("CIE")).to be_instance_of RelatonCie::Processor
81
81
  end
82
-
83
- it "BSI" do
84
- expect(Relaton::Registry.instance.by_type("BSI")).to be_instance_of RelatonBsi::Processor
85
- end
86
-
87
- it "CEN" do
88
- expect(Relaton::Registry.instance.by_type("CEN")).to be_instance_of RelatonCen::Processor
89
- end
90
82
  end
91
83
  end
data/spec/relaton_spec.rb CHANGED
@@ -6,7 +6,7 @@ RSpec.describe Relaton::Db do
6
6
 
7
7
  it "rejects an illegal reference prefix" do
8
8
  expect { @db.fetch("XYZ XYZ", nil, {}) }.to output(
9
- /does not have a recognised prefix/,
9
+ /does not have a recognised prefix/
10
10
  ).to_stderr
11
11
  end
12
12
 
@@ -38,7 +38,7 @@ RSpec.describe Relaton::Db do
38
38
  'type="standard">'
39
39
  testcache = Relaton::DbCache.new "testcache"
40
40
  expect(
41
- testcache.valid_entry?("ISO(ISO 19133:2005)", Date.today.year.to_s),
41
+ testcache.valid_entry?("ISO(ISO 19133:2005)", Date.today.year.to_s)
42
42
  ).to eq Date.today.year.to_s
43
43
  end
44
44
  end
@@ -285,13 +285,6 @@ RSpec.describe Relaton::Db do
285
285
  end
286
286
  end
287
287
 
288
- it "get CEN reference" do
289
- VCR.use_cassette "cen_en_10160_1999" do
290
- bib = @db.fetch "CEN EN 10160:1999"
291
- expect(bib).to be_instance_of RelatonIsoBib::IsoBibliographicItem
292
- end
293
- end
294
-
295
288
  context "get combined documents" do
296
289
  context "ISO" do
297
290
  it "included" do
@@ -355,7 +348,7 @@ RSpec.describe Relaton::Db do
355
348
 
356
349
  context "HIST" do
357
350
  it "included" do
358
- VCR.use_cassette "hist_combined_included" do
351
+ VCR.use_cassette "hist_cmbined_included" do
359
352
  bib = @db.fetch "NIST SP 800-38A, Add"
360
353
  expect(bib.docidentifier[0].id).to eq "NIST SP 800-38A, Add"
361
354
  expect(bib.relation[0].type).to eq "updates"
@@ -371,7 +364,7 @@ RSpec.describe Relaton::Db do
371
364
  context "version control" do
372
365
  before(:each) { @db.save_entry "iso(test_key)", "<bibitem><title>test_value</title></bibitem>" }
373
366
 
374
- it "shoudn't clear cache if version isn't changed" do
367
+ it "shoudn't clear cacho if version isn't changed" do
375
368
  testcache = @db.instance_variable_get :@db
376
369
  expect(testcache.all).to be_any
377
370
  testcache = @db.instance_variable_get :@local_db
@@ -389,38 +382,4 @@ RSpec.describe Relaton::Db do
389
382
  expect(File.exist?("testcache2/iso/version")).to eq false
390
383
  end
391
384
  end
392
-
393
- context "api.relaton.org" do
394
- before(:each) do
395
- Relaton.configure do |config|
396
- config.use_api = true
397
- # config.api_host = "http://0.0.0.0:9292"
398
- end
399
- end
400
-
401
- after(:each) do
402
- Relaton.configure do |config|
403
- config.use_api = false
404
- end
405
- end
406
-
407
- it "get document" do
408
- VCR.use_cassette "api_relaton_org" do
409
- bib = @db.fetch "ISO 19115-2", "2019"
410
- expect(bib).to be_instance_of RelatonIsoBib::IsoBibliographicItem
411
- end
412
- end
413
-
414
- it "if unavailable then get document directly" do
415
- expect(Net::HTTP).to receive(:get_response).and_wrap_original do |m, *args|
416
- raise Errno::ECONNREFUSED if args[0].host == "api.relaton.org"
417
-
418
- m.call(*args)
419
- end.at_least :once
420
- VCR.use_cassette "api_relaton_org_unavailable" do
421
- bib = @db.fetch "ISO 19115-2", "2019"
422
- expect(bib).to be_instance_of RelatonIsoBib::IsoBibliographicItem
423
- end
424
- end
425
- end
426
385
  end
data/spec/spec_helper.rb CHANGED
@@ -23,10 +23,6 @@ end
23
23
 
24
24
  require "relaton"
25
25
 
26
- Relaton.configure do |config|
27
- config.use_api = false
28
- end
29
-
30
26
  RSpec.configure do |config|
31
27
  # Enable flags like --only-failures and --next-failure
32
28
  config.example_status_persistence_file_path = ".rspec_status"