Sha256: aa696877aceb270c4e32237782b5c6e42b1ffcdbec4814ef0b8eec98deaf8ea7

Contents?: true

Size: 1.39 KB

Versions: 7

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'

module CSL
  describe Style::Label do

    it { should_not be_names_label }
    it { should_not be_always_pluralize }
    it { should_not be_never_pluralize }

    describe '.terms' do
      Hash[%w{
        page              page
        issue             issue
        edition           edition
        number-of-pages   page
        number-of-volumes volume
        chapter-number    chapter
      }].each do |variable, term|
        it "returns #{term.inspect} for #{variable.inspect}" do
          Label.terms[variable].should == term
        end
      end
    end

    describe 'a label inside a names node' do
      before(:each) { Style::Names.new << subject }

      it { should be_names_label }

      describe '#variable' do
        before(:each) { subject.parent[:variable] = 'editor' }

        it 'returns the names variable(s)' do
          subject.variable.should == 'editor'
        end

        it 'returns the names variable(s) even when the local attribute is set' do
          subject[:variable] = 'page'
          subject.variable.should == 'editor'
        end
      end
    end

    describe '#term' do
      it { should be_empty }

      it 'returns the term for the current variable' do
        subject[:variable] = 'page'
        subject.term.should == 'page'

        subject[:variable] = 'number-of-volumes'
        subject.term.should == 'volume'
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
csl-1.0.0.pre21 spec/csl/style/label_spec.rb
csl-1.0.0.pre20 spec/csl/style/label_spec.rb
csl-1.0.0.pre19 spec/csl/style/label_spec.rb
csl-1.0.0.pre18 spec/csl/style/label_spec.rb
csl-1.0.0.pre17 spec/csl/style/label_spec.rb
csl-1.0.0.pre16 spec/csl/style/label_spec.rb
csl-1.0.0.pre15 spec/csl/style/label_spec.rb