Sha256: b189c2533332c9e8d9e233a365b96621ba9c832f0798dee1d29de2bcfd1ebfc5

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

module CSL
  describe Style do
    let(:style) { Style.new }
  
    it 'has a 1.x version by default' do
      Style.new[:version].should match(/1\.\d+(\.\d+)?/) 
    end
    
    describe '#to_xml' do
      it 'returns an empty style' do
        Style.new.to_xml.should match(/<style[^>]*\/>/)
      end
      
      it 'supports round-trip for apa style' do
        Style.parse(Style.load(:apa).to_xml).should be_a(Style)
      end
    end

    describe '#children' do
    
      it { should_not have_info }
      it { should_not have_locale }
      it { should_not have_macro }
      it { should_not have_citation }
      it { should_not have_bibliography }
      
      describe 'when it has a title' do
        before(:all) { style.title = 'foo' }
        
        it { style.should have_info }
        
        it 'info.title is a text node' do
          style.info.title.should be_a(TextNode)
        end
        
        it '#title returns the title as a string' do
          style.title.should be_a(String)
        end
      end
    end
    
    describe '#id accessor' do
      
      it 'returns nil by default' do
        Style.new.id.should be_nil
      end
      
      it 'writer sets the id to the passed-in string' do
        expect { style.id = 'foobar' }.to change { style.id }.from(nil).to('foobar')
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
csl-1.0.0.pre3 spec/csl/style_spec.rb