Sha256: 2333d5b96ca8d6e8909c0167f39c7fa7d1148a3d67edcfa1c9494d5d5a06c269

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

require './spec/spec_helper'

describe CiteroRenderers::BibtexRenderable do

  context 'object is an array' do
    let(:bibtex_renderable_array) { array.extend CiteroRenderers::BibtexRenderable }
    context 'array is empty' do
      let(:array) { Array.new }
      it 'returns an empty string' do
        expect(bibtex_renderable_array.to_bibtex).to eql('')
      end
    end
    context 'array has one citero object' do
      let(:array) { [Citero.map("itemType: book").from_csf] }
      it 'returns an empty string' do
        expect(bibtex_renderable_array.to_bibtex).to eql("@book{????\n}")
      end
    end
    context 'array has one active record' do
      let(:array) { [RecordChangedField.create!(data: "itemType: book", from_format: "csf")] }
      it 'returns an empty string' do
        expect(bibtex_renderable_array.to_bibtex).to eql("@book{????\n}")
      end
    end
    context 'array has many citero objects' do
      let(:array) { [Citero.map("itemType: book").from_csf, Citero.map("itemType: book").from_csf] }
      it 'returns an empty string' do
        expect(bibtex_renderable_array.to_bibtex).to eql("@book{????\n}\n\n@book{????\n}")
      end
    end
    context 'array has many active records' do
      let(:array) { [RecordChangedField.create!(data: "itemType: book", from_format: "csf"),
                     RecordChangedField.create!(data: "itemType: book", from_format: "csf")] }
      it 'returns an empty string' do
        expect(bibtex_renderable_array.to_bibtex).to eql("@book{????\n}\n\n@book{????\n}")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
citero_renderers-1.0.1 spec/lib/bibtex_renderable_spec.rb