Sha256: c100e2ab76fecd80d45e7fb60d0acc9f49228e5a8c33fb5c3fa94ec807368466

Contents?: true

Size: 1.33 KB

Versions: 144

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

require 'puppet_spec/compiler'
require 'matchers/resource'

describe 'the upcase function' do
  include PuppetSpec::Compiler
  include Matchers::Resource

  it 'returns upper case version of a string' do
    expect(compile_to_catalog("notify { 'abc'.upcase: }")).to have_resource('Notify[ABC]')
  end

  it 'returns the value if Numeric' do
    expect(compile_to_catalog("notify { String(42.upcase == 42): }")).to have_resource('Notify[true]')
  end

  it 'performs upcase of international UTF-8 characters' do
    expect(compile_to_catalog("notify { 'åäö'.upcase: }")).to have_resource('Notify[ÅÄÖ]')
  end

  it 'returns upper case version of each entry in an array (recursively)' do
    expect(compile_to_catalog("notify { String(['a', ['b', ['c']]].upcase == ['A', ['B', ['C']]]): }")).to have_resource('Notify[true]')
  end

  it 'returns upper case version of keys and values in a hash (recursively)' do
    expect(compile_to_catalog("notify { String({'a'=>'b','c'=>{'d'=>'e'}}.upcase == {'A'=>'B', 'C'=>{'D'=>'E'}}): }")).to have_resource('Notify[true]')
  end

  it 'returns upper case version of keys and values in nested hash / array structure' do
    expect(compile_to_catalog("notify { String({'a'=>['b'],'c'=>[{'d'=>'e'}]}.upcase == {'A'=>['B'],'C'=>[{'D'=>'E'}]}): }")).to have_resource('Notify[true]')
  end

end

Version data entries

144 entries across 144 versions & 1 rubygems

Version Path
puppet-8.3.0 spec/unit/functions/upcase_spec.rb
puppet-8.3.0-x86-mingw32 spec/unit/functions/upcase_spec.rb
puppet-8.3.0-x64-mingw32 spec/unit/functions/upcase_spec.rb
puppet-8.3.0-universal-darwin spec/unit/functions/upcase_spec.rb
puppet-8.4.0 spec/unit/functions/upcase_spec.rb
puppet-8.4.0-x86-mingw32 spec/unit/functions/upcase_spec.rb
puppet-8.4.0-x64-mingw32 spec/unit/functions/upcase_spec.rb
puppet-8.4.0-universal-darwin spec/unit/functions/upcase_spec.rb
puppet-7.28.0 spec/unit/functions/upcase_spec.rb
puppet-7.28.0-x86-mingw32 spec/unit/functions/upcase_spec.rb
puppet-7.28.0-x64-mingw32 spec/unit/functions/upcase_spec.rb
puppet-7.28.0-universal-darwin spec/unit/functions/upcase_spec.rb
puppet-8.3.1 spec/unit/functions/upcase_spec.rb
puppet-8.3.1-x86-mingw32 spec/unit/functions/upcase_spec.rb
puppet-8.3.1-x64-mingw32 spec/unit/functions/upcase_spec.rb
puppet-8.3.1-universal-darwin spec/unit/functions/upcase_spec.rb
puppet-7.27.0 spec/unit/functions/upcase_spec.rb
puppet-7.27.0-x86-mingw32 spec/unit/functions/upcase_spec.rb
puppet-7.27.0-x64-mingw32 spec/unit/functions/upcase_spec.rb
puppet-7.27.0-universal-darwin spec/unit/functions/upcase_spec.rb