Sha256: b7cedb27a32659977d2ed1b9525a4e4994fa44c497127a23bcb9236125948a8b

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

require './spec/spec_helper'

describe CiteroRenderers::RisRenderable do

  context 'object is an array' do
    let(:ris_renderable_array) { array.extend CiteroRenderers::RisRenderable }
    context 'array is empty' do
      let(:array) { Array.new }
      it 'returns an empty string' do
        expect(ris_renderable_array.to_ris).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(ris_renderable_array.to_ris).to eql("TY  - BOOK\nER  -\n\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(ris_renderable_array.to_ris).to eql("TY  - BOOK\nER  -\n\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(ris_renderable_array.to_ris).to eql("TY  - BOOK\nER  -\n\n\n\nTY  - BOOK\nER  -\n\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(ris_renderable_array.to_ris).to eql("TY  - BOOK\nER  -\n\n\n\nTY  - BOOK\nER  -\n\n")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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