]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/stdlib/spec/unit/puppet/parser/functions/is_string_spec.rb
upgrade to concat 2.0.0
[dsa-puppet.git] / modules / stdlib / spec / unit / puppet / parser / functions / is_string_spec.rb
1 #!/usr/bin/env rspec
2 require 'spec_helper'
3
4 describe "the is_string function" do
5   before :all do
6     Puppet::Parser::Functions.autoloader.loadall
7   end
8
9   before :each do
10     @scope = Puppet::Parser::Scope.new
11   end
12
13   it "should exist" do
14     Puppet::Parser::Functions.function("is_string").should == "function_is_string"
15   end
16
17   it "should raise a ParseError if there is less than 1 arguments" do
18     lambda { @scope.function_is_string([]) }.should( raise_error(Puppet::ParseError))
19   end
20
21   it "should return true if a string" do
22     result = @scope.function_is_string(["asdf"])
23     result.should(eq(true))
24   end
25
26   it "should return false if an integer" do
27     result = @scope.function_is_string(["3"])
28     result.should(eq(false))
29   end
30
31   it "should return false if a float" do
32     result = @scope.function_is_string(["3.23"])
33     result.should(eq(false))
34   end
35
36   it "should return false if an array" do
37     result = @scope.function_is_string([["a","b","c"]])
38     result.should(eq(false))
39   end
40
41 end