spec/codemeta_spec.rb in bolognese-0.7.1 vs spec/codemeta_spec.rb in bolognese-0.7.2

- old
+ new

@@ -20,11 +20,11 @@ expect(subject.date_modified).to eq("2017-02-24") expect(subject.publisher).to eq("@type"=>"Organization", "name"=>"DataCite") end it "maremma 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.5438/qeg0-3gm3") expect(json["name"]).to eq("Maremma: a Ruby library for simplified network calls") expect(json["author"]).to eq("@type"=>"person", "@id"=>"http://orcid.org/0000-0003-0077-4738", "name"=>"Martin Fenner") end @@ -89,12 +89,11 @@ context "get metadata as datacite xml" do it "rdataone" do string = IO.read(fixture_path + 'codemeta.json') subject = Bolognese::Codemeta.new(string: string) - 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("titles", "title")).to eq("R Interface to the DataONE REST API") expect(datacite.dig("creators", "creator")).to eq([{"creatorName"=>"Matt Jones", "nameIdentifier"=> {"schemeURI"=>"http://orcid.org/", "nameIdentifierScheme"=>"ORCID", @@ -107,22 +106,21 @@ {"creatorName"=>"University of California, Santa Barbara"}]) expect(datacite.fetch("version")).to eq("2.0.0") end it "maremma" 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("titles", "title")).to eq("Maremma: a Ruby library for simplified network calls") expect(datacite.dig("creators", "creator")).to eq("creatorName"=>"Martin Fenner", "nameIdentifier"=>{"schemeURI"=>"http://orcid.org/", "nameIdentifierScheme"=>"ORCID", "__content__"=>"http://orcid.org/0000-0003-0077-4738"}) end end context "get metadata as schema.org JSON" do it "rdataone" do string = IO.read(fixture_path + 'codemeta.json') subject = Bolognese::Codemeta.new(string: string) - json = JSON.parse(subject.as_schema_org) + json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.5063/f1m61h5x") expect(json["@type"]).to eq("SoftwareSourceCode") expect(json["name"]).to eq("R Interface to the DataONE REST API") expect(json["author"]).to eq([{"@type"=>"person", "@id"=>"http://orcid.org/0000-0003-0077-4738", @@ -134,20 +132,20 @@ "name"=>"University of California, Santa Barbara"}]) expect(json["version"]).to eq("2.0.0") end it "maremma" do - json = JSON.parse(subject.as_schema_org) + json = JSON.parse(subject.schema_org) expect(json["@id"]).to eq("https://doi.org/10.5438/qeg0-3gm3") expect(json["@type"]).to eq("SoftwareSourceCode") expect(json["name"]).to eq("Maremma: a Ruby library for simplified network calls") expect(json["author"]).to eq("@type"=>"person", "@id"=>"http://orcid.org/0000-0003-0077-4738", "name"=>"Martin Fenner") end end context "get metadata as bibtex" do it "maremma" 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("misc") expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.5438/qeg0-3gm3") expect(bibtex[:doi]).to eq("10.5438/qeg0-3gm3") expect(bibtex[:url]).to eq("https://github.com/datacite/maremma") expect(bibtex[:title]).to eq("Maremma: a Ruby library for simplified network calls")