spec/crossref_spec.rb in bolognese-0.5 vs spec/crossref_spec.rb in bolognese-0.5.1
- old
+ new
@@ -8,10 +8,11 @@
context "get metadata" do
it "DOI with data citation" do
expect(subject.id).to eq("https://doi.org/10.7554/elife.01567")
expect(subject.type).to eq("ScholarlyArticle")
expect(subject.additional_type).to eq("JournalArticle")
+ expect(subject.resource_type_general).to eq("Text")
expect(subject.author).to eq([{"@type"=>"Person", "givenName"=>"Martial", "familyName"=>"Sankar"},
{"@type"=>"Person", "givenName"=>"Kaisa", "familyName"=>"Nieminen"},
{"@type"=>"Person", "givenName"=>"Laura", "familyName"=>"Ragni"},
{"@type"=>"Person", "givenName"=>"Ioannis", "familyName"=>"Xenarios"},
{"@type"=>"Person", "givenName"=>"Christian S", "familyName"=>"Hardtke"}])
@@ -29,10 +30,11 @@
id = "https://doi.org/10.1371/journal.pone.0000030"
subject = Bolognese::Crossref.new(id: id)
expect(subject.id).to eq(id)
expect(subject.type).to eq("ScholarlyArticle")
expect(subject.additional_type).to eq("JournalArticle")
+ expect(subject.resource_type_general).to eq("Text")
expect(subject.author).to eq([{"@type"=>"Person", "givenName"=>"Markus", "familyName"=>"Ralser"},
{"@type"=>"Person", "givenName"=>"Gino", "familyName"=>"Heeren"},
{"@type"=>"Person", "givenName"=>"Michael", "familyName"=>"Breitenbach"},
{"@type"=>"Person", "givenName"=>"Hans", "familyName"=>"Lehrach"},
{"@type"=>"Person", "givenName"=>"Sylvia", "familyName"=>"Krobitsch"}])
@@ -48,12 +50,13 @@
it "posted_content" do
id = "https://doi.org/10.1101/097196"
subject = Bolognese::Crossref.new(id: id)
expect(subject.id).to eq(id)
- expect(subject.type).to eq("CreativeWork")
+ expect(subject.type).to eq("ScholarlyArticle")
expect(subject.additional_type).to eq("PostedContent")
+ expect(subject.resource_type_general).to eq("Text")
expect(subject.author.count).to eq(10)
expect(subject.author.last).to eq("@type"=>"Person", "@id"=>"http://orcid.org/0000-0003-4060-7360", "givenName"=>"Timothy", "familyName"=>"Clark")
expect(subject.name).to eq("A Data Citation Roadmap for Scholarly Data Repositories")
expect(subject.alternate_name).to eq("biorxiv;097196v1")
expect(subject.description).to start_with("This article presents a practical roadmap")
@@ -67,10 +70,11 @@
id = "https://doi.org/10.1890/0012-9658(2006)87[2832:tiopma]2.0.co;2"
subject = Bolognese::Crossref.new(id: id)
expect(subject.id).to eq("https://doi.org/10.1890/0012-9658(2006)87%5B2832:tiopma%5D2.0.co;2")
expect(subject.type).to eq("ScholarlyArticle")
expect(subject.additional_type).to eq("JournalArticle")
+ expect(subject.resource_type_general).to eq("Text")
expect(subject.author).to eq([{"@type"=>"Person", "givenName"=>"A.", "familyName"=>"Fenton"}, {"@type"=>"Person", "givenName"=>"S. A.", "familyName"=>"Rands"}])
expect(subject.license).to eq("http://doi.wiley.com/10.1002/tdm_license_1")
expect(subject.name).to eq("THE IMPACT OF PARASITE MANIPULATION AND PREDATOR FORAGING BEHAVIOR ON PREDATOR–PREY COMMUNITIES")
expect(subject.date_published).to eq("2006-11")
expect(subject.date_modified).to eq("2016-10-04T17:20:17Z")
@@ -84,10 +88,11 @@
id = "https://doi.org/10.1155/2012/291294"
subject = Bolognese::Crossref.new(id: id)
expect(subject.id).to eq("https://doi.org/10.1155/2012/291294")
expect(subject.type).to eq("ScholarlyArticle")
expect(subject.additional_type).to eq("JournalArticle")
+ expect(subject.resource_type_general).to eq("Text")
expect(subject.author).to eq([{"@type"=>"Person", "givenName"=>"Wendy", "familyName"=>"Thanassi"},
{"@type"=>"Person", "givenName"=>"Art", "familyName"=>"Noda"},
{"@type"=>"Person",
"@id"=>"http://orcid.org/0000-0003-2043-4925",
"givenName"=>"Beatriz",
@@ -110,10 +115,11 @@
id = "https://doi.org/10.1016/j.ejphar.2015.03.018"
subject = Bolognese::Crossref.new(id: id)
expect(subject.id).to eq(id)
expect(subject.type).to eq("ScholarlyArticle")
expect(subject.additional_type).to eq("JournalArticle")
+ expect(subject.resource_type_general).to eq("Text")
expect(subject.author).to eq([{"@type"=>"Person", "givenName"=>"Sarah E.", "familyName"=>"Beck"},
{"@type"=>"Person", "givenName"=>"Suzanne E.", "familyName"=>"Queen"},
{"@type"=>"Person", "givenName"=>"Kenneth W.", "familyName"=>"Witwer"},
{"@type"=>"Person", "givenName"=>"Kelly A.", "familyName"=>"Metcalf Pate"},
{"@type"=>"Person", "givenName"=>"Lisa M.", "familyName"=>"Mangus"},
@@ -149,10 +155,11 @@
subject = Bolognese::Crossref.new(string: string)
expect(subject.id).to eq("https://doi.org/10.7554/elife.01567")
expect(subject.type).to eq("ScholarlyArticle")
expect(subject.additional_type).to eq("JournalArticle")
+ expect(subject.resource_type_general).to eq("Text")
expect(subject.author).to eq([{"@type"=>"Person", "givenName"=>"Martial", "familyName"=>"Sankar"},
{"@type"=>"Person", "givenName"=>"Kaisa", "familyName"=>"Nieminen"},
{"@type"=>"Person", "givenName"=>"Laura", "familyName"=>"Ragni"},
{"@type"=>"Person", "givenName"=>"Ioannis", "familyName"=>"Xenarios"},
{"@type"=>"Person", "givenName"=>"Christian S", "familyName"=>"Hardtke"}])
@@ -169,18 +176,20 @@
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", {})
+ 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)
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", {})
+ 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