1 #! /usr/bin/env ruby -S rspec
5 if ENV["FUTURE_PARSER"] == 'yes' or Puppet.version >= "4"
7 require 'puppet/loaders'
9 describe 'the type_of function' do
11 loaders = Puppet::Pops::Loaders.new(Puppet::Node::Environment.create(:testing, [File.join(fixtures, "modules")]))
12 Puppet.push_context({:loaders => loaders}, "test-examples")
16 Puppet::Pops::Loaders.clear
21 # Load the function from the environment modulepath's modules (ie, fixtures)
22 Puppet.lookup(:loaders).private_environment_loader.load(:function, 'type_of')
25 it 'gives the type of a string' do
26 expect(func.call({}, 'hello world')).to be_kind_of(Puppet::Pops::Types::PStringType)
29 it 'gives the type of an integer' do
30 expect(func.call({}, 5)).to be_kind_of(Puppet::Pops::Types::PIntegerType)