1 #! /usr/bin/env ruby -S rspec
4 describe "the is_string function" do
5 let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
8 expect(Puppet::Parser::Functions.function("is_string")).to eq("function_is_string")
11 it "should raise a ParseError if there is less than 1 arguments" do
12 expect { scope.function_is_string([]) }.to( raise_error(Puppet::ParseError))
15 it "should return true if a string" do
16 result = scope.function_is_string(["asdf"])
17 expect(result).to(eq(true))
20 it "should return false if an integer" do
21 result = scope.function_is_string(["3"])
22 expect(result).to(eq(false))
25 it "should return false if a float" do
26 result = scope.function_is_string(["3.23"])
27 expect(result).to(eq(false))
30 it "should return false if an array" do
31 result = scope.function_is_string([["a","b","c"]])
32 expect(result).to(eq(false))