Sha256: 565f3431609a9a2c57d55f75d6676cb74e1a6e686100fd86bcdd75fafd42acdc

Contents?: true

Size: 1.34 KB

Versions: 588

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

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

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

  it 'produces the type of a given value with default detailed quality' do
  expect(compile_to_catalog('notify { "${ type([2, 3.14]) }": }')).to have_resource(
      'Notify[Tuple[Integer[2, 2], Float[3.14, 3.14]]]')
  end

  it 'produces the type of a give value with detailed quality when quality is given' do
    expect(compile_to_catalog('notify { "${ type([2, 3.14], detailed) }": }')).to have_resource(
      'Notify[Tuple[Integer[2, 2], Float[3.14, 3.14]]]')
  end

  it 'produces the type of a given value with reduced quality when quality is given' do
    expect(compile_to_catalog('notify { "${ type([2, 3.14], reduced) }": }')).to have_resource(
      'Notify[Array[Numeric, 2, 2]]')
  end

  it 'produces the type of a given value with generalized quality when quality is given' do
    expect(compile_to_catalog('notify { "${ type([2, 3.14], generalized) }": }')).to have_resource(
      'Notify[Array[Numeric]]')
  end

  it 'errors when given a fault inference quality' do
    expect do
      compile_to_catalog("notify { type([2, 4.14], gobbledygooked): }")
    end.to raise_error(/expects a match for Enum\['detailed', 'generalized', 'reduced'\], got 'gobbledygooked'/)
  end
end

Version data entries

588 entries across 588 versions & 1 rubygems

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