~bkerensa/ubuntu/raring/puppet/new-upstream-release

« back to all changes in this revision

Viewing changes to spec/unit/parser/ast/function_spec.rb

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2010-10-21 12:52:13 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: james.westby@ubuntu.com-20101021125213-x5pjaatmuv0i79jv
Tags: 2.6.3~rc1-0ubuntu1
* New upstream version
* debian/control:
  - move all puppet dependencies to puppet-common since all the code is
    actually located in puppet-common. 
  - move libaugeas from a recommend to a dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
    end
62
62
 
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
67
 
 
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
 
67
 
 
68
      @scope.expects(:function_exist).with(["nothing"])
 
69
 
 
70
      func.evaluate(@scope)
 
71
    end
 
72
 
 
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
 
77
 
 
78
      @scope.expects(:function_exist).with(["foo", "", "bar"])
69
79
 
70
80
      func.evaluate(@scope)
71
81
    end
72
82
 
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")
78
88
 
79
89
      func.evaluate(@scope).should == "returning"
80
90
    end