Sha256: 66c2748a594a534d4f5c47df71822de16e29af5c595109838c051951d4dd4596

Contents?: true

Size: 1.68 KB

Versions: 11

Compression:

Stored size: 1.68 KB

Contents

require 'spec_helper'

describe Bolognese::Metadata, vcr: true do
  let(:input) { fixture_path + "crossref.ris" }

  subject { Bolognese::Metadata.new(input: input) }

  context "detect format" do
    it "extension" do
      expect(subject.valid?).to be true
    end

    it "string" do
      Bolognese::Metadata.new(input: IO.read(input).strip)
      expect(subject.valid?).to be true
      expect(subject.id).to eq("https://doi.org/10.7554/elife.01567")
    end
  end

  context "get ris raw" do
    it "Crossref DOI" do
      expect(subject.raw).to eq(IO.read(input).strip)
    end
  end

  context "get ris metadata" do
    it "Crossref DOI" do
      expect(subject.valid?).to be true
      expect(subject.id).to eq("https://doi.org/10.7554/elife.01567")
      expect(subject.type).to eq("ScholarlyArticle")
      expect(subject.url).to eq("http://elifesciences.org/lookup/doi/10.7554/eLife.01567")
      expect(subject.resource_type_general).to eq("Text")
      expect(subject.author.length).to eq(5)
      expect(subject.author.first).to eq("type"=>"Person",
                                         "name"=>"Martial Sankar",
                                         "givenName"=>"Martial",
                                         "familyName"=>"Sankar")
      expect(subject.title).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
      expect(subject.description["text"]).to start_with("Among various advantages, their small size makes model organisms preferred subjects of investigation.")
      expect(subject.date_published).to eq("2014")
      expect(subject.is_part_of).to eq("type"=>"Periodical", "title"=>"eLife")
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
bolognese-0.9.88 spec/readers/ris_reader_spec.rb
bolognese-0.9.87 spec/readers/ris_reader_spec.rb
bolognese-0.9.86 spec/readers/ris_reader_spec.rb
bolognese-0.9.85 spec/readers/ris_reader_spec.rb
bolognese-0.9.84 spec/readers/ris_reader_spec.rb
bolognese-0.9.83 spec/readers/ris_reader_spec.rb
bolognese-0.9.82 spec/readers/ris_reader_spec.rb
bolognese-0.9.81 spec/readers/ris_reader_spec.rb
bolognese-0.9.80 spec/readers/ris_reader_spec.rb
bolognese-0.9.79 spec/readers/ris_reader_spec.rb
bolognese-0.9.78 spec/readers/ris_reader_spec.rb