Sha256: 473d4e5c483edcff5384ea234dbd1a8aea71c42a60ea5b5453b0c2b2877eaa6d

Contents?: true

Size: 1.08 KB

Versions: 11

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

module CSL
  describe Style::Label do

    it { is_expected.not_to be_names_label }
    it { is_expected.not_to be_always_pluralize }
    it { is_expected.not_to 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
          expect(Style::Label.terms[variable]).to eq(term)
        end
      end
    end

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

      it { is_expected.to be_names_label }
    end

    describe '#term' do
      it { is_expected.to be_empty }

      it 'returns the term for the current variable' do
        subject[:variable] = 'page'
        expect(subject.term).to eq('page')

        subject[:variable] = 'number-of-volumes'
        expect(subject.term).to eq('volume')
      end
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
csl-1.4.5 spec/csl/style/label_spec.rb
csl-1.4.4 spec/csl/style/label_spec.rb
csl-1.4.3 spec/csl/style/label_spec.rb
csl-1.4.2 spec/csl/style/label_spec.rb
csl-1.4.1 spec/csl/style/label_spec.rb
csl-1.4.0 spec/csl/style/label_spec.rb
csl-1.3.2 spec/csl/style/label_spec.rb
csl-1.3.1 spec/csl/style/label_spec.rb
csl-1.3.0 spec/csl/style/label_spec.rb
csl-1.2.3 spec/csl/style/label_spec.rb
csl-1.2.2 spec/csl/style/label_spec.rb