Sha256: 47a4205c6767308331779dc2c002c108d13d06e3b90db970fb9910f2e04afefa

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

module CiteProc
  module Ruby

    describe Renderer::History do
      let(:state) { Renderer::State.new }
      let(:history) { state.history }

      it 'has an empty citation history' do
        history.memory['citation'].should == []
      end

      it 'has an empty bibliography history' do
        history.memory['bibliogrpahy'].should == []
      end

      describe '#update' do
        it 'saves the passed in items for :store!' do
          lambda {
            history.update :store!, 'citation', { :x => 1 }
          }.should change { history.citation }.to([{ :x => 1 }])
        end

        it 'drops remembered items when they are too old' do
          lambda {
            history.update :store!, 'citation', { :x => 1 }
            history.update :store!, 'citation', { :x => 1 }
            history.update :store!, 'citation', { :x => 1 }
            history.update :store!, 'citation', { :x => 1 }
            history.update :store!, 'citation', { :x => 1 }
          }.should change { history.citation.length }.to(3)
        end
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
citeproc-ruby-1.0.2 spec/citeproc/ruby/renderer/history_spec.rb
citeproc-ruby-1.0.1 spec/citeproc/ruby/renderer/history_spec.rb
citeproc-ruby-1.0.0 spec/citeproc/ruby/renderer/history_spec.rb