bolognese 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -7
- data/lib/bolognese/utils.rb +12 -1
- data/lib/bolognese/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_id/doi_as_url.yml +930 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_id/ftp.yml +930 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_id/invalid_url.yml +930 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_id/string.yml +930 -0
- data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_id/url_with_utf-8.yml +930 -0
- data/spec/utils_spec.rb +30 -0
- metadata +7 -2
data/spec/utils_spec.rb
CHANGED
@@ -58,11 +58,41 @@ describe Bolognese::Crossref, vcr: true do
|
|
58
58
|
expect(response).to eq("https://doi.org/10.5061/dryad.8515")
|
59
59
|
end
|
60
60
|
|
61
|
+
it "doi as url" do
|
62
|
+
doi = "http://dx.doi.org/10.5061/DRYAD.8515"
|
63
|
+
response = subject.normalize_id(doi)
|
64
|
+
expect(response).to eq("https://doi.org/10.5061/dryad.8515")
|
65
|
+
end
|
66
|
+
|
61
67
|
it "url" do
|
62
68
|
url = "https://blog.datacite.org/eating-your-own-dog-food/"
|
63
69
|
response = subject.normalize_id(url)
|
64
70
|
expect(response).to eq("https://blog.datacite.org/eating-your-own-dog-food")
|
65
71
|
end
|
72
|
+
|
73
|
+
it "url with utf-8" do
|
74
|
+
url = "http://www.詹姆斯.com/eating-your-own-dog-food/"
|
75
|
+
response = subject.normalize_id(url)
|
76
|
+
expect(response).to eq("http://www.xn--8ws00zhy3a.com/eating-your-own-dog-food")
|
77
|
+
end
|
78
|
+
|
79
|
+
it "ftp" do
|
80
|
+
url = "ftp://blog.datacite.org/eating-your-own-dog-food/"
|
81
|
+
response = subject.normalize_id(url)
|
82
|
+
expect(response).to be_nil
|
83
|
+
end
|
84
|
+
|
85
|
+
it "invalid url" do
|
86
|
+
url = "http://"
|
87
|
+
response = subject.normalize_id(url)
|
88
|
+
expect(response).to be_nil
|
89
|
+
end
|
90
|
+
|
91
|
+
it "string" do
|
92
|
+
url = "eating-your-own-dog-food"
|
93
|
+
response = subject.normalize_id(url)
|
94
|
+
expect(response).to be_nil
|
95
|
+
end
|
66
96
|
end
|
67
97
|
|
68
98
|
context "normalize ids" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bolognese
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maremma
|
@@ -504,7 +504,12 @@ files:
|
|
504
504
|
- spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/https_url.yml
|
505
505
|
- spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/not_valid_doi_prefix.yml
|
506
506
|
- spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_id/doi.yml
|
507
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_id/doi_as_url.yml
|
508
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_id/ftp.yml
|
509
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_id/invalid_url.yml
|
510
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_id/string.yml
|
507
511
|
- spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_id/url.yml
|
512
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_id/url_with_utf-8.yml
|
508
513
|
- spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_ids/doi.yml
|
509
514
|
- spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_ids/url.yml
|
510
515
|
- spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_url/doi.yml
|