63
63
it "should call the underlying ruby function" do
64
argument = stub 'arg', :safeevaluate => "nothing"
65
Puppet::Parser::Functions.stubs(:function).with("exist").returns(true)
66
func = Puppet::Parser::AST::Function.new :name => "exist", :ftype => :statement, :arguments => argument
68
@scope.expects(:function_exist).with("nothing")
64
argument = stub 'arg', :safeevaluate => ["nothing"]
65
Puppet::Parser::Functions.stubs(:function).with("exist").returns(true)
66
func = Puppet::Parser::AST::Function.new :name => "exist", :ftype => :statement, :arguments => argument
68
@scope.expects(:function_exist).with(["nothing"])
73
it "should convert :undef to '' in arguments" do
74
argument = stub 'arg', :safeevaluate => ["foo", :undef, "bar"]
75
Puppet::Parser::Functions.stubs(:function).with("exist").returns(true)
76
func = Puppet::Parser::AST::Function.new :name => "exist", :ftype => :statement, :arguments => argument
78
@scope.expects(:function_exist).with(["foo", "", "bar"])
70
80
func.evaluate(@scope)
73
83
it "should return the ruby function return for rvalue functions" do
74
argument = stub 'arg', :safeevaluate => "nothing"
84
argument = stub 'arg', :safeevaluate => ["nothing"]
75
85
Puppet::Parser::Functions.stubs(:function).with("exist").returns(true)
76
86
func = Puppet::Parser::AST::Function.new :name => "exist", :ftype => :statement, :arguments => argument
77
@scope.stubs(:function_exist).with("nothing").returns("returning")
87
@scope.stubs(:function_exist).with(["nothing"]).returns("returning")
79
89
func.evaluate(@scope).should == "returning"