1 #! /usr/bin/env ruby -S rspec
4 describe "the empty function" do
5 let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
7 expect(Puppet::Parser::Functions.function("empty")).to eq("function_empty")
10 it "should raise a ParseError if there is less than 1 arguments" do
11 expect { scope.function_empty([]) }.to( raise_error(Puppet::ParseError))
14 it "should return a true for an empty string" do
15 result = scope.function_empty([''])
16 expect(result).to(eq(true))
19 it "should return a false for a non-empty string" do
20 result = scope.function_empty(['asdf'])
21 expect(result).to(eq(false))
24 it "should accept objects which extend String" do
25 class AlsoString < String
28 value = AlsoString.new()
29 result = scope.function_empty([value])
30 result.should(eq(true))