1 #! /usr/bin/env ruby -S rspec
4 describe "the type3x function" do
5 let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
7 expect(Puppet::Parser::Functions.function("type3x")).to eq("function_type3x")
10 it "should raise a ParseError if there is less than 1 arguments" do
11 expect { scope.function_type3x([]) }.to( raise_error(Puppet::ParseError))
14 it "should return string when given a string" do
15 result = scope.function_type3x(["aaabbbbcccc"])
16 expect(result).to(eq('string'))
19 it "should return array when given an array" do
20 result = scope.function_type3x([["aaabbbbcccc","asdf"]])
21 expect(result).to(eq('array'))
24 it "should return hash when given a hash" do
25 result = scope.function_type3x([{"a"=>1,"b"=>2}])
26 expect(result).to(eq('hash'))
29 it "should return integer when given an integer" do
30 result = scope.function_type3x(["1"])
31 expect(result).to(eq('integer'))
34 it "should return float when given a float" do
35 result = scope.function_type3x(["1.34"])
36 expect(result).to(eq('float'))
39 it "should return boolean when given a boolean" do
40 result = scope.function_type3x([true])
41 expect(result).to(eq('boolean'))