Sha256: 702191065623579012524518b9459436d5e49acb63e35ef275071274ba0cdd6b

Contents?: true

Size: 978 Bytes

Versions: 6

Compression:

Stored size: 978 Bytes

Contents

#! /usr/bin/env ruby -S rspec

require 'spec_helper'

if ENV["FUTURE_PARSER"] == 'yes' or Puppet.version >= "4"
  require 'puppet/pops'
  require 'puppet/loaders'

  describe 'the type_of function' do
    before(:all) do
      loaders = Puppet::Pops::Loaders.new(Puppet::Node::Environment.create(:testing, [File.join(fixtures, "modules")]))
      Puppet.push_context({:loaders => loaders}, "test-examples")
    end

    after(:all) do
      Puppet::Pops::Loaders.clear
      Puppet::pop_context()
    end

    let(:func) do
      # Load the function from the environment modulepath's modules (ie, fixtures)
      Puppet.lookup(:loaders).private_environment_loader.load(:function, 'type_of')
    end

    it 'gives the type of a string' do
      expect(func.call({}, 'hello world')).to be_kind_of(Puppet::Pops::Types::PStringType)
    end

    it 'gives the type of an integer' do
      expect(func.call({}, 5)).to be_kind_of(Puppet::Pops::Types::PIntegerType)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
puppet-retrospec-0.12.1 spec/fixtures/modules/stdlib/spec/unit/puppet/functions/type_of_spec.rb
puppet-retrospec-0.12.0 spec/fixtures/modules/stdlib/spec/unit/puppet/functions/type_of_spec.rb
puppet-retrospec-0.11.0 spec/fixtures/modules/stdlib/spec/unit/puppet/functions/type_of_spec.rb
puppet-retrospec-0.10.0 spec/fixtures/modules/stdlib/spec/unit/puppet/functions/type_of_spec.rb
puppet-retrospec-0.9.1 spec/fixtures/modules/stdlib/spec/unit/puppet/functions/type_of_spec.rb
puppet-retrospec-0.9.0 spec/fixtures/modules/stdlib/spec/unit/puppet/functions/type_of_spec.rb