spec/crossref_spec.rb in bolognese-0.8.13 vs spec/crossref_spec.rb in bolognese-0.9
- old
+ new
@@ -299,6 +299,50 @@
expect(ris[13]).to eq("VL - 2012")
expect(ris[14]).to eq("SP - 1-7")
expect(ris[15]).to eq("ER - ")
end
end
+
+ context "get metadata as turtle" do
+ it "journal article" do
+ id = "10.7554/eLife.01567"
+ subject = Bolognese::Crossref.new(id: id)
+ expect(subject.valid?).to be true
+ ttl = subject.turtle.split("\n")
+ expect(ttl[0]).to eq("@prefix schema: <http://schema.org/> .")
+ expect(ttl[2]).to eq("<https://doi.org/10.7554/elife.01567> a schema:ScholarlyArticle;")
+ end
+
+ it "with pages" do
+ id = "https://doi.org/10.1155/2012/291294"
+ subject = Bolognese::Crossref.new(id: id)
+ expect(subject.valid?).to be true
+ ttl = subject.turtle.split("\n")
+ expect(ttl[0]).to eq("@prefix schema: <http://schema.org/> .")
+ expect(ttl[2]).to eq("<https://doi.org/10.1155/2012/291294> a schema:ScholarlyArticle;")
+ end
+ end
+
+ context "get metadata as rdf_xml" do
+ it "journal article" do
+ id = "10.7554/eLife.01567"
+ subject = Bolognese::Crossref.new(id: id)
+ expect(subject.valid?).to be true
+ rdf_xml = Maremma.from_xml(subject.rdf_xml).fetch("RDF", {})
+ expect(rdf_xml.dig("ScholarlyArticle", "rdf:about")).to eq("https://doi.org/10.7554/elife.01567")
+ expect(rdf_xml.dig("ScholarlyArticle", "name")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
+ expect(rdf_xml.dig("ScholarlyArticle", "datePublished", "__content__")).to eq("2014-02-11")
+ end
+
+ it "with pages" do
+ id = "https://doi.org/10.1155/2012/291294"
+ subject = Bolognese::Crossref.new(id: id)
+ expect(subject.valid?).to be true
+ rdf_xml = Maremma.from_xml(subject.rdf_xml).fetch("RDF", {})
+ expect(rdf_xml.dig("ScholarlyArticle", "rdf:about")).to eq("https://doi.org/10.1155/2012/291294")
+ expect(rdf_xml.dig("ScholarlyArticle", "name")).to eq("Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers")
+ expect(rdf_xml.dig("ScholarlyArticle", "datePublished", "__content__")).to eq("2012")
+ expect(rdf_xml.dig("ScholarlyArticle", "pageStart")).to eq("1")
+ expect(rdf_xml.dig("ScholarlyArticle", "pageEnd")).to eq("7")
+ end
+ end
end