Sha256: eb6b0e5c5ea311b79db4e665e8c32ab8c8855a314297f44c999226dc1592fc3c

Contents?: true

Size: 1.82 KB

Versions: 4

Compression:

Stored size: 1.82 KB

Contents

module CSL

  describe Style do
  
    let(:style) { Style.new }
    let(:apa) { Style.new.open('apa') }
    
    describe '#open' do
      it 'accepts a style name' do
        style.open('apa').id.should_not be_empty
      end
    
      it 'accepts a filename' do
        style.open(File.expand_path('../../../resource/style/apa.csl', __FILE__)).id.should_not be_empty
      end

      it 'accepts an inline style' do
        style.open(File.read(File.expand_path('../../../resource/style/apa.csl', __FILE__))).id.should_not be_empty
      end

      # -- requires internet connection
      # it 'accepts an URI' do
      #   style.open 'http://www.zotero.org/styles/apa'
      #   style.id.should == 'http://www.zotero.org/styles/apa'
      # end
    
    end
  
    describe 'info' do
      it 'returns id, title, and link information' do
        # style.id.should == 'http://www.zotero.org/styles/apa'
        # style.link.should == 'http://www.zotero.org/styles/apa'
        apa.title.should == 'American Psychological Association'
      end
    end
  
    describe 'macros' do
      it 'initialises a macros hash' do
        apa.macros.keys.sort.should == ["access", "author", "author-short", "citation-locator", "container-contributors", "edition", "event", "issued", "issued-year", "locators", "publisher", "secondary-contributors", "title"]
        apa.macros.values.map(&:class).uniq.should == [CSL::Nodes::Macro]
      end
    end
  
    describe 'citation renderer' do
      it 'initialises the citation renderer' do
        apa.citation.respond_to?(:process)
      end
    
      it 'contains a layout section' do
        apa.citation.layout.should_not == nil
      end
    
    end

    describe 'bibliography renderer' do
      it 'initialises the bibliography renderer' do
        apa.bibliography.should_not == nil
      end
    end
  
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
citeproc-ruby-0.0.4 spec/csl/style_spec.rb
citeproc-ruby-0.0.3 spec/csl/style_spec.rb
citeproc-ruby-0.0.2 spec/csl/style_spec.rb
citeproc-ruby-0.0.1 spec/csl/style_spec.rb