Sha256: a540095bc1a5680cdbf1ff50be8e0b64221872e32340fac7e847872d2fb5a43c

Contents?: true

Size: 1.16 KB

Versions: 79

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'
require 'puppet/pops'

describe Puppet::Pops::LabelProvider do
  let(:labeler) { Puppet::Pops::LabelProvider.new }

  it "prefixes words that start with a vowel with an 'an'" do
    labeler.a_an('owl').should == 'an owl'
  end

  it "prefixes words that start with a consonant with an 'a'" do
    labeler.a_an('bear').should == 'a bear'
  end

  it "prefixes non-word characters with an 'a'" do
    labeler.a_an('[] expression').should == 'a [] expression'
  end

  it "ignores a single quote leading the word" do
    labeler.a_an("'owl'").should == "an 'owl'"
  end

  it "ignores a double quote leading the word" do
    labeler.a_an('"owl"').should == 'an "owl"'
  end

  it "capitalizes the indefinite article for a word when requested" do
    labeler.a_an_uc('owl').should == 'An owl'
  end

  it "raises an error when missing a character to work with" do
    expect {
      labeler.a_an('"')
    }.to raise_error(Puppet::DevError, /<"> does not appear to contain a word/)
  end

  it "raises an error when given an empty string" do
    expect {
      labeler.a_an('')
    }.to raise_error(Puppet::DevError, /<> does not appear to contain a word/)
  end
end

Version data entries

79 entries across 79 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/unit/pops/label_provider_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/pops/label_provider_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/pops/label_provider_spec.rb
puppet-3.8.6 spec/unit/pops/label_provider_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/pops/label_provider_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/pops/label_provider_spec.rb
puppet-3.8.5 spec/unit/pops/label_provider_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/pops/label_provider_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/pops/label_provider_spec.rb
puppet-3.8.4 spec/unit/pops/label_provider_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/pops/label_provider_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/pops/label_provider_spec.rb
puppet-3.8.3 spec/unit/pops/label_provider_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/pops/label_provider_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/pops/label_provider_spec.rb
puppet-3.8.2 spec/unit/pops/label_provider_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/pops/label_provider_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/pops/label_provider_spec.rb
puppet-3.8.1 spec/unit/pops/label_provider_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/pops/label_provider_spec.rb