Sha256: 4cf04a6c5342222464cd4cd1ebb01d44a663cdad35f06bca8994c3341e581cd0

Contents?: true

Size: 906 Bytes

Versions: 4

Compression:

Stored size: 906 Bytes

Contents

require 'spec_helper'

module CiteProc
  module Ruby

    describe 'Renderer#render_layout' do
      let(:renderer) { Renderer.new }

      let(:node) { CSL::Style::Layout.new }

      let(:item) {
        i = CiteProc::CitationItem.new(:id => 'ID-1')
        i.data = CiteProc::Item.new(:id => 'ID-1')
        i
      }

      it 'returns an empty string when empty' do
        renderer.render(item, node).should == ''
      end

      describe 'with child nodes' do
        before(:each) do
          node << CSL::Style::Text.new(:value => 'foo')
          node << CSL::Style::Text.new(:value => 'bar')
        end

        it 'renders each child' do
          renderer.render(item, node).should == 'foobar'
        end

        it 'uses the delimiters if specified' do
          node[:delimiter] = '-'
          renderer.render(item, node).should == 'foo-bar'
        end
      end

    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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