diff options
Diffstat (limited to 'spec/unit/parser/functions')
| -rwxr-xr-x | spec/unit/parser/functions/create_resources_spec.rb | 6 | ||||
| -rwxr-xr-x | spec/unit/parser/functions/extlookup_spec.rb | 5 | ||||
| -rwxr-xr-x | spec/unit/parser/functions/fail_spec.rb | 4 | ||||
| -rwxr-xr-x | spec/unit/parser/functions/file_spec.rb | 4 | ||||
| -rwxr-xr-x | spec/unit/parser/functions/fqdn_rand_spec.rb | 4 | ||||
| -rwxr-xr-x | spec/unit/parser/functions/generate_spec.rb | 4 | ||||
| -rwxr-xr-x | spec/unit/parser/functions/inline_template_spec.rb | 4 | ||||
| -rwxr-xr-x | spec/unit/parser/functions/realize_spec.rb | 6 | ||||
| -rwxr-xr-x | spec/unit/parser/functions/regsubst_spec.rb | 4 | ||||
| -rwxr-xr-x | spec/unit/parser/functions/require_spec.rb | 7 | ||||
| -rwxr-xr-x | spec/unit/parser/functions/search_spec.rb | 4 | ||||
| -rwxr-xr-x | spec/unit/parser/functions/shellquote_spec.rb | 4 | ||||
| -rwxr-xr-x | spec/unit/parser/functions/split_spec.rb | 4 | ||||
| -rwxr-xr-x | spec/unit/parser/functions/sprintf_spec.rb | 4 | ||||
| -rwxr-xr-x | spec/unit/parser/functions/tag_spec.rb | 5 | ||||
| -rwxr-xr-x | spec/unit/parser/functions/template_spec.rb | 5 | ||||
| -rwxr-xr-x | spec/unit/parser/functions/versioncmp_spec.rb | 4 |
17 files changed, 52 insertions, 26 deletions
diff --git a/spec/unit/parser/functions/create_resources_spec.rb b/spec/unit/parser/functions/create_resources_spec.rb index 043236fd8..90548f86f 100755 --- a/spec/unit/parser/functions/create_resources_spec.rb +++ b/spec/unit/parser/functions/create_resources_spec.rb @@ -6,10 +6,10 @@ describe 'function for dynamically creating resources' do include PuppetSpec::Compiler before :each do - @scope = Puppet::Parser::Scope.new - @scope.compiler = Puppet::Parser::Compiler.new(Puppet::Node.new("floppy", :environment => 'production')) + node = Puppet::Node.new("floppy", :environment => 'production') + @compiler = Puppet::Parser::Compiler.new(node) + @scope = Puppet::Parser::Scope.new(:compiler => @compiler) @topscope = @scope.compiler.topscope - @compiler = @scope.compiler @scope.parent = @topscope Puppet::Parser::Functions.function(:create_resources) end diff --git a/spec/unit/parser/functions/extlookup_spec.rb b/spec/unit/parser/functions/extlookup_spec.rb index eadf51662..e1d56f4a9 100755 --- a/spec/unit/parser/functions/extlookup_spec.rb +++ b/spec/unit/parser/functions/extlookup_spec.rb @@ -10,8 +10,9 @@ describe "the extlookup function" do end before :each do - @scope = Puppet::Parser::Scope.new - @scope.stubs(:environment).returns(Puppet::Node::Environment.new('production')) + node = Puppet::Node.new('localhost') + compiler = Puppet::Parser::Compiler.new(node) + @scope = Puppet::Parser::Scope.new(:compiler => compiler) end it "should exist" do diff --git a/spec/unit/parser/functions/fail_spec.rb b/spec/unit/parser/functions/fail_spec.rb index 48e0e0bde..0000ad736 100755 --- a/spec/unit/parser/functions/fail_spec.rb +++ b/spec/unit/parser/functions/fail_spec.rb @@ -7,7 +7,9 @@ describe "the 'fail' parser function" do end let :scope do - scope = Puppet::Parser::Scope.new + node = Puppet::Node.new('localhost') + compiler = Puppet::Parser::Compiler.new(node) + scope = Puppet::Parser::Scope.new(:compiler => compiler) scope.stubs(:environment).returns(nil) scope end diff --git a/spec/unit/parser/functions/file_spec.rb b/spec/unit/parser/functions/file_spec.rb index 37e12b194..a69d5234a 100755 --- a/spec/unit/parser/functions/file_spec.rb +++ b/spec/unit/parser/functions/file_spec.rb @@ -9,7 +9,9 @@ describe "the 'file' function" do Puppet::Parser::Functions.autoloader.loadall end - let :scope do Puppet::Parser::Scope.new end + let :node do Puppet::Node.new('localhost') end + let :compiler do Puppet::Parser::Compiler.new(node) end + let :scope do Puppet::Parser::Scope.new(:compiler => compiler) end it "should exist" do Puppet::Parser::Functions.function("file").should == "function_file" diff --git a/spec/unit/parser/functions/fqdn_rand_spec.rb b/spec/unit/parser/functions/fqdn_rand_spec.rb index a6b0d6b29..d7e8bd106 100755 --- a/spec/unit/parser/functions/fqdn_rand_spec.rb +++ b/spec/unit/parser/functions/fqdn_rand_spec.rb @@ -7,7 +7,9 @@ describe "the fqdn_rand function" do end before :each do - @scope = Puppet::Parser::Scope.new + node = Puppet::Node.new('localhost') + compiler = Puppet::Parser::Compiler.new(node) + @scope = Puppet::Parser::Scope.new(:compiler => compiler) @scope[:fqdn] = "127.0.0.1" end diff --git a/spec/unit/parser/functions/generate_spec.rb b/spec/unit/parser/functions/generate_spec.rb index 8d3dd01fb..62d4ec5f9 100755 --- a/spec/unit/parser/functions/generate_spec.rb +++ b/spec/unit/parser/functions/generate_spec.rb @@ -8,7 +8,9 @@ describe "the generate function" do Puppet::Parser::Functions.autoloader.loadall end - let(:scope) { Puppet::Parser::Scope.new } + let :node do Puppet::Node.new('localhost') end + let :compiler do Puppet::Parser::Compiler.new(node) end + let :scope do Puppet::Parser::Scope.new(:compiler => compiler) end it "should exist" do Puppet::Parser::Functions.function("generate").should == "function_generate" diff --git a/spec/unit/parser/functions/inline_template_spec.rb b/spec/unit/parser/functions/inline_template_spec.rb index d32eb2eab..389c0dc7d 100755 --- a/spec/unit/parser/functions/inline_template_spec.rb +++ b/spec/unit/parser/functions/inline_template_spec.rb @@ -7,7 +7,9 @@ describe "the inline_template function" do end before :each do - @scope = Puppet::Parser::Scope.new + node = Puppet::Node.new('localhost') + compiler = Puppet::Parser::Compiler.new(node) + @scope = Puppet::Parser::Scope.new(:compiler => compiler) end it "should exist" do diff --git a/spec/unit/parser/functions/realize_spec.rb b/spec/unit/parser/functions/realize_spec.rb index efff4ff30..808c0f125 100755 --- a/spec/unit/parser/functions/realize_spec.rb +++ b/spec/unit/parser/functions/realize_spec.rb @@ -8,10 +8,10 @@ describe "the realize function" do before :each do @collector = stub_everything 'collector' - @scope = Puppet::Parser::Scope.new - @compiler = stub 'compiler' + node = Puppet::Node.new('localhost') + @compiler = Puppet::Parser::Compiler.new(node) + @scope = Puppet::Parser::Scope.new(:compiler => @compiler) @compiler.stubs(:add_collection).with(@collector) - @scope.stubs(:compiler).returns(@compiler) end it "should exist" do diff --git a/spec/unit/parser/functions/regsubst_spec.rb b/spec/unit/parser/functions/regsubst_spec.rb index 25101e53a..196b9a114 100755 --- a/spec/unit/parser/functions/regsubst_spec.rb +++ b/spec/unit/parser/functions/regsubst_spec.rb @@ -7,7 +7,9 @@ describe "the regsubst function" do end before :each do - @scope = Puppet::Parser::Scope.new + node = Puppet::Node.new('localhost') + compiler = Puppet::Parser::Compiler.new(node) + @scope = Puppet::Parser::Scope.new(:compiler => compiler) end it "should exist" do diff --git a/spec/unit/parser/functions/require_spec.rb b/spec/unit/parser/functions/require_spec.rb index 9d1e4710a..578696255 100755 --- a/spec/unit/parser/functions/require_spec.rb +++ b/spec/unit/parser/functions/require_spec.rb @@ -8,11 +8,12 @@ describe "the require function" do before :each do @catalog = stub 'catalog' - @compiler = stub 'compiler', :catalog => @catalog, :environment => nil - @scope = Puppet::Parser::Scope.new + node = Puppet::Node.new('localhost') + compiler = Puppet::Parser::Compiler.new(node) + @scope = Puppet::Parser::Scope.new(:compiler => compiler) + @scope.stubs(:findresource) - @scope.stubs(:compiler).returns(@compiler) @klass = stub 'class', :name => "myclass" @scope.stubs(:find_hostclass).returns(@klass) diff --git a/spec/unit/parser/functions/search_spec.rb b/spec/unit/parser/functions/search_spec.rb index 81b774470..0d6d31bad 100755 --- a/spec/unit/parser/functions/search_spec.rb +++ b/spec/unit/parser/functions/search_spec.rb @@ -6,7 +6,9 @@ describe "the 'search' function" do Puppet::Parser::Functions.autoloader.loadall end - let :scope do Puppet::Parser::Scope.new end + let :node do Puppet::Node.new('localhost') end + let :compiler do Puppet::Parser::Compiler.new(node) end + let :scope do Puppet::Parser::Scope.new(:compiler => compiler) end it "should exist" do Puppet::Parser::Functions.function("search").should == "function_search" diff --git a/spec/unit/parser/functions/shellquote_spec.rb b/spec/unit/parser/functions/shellquote_spec.rb index 862ac1182..6d92cc805 100755 --- a/spec/unit/parser/functions/shellquote_spec.rb +++ b/spec/unit/parser/functions/shellquote_spec.rb @@ -6,7 +6,9 @@ describe "the shellquote function" do Puppet::Parser::Functions.autoloader.loadall end - let :scope do Puppet::Parser::Scope.new end + let :node do Puppet::Node.new('localhost') end + let :compiler do Puppet::Parser::Compiler.new(node) end + let :scope do Puppet::Parser::Scope.new(:compiler => compiler) end it "should exist" do Puppet::Parser::Functions.function("shellquote").should == "function_shellquote" diff --git a/spec/unit/parser/functions/split_spec.rb b/spec/unit/parser/functions/split_spec.rb index 8b7052927..1ec69f6b6 100755 --- a/spec/unit/parser/functions/split_spec.rb +++ b/spec/unit/parser/functions/split_spec.rb @@ -7,7 +7,9 @@ describe "the split function" do end before :each do - @scope = Puppet::Parser::Scope.new + node = Puppet::Node.new('localhost') + compiler = Puppet::Parser::Compiler.new(node) + @scope = Puppet::Parser::Scope.new(:compiler => compiler) end it "should exist" do diff --git a/spec/unit/parser/functions/sprintf_spec.rb b/spec/unit/parser/functions/sprintf_spec.rb index 5cc8d2d55..bbb585956 100755 --- a/spec/unit/parser/functions/sprintf_spec.rb +++ b/spec/unit/parser/functions/sprintf_spec.rb @@ -7,7 +7,9 @@ describe "the sprintf function" do end before :each do - @scope = Puppet::Parser::Scope.new + node = Puppet::Node.new('localhost') + compiler = Puppet::Parser::Compiler.new(node) + @scope = Puppet::Parser::Scope.new(:compiler => compiler) end it "should exist" do diff --git a/spec/unit/parser/functions/tag_spec.rb b/spec/unit/parser/functions/tag_spec.rb index 3210ccbc1..89dda5300 100755 --- a/spec/unit/parser/functions/tag_spec.rb +++ b/spec/unit/parser/functions/tag_spec.rb @@ -7,8 +7,9 @@ describe "the 'tag' function" do end before :each do - @scope = Puppet::Parser::Scope.new - @scope.stubs(:environment).returns(nil) + node = Puppet::Node.new('localhost') + compiler = Puppet::Parser::Compiler.new(node) + @scope = Puppet::Parser::Scope.new(:compiler => compiler) end it "should exist" do diff --git a/spec/unit/parser/functions/template_spec.rb b/spec/unit/parser/functions/template_spec.rb index 28b039529..0a1dbc5b4 100755 --- a/spec/unit/parser/functions/template_spec.rb +++ b/spec/unit/parser/functions/template_spec.rb @@ -6,7 +6,9 @@ describe "the template function" do Puppet::Parser::Functions.autoloader.loadall end - let :scope do Puppet::Parser::Scope.new end + let :node do Puppet::Node.new('localhost') end + let :compiler do Puppet::Parser::Compiler.new(node) end + let :scope do Puppet::Parser::Scope.new(:compiler => compiler) end it "should exist" do Puppet::Parser::Functions.function("template").should == "function_template" @@ -62,7 +64,6 @@ describe "the template function" do def eval_template(content, *rest) File.stubs(:read).with("template").returns(content) Puppet::Parser::Files.stubs(:find_template).returns("template") - scope.compiler.stubs(:environment).returns("production") scope.function_template(['template'] + rest) end diff --git a/spec/unit/parser/functions/versioncmp_spec.rb b/spec/unit/parser/functions/versioncmp_spec.rb index 34534570c..6b7bc093e 100755 --- a/spec/unit/parser/functions/versioncmp_spec.rb +++ b/spec/unit/parser/functions/versioncmp_spec.rb @@ -7,7 +7,9 @@ describe "the versioncmp function" do end before :each do - @scope = Puppet::Parser::Scope.new + node = Puppet::Node.new('localhost') + compiler = Puppet::Parser::Compiler.new(node) + @scope = Puppet::Parser::Scope.new(:compiler => compiler) end it "should exist" do |
