5 expect(Puppet::Parser::Functions.function('type')).to eq('function_type')
8 it 'gives a deprecation warning when called' do
9 expect(scope).to receive(:warning).with("type() DEPRECATED: This function will cease to function on Puppet 4; please use type3x() before upgrading to puppet 4 for backwards-compatibility, or migrate to the new parser's typing system.") # rubocop:disable Metrics/LineLength : Unable to reduce to required length
10 scope.function_type(['aoeu'])
13 it 'returns string when given a string' do
14 result = scope.function_type(['aaabbbbcccc'])
15 expect(result).to(eq('string'))
18 it 'returns array when given an array' do
19 result = scope.function_type([['aaabbbbcccc', 'asdf']])
20 expect(result).to(eq('array'))
23 it 'returns hash when given a hash' do
24 result = scope.function_type([{ 'a' => 1, 'b' => 2 }])
25 expect(result).to(eq('hash'))
28 it 'returns integer when given an integer' do
29 result = scope.function_type(['1'])
30 expect(result).to(eq('integer'))
33 it 'returns float when given a float' do
34 result = scope.function_type(['1.34'])
35 expect(result).to(eq('float'))
38 it 'returns boolean when given a boolean' do
39 result = scope.function_type([true])
40 expect(result).to(eq('boolean'))