cirneco 0.9.12 → 0.9.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +124 -49
- data/cirneco.gemspec +5 -4
- data/lib/cirneco/api.rb +8 -8
- data/lib/cirneco/base.rb +2 -2
- data/lib/cirneco/cli.rb +1 -1
- data/lib/cirneco/utils.rb +48 -95
- data/lib/cirneco/version.rb +1 -1
- data/lib/cirneco/work.rb +8 -203
- data/spec/api_spec.rb +16 -28
- data/spec/doi_spec.rb +9 -11
- data/spec/fixtures/cool-dois-minted/index.html +189 -234
- data/spec/fixtures/cool-dois-minted.html.md +1 -1
- data/spec/fixtures/cool-dois.html.md +2 -2
- data/spec/fixtures/index-minted.html +1 -1
- data/spec/fixtures/index.html +50 -1
- data/spec/fixtures/index.html.erb +2 -2
- data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/get/should_get_all_dois_by_prefix.yml +20 -18
- data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/jats/should_generate_jats_for_all_urls.yml +38 -0
- data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_hide_for_all_urls.yml +20 -20
- data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_hide_for_url.yml +19 -17
- data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_hide_metadata_for_work.yml +19 -17
- data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_mint_and_hide_for_all_urls.yml +204 -108
- data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_mint_and_hide_for_url.yml +72 -64
- data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_mint_for_all_urls.yml +17 -291
- data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_post_metadata_for_work.yml +47 -82
- data/spec/fixtures/vcr_cassettes/Cirneco_Doi/MDS_DOI_API/get/should_get_all_dois.yml +22 -18
- data/spec/fixtures/vcr_cassettes/Cirneco_Doi/MDS_DOI_API/get/should_get_doi.yml +19 -17
- data/spec/fixtures/vcr_cassettes/Cirneco_Doi/MDS_DOI_API/put/should_put_doi.yml +20 -18
- data/spec/fixtures/vcr_cassettes/Cirneco_Doi/jats/writes_jats_for_list_of_urls.yml +38 -0
- data/spec/fixtures/vcr_cassettes/Cirneco_Doi/mint_and_hide_DOIs/hides_a_doi.yml +19 -17
- data/spec/fixtures/vcr_cassettes/Cirneco_Doi/mint_and_hide_DOIs/hides_dois_for_list_of_urls.yml +81 -0
- data/spec/fixtures/vcr_cassettes/Cirneco_Doi/mint_and_hide_DOIs/mints_and_hides_a_doi.yml +72 -64
- data/spec/fixtures/vcr_cassettes/Cirneco_Doi/mint_and_hide_DOIs/mints_and_hides_dois_for_list_of_urls.yml +204 -108
- data/spec/fixtures/vcr_cassettes/Cirneco_Doi/mint_and_hide_DOIs/mints_dois_for_list_of_urls.yml +17 -291
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/get/should_get_all_dois.yml +140 -18
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/get/should_get_doi.yml +137 -17
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/get/should_get_doi_not_found.yml +134 -16
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/get/username_missing.yml +121 -0
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/put/should_put_doi.yml +138 -18
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/Media_API/get/should_get_media.yml +135 -17
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/Media_API/post/should_post_media.yml +137 -17
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/Metadata_API/delete/should_delete_metadata.yml +137 -17
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/Metadata_API/get/should_get_metadata.yml +170 -27
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/Metadata_API/post/should_post_metadata.yml +173 -28
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/media/includes_media.yml +121 -0
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/schema/BlogPosting.yml +121 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/utils_spec.rb +28 -41
- data/spec/work_spec.rb +33 -43
- metadata +43 -19
- data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_mint_for_url.yml +0 -174
- data/spec/fixtures/vcr_cassettes/Cirneco_Doi/mint_and_hide_DOIs/mints_a_doi.yml +0 -174
data/lib/cirneco/work.rb
CHANGED
@@ -1,217 +1,22 @@
|
|
1
|
-
require '
|
2
|
-
require 'nokogiri'
|
3
|
-
|
1
|
+
require 'bolognese'
|
4
2
|
require_relative 'api'
|
5
3
|
require_relative 'utils'
|
6
4
|
require_relative 'base'
|
7
5
|
|
8
6
|
module Cirneco
|
9
|
-
class Work
|
7
|
+
class Work < Bolognese::Metadata
|
10
8
|
include Cirneco::Base
|
11
9
|
include Cirneco::Api
|
12
10
|
include Cirneco::Utils
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
def initialize(metadata, **options)
|
17
|
-
@doi = metadata.fetch("doi", nil)
|
18
|
-
@url = metadata.fetch("url", nil)
|
19
|
-
@creators = metadata.fetch("creators", nil)
|
20
|
-
@title = metadata.fetch("title", nil)
|
21
|
-
@publisher = metadata.fetch("publisher", nil)
|
22
|
-
@publication_year = metadata.fetch("publication_year", nil)
|
23
|
-
@resource_type = metadata.fetch("resource_type", nil)
|
24
|
-
@version = metadata.fetch("version", nil)
|
25
|
-
@rights_list = metadata.fetch("rights_list", nil)
|
26
|
-
@date_issued = metadata.fetch("date_issued", nil)
|
27
|
-
@date_created = metadata.fetch("date_created", nil)
|
28
|
-
@date_updated = metadata.fetch("date_updated", nil)
|
29
|
-
@subjects = metadata.fetch("subjects", nil)
|
30
|
-
@descriptions = metadata.fetch("descriptions", nil)
|
31
|
-
@contributors = metadata.fetch("contributors", nil)
|
32
|
-
@alternate_identifier = metadata.fetch("alternate_identifier", nil)
|
33
|
-
@related_identifiers = metadata.fetch("related_identifiers", nil)
|
34
|
-
@media = metadata.fetch("media", nil)
|
35
|
-
|
36
|
-
@username = options.fetch(:username, nil)
|
37
|
-
@password = options.fetch(:password, nil)
|
38
|
-
end
|
39
|
-
|
40
|
-
SCHEMA = File.expand_path("../../../resources/kernel-4.0/metadata.xsd", __FILE__)
|
41
|
-
|
42
|
-
def data
|
43
|
-
Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
|
44
|
-
xml.resource(root_attributes) do
|
45
|
-
insert_work(xml)
|
46
|
-
end
|
47
|
-
end.to_xml
|
48
|
-
end
|
12
|
+
attr_reader :media, :username, :password
|
49
13
|
|
50
|
-
def
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
insert_publisher(xml)
|
55
|
-
insert_publication_year(xml)
|
56
|
-
insert_resource_type(xml)
|
57
|
-
insert_alternate_identifiers(xml)
|
58
|
-
insert_subjects(xml)
|
59
|
-
insert_contributors(xml)
|
60
|
-
insert_dates(xml)
|
61
|
-
insert_related_identifiers(xml)
|
62
|
-
insert_version(xml)
|
63
|
-
insert_rights_list(xml)
|
64
|
-
insert_descriptions(xml)
|
65
|
-
end
|
66
|
-
|
67
|
-
def insert_identifier(xml)
|
68
|
-
xml.identifier(doi, 'identifierType' => "DOI")
|
69
|
-
end
|
70
|
-
|
71
|
-
def insert_creators(xml)
|
72
|
-
xml.creators do
|
73
|
-
Array(creators).each do |creator|
|
74
|
-
xml.creator do
|
75
|
-
insert_person(xml, creator, "creator")
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def insert_contributors(xml)
|
82
|
-
return xml unless contributors.present?
|
83
|
-
|
84
|
-
xml.contributors do
|
85
|
-
contributors.each do |contributor|
|
86
|
-
xml.contributor("contributorType" => contributor[:contributor_type]) do
|
87
|
-
insert_person(xml, contributor, "contributor")
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def insert_person(xml, person, type)
|
94
|
-
person_name = [person[:family_name], person[:given_name], person[:literal]].compact.join(", ")
|
95
|
-
|
96
|
-
xml.send(:'creatorName', person_name) if type == "creator"
|
97
|
-
xml.send(:'contributorName', person_name) if type == "contributor"
|
98
|
-
xml.send(:'givenName', person[:given_name]) if person[:given_name].present?
|
99
|
-
xml.send(:'familyName', person[:family_name]) if person[:family_name].present?
|
100
|
-
xml.nameIdentifier(person[:orcid], 'schemeURI' => 'http://orcid.org/', 'nameIdentifierScheme' => 'ORCID') if person[:orcid].present?
|
101
|
-
end
|
102
|
-
|
103
|
-
def insert_titles(xml)
|
104
|
-
xml.titles do
|
105
|
-
insert_title(xml)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def insert_title(xml)
|
110
|
-
xml.title(title)
|
111
|
-
end
|
112
|
-
|
113
|
-
def insert_publisher(xml)
|
114
|
-
xml.publisher(publisher)
|
115
|
-
end
|
116
|
-
|
117
|
-
def insert_publication_year(xml)
|
118
|
-
xml.publicationYear(publication_year)
|
119
|
-
end
|
120
|
-
|
121
|
-
def insert_resource_type(xml)
|
122
|
-
return xml unless resource_type.present?
|
123
|
-
|
124
|
-
xml.resourceType(resource_type[:value], 'resourceTypeGeneral' => resource_type[:resource_type_general])
|
125
|
-
end
|
126
|
-
|
127
|
-
def insert_alternate_identifiers(xml)
|
128
|
-
return xml unless alternate_identifier.present?
|
129
|
-
|
130
|
-
xml.alternateIdentifiers do
|
131
|
-
xml.alternateIdentifier(alternate_identifier, 'alternateIdentifierType' => "Local accession number")
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
def insert_dates(xml)
|
136
|
-
xml.dates do
|
137
|
-
insert_date(xml, date_created, 'Created') if date_created.present?
|
138
|
-
insert_date(xml, date_issued, 'Issued') if date_issued.present?
|
139
|
-
insert_date(xml, date_updated, 'Updated') if date_updated.present?
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
def insert_date(xml, date, date_type)
|
144
|
-
xml.date(date, 'dateType' => date_type)
|
145
|
-
end
|
146
|
-
|
147
|
-
def insert_subjects(xml)
|
148
|
-
return xml unless subjects.present?
|
149
|
-
|
150
|
-
xml.subjects do
|
151
|
-
subjects.each do |subject|
|
152
|
-
xml.subject(subject)
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
def insert_version(xml)
|
158
|
-
return xml unless version.present?
|
159
|
-
|
160
|
-
xml.version(version)
|
161
|
-
end
|
162
|
-
|
163
|
-
def insert_related_identifiers(xml)
|
164
|
-
return xml unless related_identifiers.present?
|
165
|
-
|
166
|
-
xml.relatedIdentifiers do
|
167
|
-
related_identifiers.each do |related_identifier|
|
168
|
-
xml.relatedIdentifier(related_identifier[:value], 'relatedIdentifierType' => related_identifier[:related_identifier_type], 'relationType' => related_identifier[:relation_type])
|
169
|
-
end
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
def insert_rights_list(xml)
|
174
|
-
return xml unless rights_list.present?
|
175
|
-
|
176
|
-
xml.rightsList do
|
177
|
-
rights_list.each do |rights|
|
178
|
-
xml.rights(rights[:value], 'rightsURI' => rights[:rights_uri])
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
def insert_descriptions(xml)
|
184
|
-
return xml unless descriptions.present?
|
185
|
-
|
186
|
-
xml.descriptions do
|
187
|
-
descriptions.each do |description|
|
188
|
-
xml.description(description[:value], 'descriptionType' => description[:description_type])
|
189
|
-
end
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
def without_control(s)
|
194
|
-
r = ''
|
195
|
-
s.each_codepoint do |c|
|
196
|
-
if c >= 32
|
197
|
-
r << c
|
198
|
-
end
|
199
|
-
end
|
200
|
-
r
|
201
|
-
end
|
202
|
-
|
203
|
-
def root_attributes
|
204
|
-
{ :'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
205
|
-
:'xsi:schemaLocation' => 'http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd',
|
206
|
-
:'xmlns' => 'http://datacite.org/schema/kernel-4' }
|
207
|
-
end
|
208
|
-
|
209
|
-
def schema
|
210
|
-
Nokogiri::XML::Schema(open(SCHEMA))
|
211
|
-
end
|
14
|
+
def initialize(input: nil, from: nil, format: nil, **options)
|
15
|
+
@media = options[:media]
|
16
|
+
@username = options[:username]
|
17
|
+
@password = options[:password]
|
212
18
|
|
213
|
-
|
214
|
-
@validation_errors ||= OpenStruct.new(body: { "errors" => schema.validate(Nokogiri::XML(data)).map { |error| { "title" => error.to_s } } })
|
19
|
+
return super(input: input, from: from, doi: options[:doi])
|
215
20
|
end
|
216
21
|
end
|
217
22
|
end
|
data/spec/api_spec.rb
CHANGED
@@ -1,20 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Cirneco::Work, vcr: true, :order => :defined do
|
4
|
-
let(:
|
5
|
-
let(:url) { "http://www.datacite.org" }
|
6
|
-
let(:creators) { [{ given_name: "Elizabeth", family_name: "Miller", orcid: "0000-0001-5000-0007", affiliation: "DataCite" }] }
|
7
|
-
let(:title) { "Full DataCite XML Example" }
|
8
|
-
let(:publisher) { "DataCite" }
|
9
|
-
let(:publication_year) { 2014 }
|
10
|
-
let(:resource_type) { { value: "XML", resource_type_general: "Software" } }
|
11
|
-
let(:metadata) { { "doi" => doi,
|
12
|
-
"url" => url,
|
13
|
-
"creators" => creators,
|
14
|
-
"title" => title,
|
15
|
-
"publisher" => publisher,
|
16
|
-
"publication_year" => publication_year,
|
17
|
-
"resource_type" => resource_type } }
|
4
|
+
let(:input) { "https://blog.datacite.org/eating-your-own-dog-food/" }
|
18
5
|
let(:media) { [{ mime_type: "application/pdf", url:"http://www.datacite.org/cirneco-test.pdf" }]}
|
19
6
|
let(:username) { ENV['MDS_USERNAME'] }
|
20
7
|
let(:password) { ENV['MDS_PASSWORD'] }
|
@@ -22,7 +9,7 @@ describe Cirneco::Work, vcr: true, :order => :defined do
|
|
22
9
|
let(:fixture_path) { "spec/fixtures/" }
|
23
10
|
let(:samples_path) { "resources/kernel-4.0/samples/" }
|
24
11
|
|
25
|
-
subject { Cirneco::Work.new(
|
12
|
+
subject { Cirneco::Work.new(input: input,
|
26
13
|
media: media,
|
27
14
|
username: username,
|
28
15
|
password: password) }
|
@@ -30,23 +17,23 @@ describe Cirneco::Work, vcr: true, :order => :defined do
|
|
30
17
|
describe "Metadata API" do
|
31
18
|
context "post" do
|
32
19
|
it 'should post metadata' do
|
33
|
-
response = subject.post_metadata(subject.
|
34
|
-
expect(response.body["data"]).to eq("OK (10.
|
20
|
+
response = subject.post_metadata(subject.datacite, options)
|
21
|
+
expect(response.body["data"]).to eq("OK (10.5438/4k3m-nyvg)")
|
35
22
|
expect(response.status).to eq(201)
|
36
|
-
expect(response.headers["Location"]).to eq("http://mds
|
23
|
+
expect(response.headers["Location"]).to eq("http://mds.test.datacite.org/metadata/10.5438/4k3m-nyvg")
|
37
24
|
end
|
38
25
|
end
|
39
26
|
|
40
27
|
context "get" do
|
41
28
|
it 'should get metadata' do
|
42
|
-
response = subject.get_metadata(doi, options)
|
43
|
-
expect(response.body["data"]).to eq(subject.
|
29
|
+
response = subject.get_metadata(subject.doi, options)
|
30
|
+
expect(response.body["data"]).to eq(subject.datacite)
|
44
31
|
end
|
45
32
|
end
|
46
33
|
|
47
34
|
context "delete" do
|
48
35
|
it 'should delete metadata' do
|
49
|
-
response = subject.delete_metadata(doi, options)
|
36
|
+
response = subject.delete_metadata(subject.doi, options)
|
50
37
|
expect(response.body["data"]).to eq("OK")
|
51
38
|
expect(response.status).to eq(200)
|
52
39
|
end
|
@@ -56,7 +43,8 @@ describe Cirneco::Work, vcr: true, :order => :defined do
|
|
56
43
|
describe "DOI API" do
|
57
44
|
describe "put" do
|
58
45
|
it 'should put doi' do
|
59
|
-
|
46
|
+
url = "http://www.datacite.org"
|
47
|
+
response = subject.put_doi(subject.doi, options.merge(url: url))
|
60
48
|
expect(response.body["data"]).to eq("OK")
|
61
49
|
expect(response.status).to eq(201)
|
62
50
|
end
|
@@ -66,23 +54,23 @@ describe Cirneco::Work, vcr: true, :order => :defined do
|
|
66
54
|
it 'should get all dois' do
|
67
55
|
response = subject.get_dois(options)
|
68
56
|
dois = response.body["data"]
|
69
|
-
expect(dois.length).to eq(
|
57
|
+
expect(dois.length).to eq(518)
|
70
58
|
expect(dois.first).to eq("10.23725/0000-03VC")
|
71
59
|
end
|
72
60
|
|
73
61
|
it 'should get doi' do
|
74
|
-
response = subject.get_doi(doi, options)
|
62
|
+
response = subject.get_doi(subject.doi, options)
|
75
63
|
expect(response.body["data"]).to eq("http://www.datacite.org")
|
76
64
|
end
|
77
65
|
|
78
66
|
it 'should get doi not found' do
|
79
|
-
response = subject.get_doi("10.
|
67
|
+
response = subject.get_doi("10.5438/0000-03V", options)
|
80
68
|
expect(response.status).to eq(404)
|
81
69
|
end
|
82
70
|
|
83
71
|
it 'username missing' do
|
84
72
|
options = { username: username, sandbox: true }
|
85
|
-
response = subject.get_doi(doi, options)
|
73
|
+
response = subject.get_doi(subject.doi, options)
|
86
74
|
expect(response.body).to eq("errors"=>[{"title"=>"Username or password missing"}])
|
87
75
|
end
|
88
76
|
end
|
@@ -91,7 +79,7 @@ describe Cirneco::Work, vcr: true, :order => :defined do
|
|
91
79
|
describe "Media API" do
|
92
80
|
describe "post" do
|
93
81
|
it 'should post media' do
|
94
|
-
response = subject.post_media(doi, options.merge(media: media))
|
82
|
+
response = subject.post_media(subject.doi, options.merge(media: media))
|
95
83
|
expect(response.body["data"]).to eq("OK")
|
96
84
|
expect(response.status).to eq(200)
|
97
85
|
end
|
@@ -99,7 +87,7 @@ describe Cirneco::Work, vcr: true, :order => :defined do
|
|
99
87
|
|
100
88
|
describe "get" do
|
101
89
|
it 'should get media' do
|
102
|
-
response = subject.get_media(doi, options)
|
90
|
+
response = subject.get_media(subject.doi, options)
|
103
91
|
media = response.body["data"]
|
104
92
|
expect(media.length).to eq(1)
|
105
93
|
expect(media.first).to eq(:mime_type=>"application/pdf", :url=>"http://www.datacite.org/cirneco-test.pdf")
|
data/spec/doi_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe Cirneco::Doi do
|
|
8
8
|
|
9
9
|
let(:number) { 123 }
|
10
10
|
let(:prefix) { ENV['PREFIX'] }
|
11
|
-
let(:doi) { "10.
|
11
|
+
let(:doi) { "10.5438/0000-03VC" }
|
12
12
|
let(:url) { "http://www.datacite.org" }
|
13
13
|
let(:filename) { 'cool-dois/index.html' }
|
14
14
|
let(:filepath) { fixture_path + filename }
|
@@ -64,7 +64,7 @@ describe Cirneco::Doi do
|
|
64
64
|
context "base32" do
|
65
65
|
it 'generates a doi' do
|
66
66
|
subject.options = { number: number, prefix: prefix }
|
67
|
-
expect { subject.generate }.to output("10.
|
67
|
+
expect { subject.generate }.to output("10.5438/0000-03VC\n").to_stdout
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'requires a prefix' do
|
@@ -89,41 +89,41 @@ describe Cirneco::Doi do
|
|
89
89
|
context "mint and hide DOIs", vcr: true, :order => :defined do
|
90
90
|
it 'mints a doi' do
|
91
91
|
subject.options = mint_options
|
92
|
-
expect { subject.mint filepath }.to output("DOI 10.
|
92
|
+
expect { subject.mint filepath }.to output("DOI 10.5438/0000-03VC minted for cool-dois.html.md\n").to_stdout
|
93
93
|
end
|
94
94
|
|
95
95
|
it 'hides a doi' do
|
96
96
|
filename = 'cool-dois-minted/index.html'
|
97
97
|
filepath = fixture_path + filename
|
98
98
|
subject.options = mint_options.merge(filepath: filepath)
|
99
|
-
expect { subject.hide filepath }.to output("DOI 10.
|
99
|
+
expect { subject.hide filepath }.to output("DOI 10.5438/55E5-T5C0 hidden for cool-dois-minted.html.md\n").to_stdout
|
100
100
|
end
|
101
101
|
|
102
102
|
it 'mints and hides a doi' do
|
103
103
|
subject.options = mint_options
|
104
|
-
expect { subject.mint_and_hide filepath }.to output("DOI 10.
|
104
|
+
expect { subject.mint_and_hide filepath }.to output("DOI 10.5438/0000-03VC minted and hidden for cool-dois.html.md\n").to_stdout
|
105
105
|
end
|
106
106
|
|
107
107
|
it 'mints dois for list of urls' do
|
108
108
|
filepath = fixture_path + 'index.html'
|
109
109
|
subject.options = mint_options
|
110
|
-
expect { subject.mint filepath }.to output("DOI 10.
|
110
|
+
expect { subject.mint filepath }.to output("DOI 10.5438/0000-03VC minted for cool-dois.html.md\nDOI 10.5438/0000-00SS minted for index.html.erb\n").to_stdout
|
111
111
|
end
|
112
112
|
|
113
113
|
it 'hides dois for list of urls' do
|
114
114
|
filepath = fixture_path + 'index.html'
|
115
115
|
subject.options = mint_options
|
116
|
-
expect { subject.hide filepath }.to output("No DOI for cool-dois.html.md\
|
116
|
+
expect { subject.hide filepath }.to output("No DOI for cool-dois.html.md\nDOI 10.5438/0000-00SS hidden for index.html.erb\n").to_stdout
|
117
117
|
end
|
118
118
|
|
119
119
|
it 'mints and hides dois for list of urls' do
|
120
120
|
filepath = fixture_path + 'index.html'
|
121
121
|
subject.options = mint_options
|
122
|
-
expect { subject.mint_and_hide filepath }.to output("DOI 10.
|
122
|
+
expect { subject.mint_and_hide filepath }.to output("DOI 10.5438/0000-03VC minted and hidden for cool-dois.html.md\nDOI 10.5438/0000-00SS minted and hidden for index.html.erb\n").to_stdout
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
|
-
context "jats" do
|
126
|
+
context "jats", vcr: true do
|
127
127
|
it 'writes jats for list of urls' do
|
128
128
|
filepath = fixture_path + 'index.html'
|
129
129
|
subject.options = mint_options
|
@@ -131,5 +131,3 @@ describe Cirneco::Doi do
|
|
131
131
|
end
|
132
132
|
end
|
133
133
|
end
|
134
|
-
|
135
|
-
|