spec/crossref_spec.rb in bolognese-0.7.1 vs spec/crossref_spec.rb in bolognese-0.7.2
- old
+ new
@@ -157,19 +157,19 @@
expect(subject.id).to be_nil
expect(subject.exists?).to be false
end
it "Schema.org JSON" do
- json = JSON.parse(subject.as_schema_org)
+ json = JSON.parse(subject.schema_org)
expect(json["@id"]).to eq("https://doi.org/10.7554/elife.01567")
end
end
context "get metadata as string" do
it "DOI with data citation" do
id = "10.7554/eLife.01567"
- string = Bolognese::Crossref.new(id: id).as_crossref
+ string = Bolognese::Crossref.new(id: id).crossref
subject = Bolognese::Crossref.new(string: string)
expect(subject.id).to eq("https://doi.org/10.7554/elife.01567")
expect(subject.url).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
expect(subject.type).to eq("ScholarlyArticle")
@@ -191,41 +191,38 @@
end
end
context "get metadata as datacite xml" do
it "with data citation" do
- expect(subject.validation_errors).to be_empty
- datacite = Maremma.from_xml(subject.as_datacite).fetch("resource", {})
+ datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text")
expect(datacite.dig("titles", "title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
expect(datacite.dig("relatedIdentifiers", "relatedIdentifier").count).to eq(25)
expect(datacite.dig("fundingReferences", "fundingReference").count).to eq(4)
expect(datacite.dig("fundingReferences", "fundingReference").last).to eq("funderName"=>"University of Lausanne", "funderIdentifier"=>{"funderIdentifierType"=>"Crossref Funder ID", "__content__"=>"https://doi.org/10.13039/501100006390"})
end
it "with ORCID ID" do
id = "https://doi.org/10.1155/2012/291294"
subject = Bolognese::Crossref.new(id: id)
- expect(subject.validation_errors).to be_empty
- datacite = Maremma.from_xml(subject.as_datacite).fetch("resource", {})
+ datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
expect(datacite.dig("resourceType", "resourceTypeGeneral")).to eq("Text")
expect(datacite.dig("creators", "creator").count).to eq(7)
expect(datacite.dig("creators", "creator").first).to eq("creatorName"=>"Thanassi, Wendy", "givenName"=>"Wendy", "familyName"=>"Thanassi")
end
it "with editor" do
id = "https://doi.org/10.1371/journal.pone.0000030"
subject = Bolognese::Crossref.new(id: id)
- expect(subject.validation_errors).to be_empty
- datacite = Maremma.from_xml(subject.as_datacite).fetch("resource", {})
+ datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
expect(datacite.dig("contributors", "contributor")).to eq("contributorType"=>"Editor", "contributorName"=>"Janbon, Guilhem", "givenName"=>"Guilhem", "familyName"=>"Janbon")
end
end
context "get metadata as bibtex" do
it "with data citation" do
- bibtex = BibTeX.parse(subject.as_bibtex).to_a(quotes: '').first
+ bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
expect(bibtex[:bibtex_type].to_s).to eq("article")
expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.7554/elife.01567")
expect(bibtex[:doi]).to eq("10.7554/eLife.01567")
expect(bibtex[:url]).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
expect(bibtex[:title]).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
@@ -235,10 +232,10 @@
end
it "with pages" do
id = "https://doi.org/10.1155/2012/291294"
subject = Bolognese::Crossref.new(id: id)
- bibtex = BibTeX.parse(subject.as_bibtex).to_a(quotes: '').first
+ bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
expect(bibtex[:bibtex_type].to_s).to eq("article")
expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.1155/2012/291294")
expect(bibtex[:doi]).to eq("10.1155/2012/291294")
expect(bibtex[:url]).to eq("http://www.hindawi.com/journals/pm/2012/291294/")
expect(bibtex[:title]).to eq("Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers")