From 6ed00515e8614233160d74b1c32b75fab27ac722 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Fri, 8 Apr 2011 16:06:57 -0700 Subject: maint: just require 'spec_helper', thanks rspec2 rspec2 automatically sets a bunch of load-path stuff we were by hand, so we can just stop. As a side-effect we can now avoid a whole pile of stupid things to try and include the spec_helper.rb file... ...and then we can stop protecting spec_helper from evaluating twice, since we now require it with a consistent name. Yay. Reviewed-By: Pieter van de Bruggen --- spec/unit/parser/ast/arithmetic_operator_spec.rb | 2 +- spec/unit/parser/ast/astarray_spec.rb | 2 +- spec/unit/parser/ast/asthash_spec.rb | 2 +- spec/unit/parser/ast/boolean_operator_spec.rb | 2 +- spec/unit/parser/ast/casestatement_spec.rb | 2 +- spec/unit/parser/ast/collection_spec.rb | 2 +- spec/unit/parser/ast/collexpr_spec.rb | 2 +- spec/unit/parser/ast/comparison_operator_spec.rb | 2 +- spec/unit/parser/ast/definition_spec.rb | 2 +- spec/unit/parser/ast/function_spec.rb | 2 +- spec/unit/parser/ast/hostclass_spec.rb | 2 +- spec/unit/parser/ast/ifstatement_spec.rb | 2 +- spec/unit/parser/ast/in_operator_spec.rb | 2 +- spec/unit/parser/ast/leaf_spec.rb | 2 +- spec/unit/parser/ast/match_operator_spec.rb | 2 +- spec/unit/parser/ast/minus_spec.rb | 2 +- spec/unit/parser/ast/node_spec.rb | 2 +- spec/unit/parser/ast/nop_spec.rb | 2 +- spec/unit/parser/ast/not_spec.rb | 2 +- spec/unit/parser/ast/relationship_spec.rb | 2 +- spec/unit/parser/ast/resource_defaults_spec.rb | 2 +- spec/unit/parser/ast/resource_override_spec.rb | 2 +- spec/unit/parser/ast/resource_reference_spec.rb | 2 +- spec/unit/parser/ast/resource_spec.rb | 2 +- spec/unit/parser/ast/selector_spec.rb | 2 +- spec/unit/parser/ast/vardef_spec.rb | 2 +- spec/unit/parser/ast_spec.rb | 2 +- spec/unit/parser/collector_spec.rb | 2 +- spec/unit/parser/compiler_spec.rb | 2 +- spec/unit/parser/files_spec.rb | 2 +- spec/unit/parser/functions/create_resources_spec.rb | 2 +- spec/unit/parser/functions/defined_spec.rb | 2 +- spec/unit/parser/functions/extlookup_spec.rb | 2 +- spec/unit/parser/functions/fqdn_rand_spec.rb | 2 +- spec/unit/parser/functions/generate_spec.rb | 2 +- spec/unit/parser/functions/include_spec.rb | 2 +- spec/unit/parser/functions/inline_template_spec.rb | 2 +- spec/unit/parser/functions/realize_spec.rb | 2 +- spec/unit/parser/functions/regsubst_spec.rb | 2 +- spec/unit/parser/functions/require_spec.rb | 2 +- spec/unit/parser/functions/shellquote_spec.rb | 2 +- spec/unit/parser/functions/split_spec.rb | 2 +- spec/unit/parser/functions/sprintf_spec.rb | 2 +- spec/unit/parser/functions/tag_spec.rb | 2 +- spec/unit/parser/functions/template_spec.rb | 2 +- spec/unit/parser/functions/versioncmp_spec.rb | 2 +- spec/unit/parser/functions_spec.rb | 2 +- spec/unit/parser/lexer_spec.rb | 2 +- spec/unit/parser/parser_spec.rb | 2 +- spec/unit/parser/relationship_spec.rb | 2 +- spec/unit/parser/resource_spec.rb | 2 +- spec/unit/parser/scope_spec.rb | 2 +- spec/unit/parser/templatewrapper_spec.rb | 2 +- spec/unit/parser/type_loader_spec.rb | 2 +- 54 files changed, 54 insertions(+), 54 deletions(-) mode change 100644 => 100755 spec/unit/parser/ast/asthash_spec.rb mode change 100644 => 100755 spec/unit/parser/ast/definition_spec.rb mode change 100644 => 100755 spec/unit/parser/ast/function_spec.rb mode change 100644 => 100755 spec/unit/parser/ast/hostclass_spec.rb mode change 100644 => 100755 spec/unit/parser/ast/in_operator_spec.rb mode change 100644 => 100755 spec/unit/parser/ast/node_spec.rb mode change 100644 => 100755 spec/unit/parser/ast/relationship_spec.rb mode change 100644 => 100755 spec/unit/parser/ast_spec.rb mode change 100644 => 100755 spec/unit/parser/files_spec.rb mode change 100644 => 100755 spec/unit/parser/functions_spec.rb mode change 100644 => 100755 spec/unit/parser/relationship_spec.rb mode change 100644 => 100755 spec/unit/parser/type_loader_spec.rb (limited to 'spec/unit/parser') diff --git a/spec/unit/parser/ast/arithmetic_operator_spec.rb b/spec/unit/parser/ast/arithmetic_operator_spec.rb index 381c5c629..6f57fd9b6 100755 --- a/spec/unit/parser/ast/arithmetic_operator_spec.rb +++ b/spec/unit/parser/ast/arithmetic_operator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::ArithmeticOperator do diff --git a/spec/unit/parser/ast/astarray_spec.rb b/spec/unit/parser/ast/astarray_spec.rb index 01082b3f0..4429ab1fe 100755 --- a/spec/unit/parser/ast/astarray_spec.rb +++ b/spec/unit/parser/ast/astarray_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::ASTArray do before :each do diff --git a/spec/unit/parser/ast/asthash_spec.rb b/spec/unit/parser/ast/asthash_spec.rb old mode 100644 new mode 100755 index 83f604545..09033284e --- a/spec/unit/parser/ast/asthash_spec.rb +++ b/spec/unit/parser/ast/asthash_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::ASTHash do before :each do diff --git a/spec/unit/parser/ast/boolean_operator_spec.rb b/spec/unit/parser/ast/boolean_operator_spec.rb index 529946694..2251d0827 100755 --- a/spec/unit/parser/ast/boolean_operator_spec.rb +++ b/spec/unit/parser/ast/boolean_operator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::BooleanOperator do diff --git a/spec/unit/parser/ast/casestatement_spec.rb b/spec/unit/parser/ast/casestatement_spec.rb index bce3ad801..d507beb58 100755 --- a/spec/unit/parser/ast/casestatement_spec.rb +++ b/spec/unit/parser/ast/casestatement_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::CaseStatement do before :each do diff --git a/spec/unit/parser/ast/collection_spec.rb b/spec/unit/parser/ast/collection_spec.rb index 99abc998d..fd7bf75c1 100755 --- a/spec/unit/parser/ast/collection_spec.rb +++ b/spec/unit/parser/ast/collection_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Collection do before :each do diff --git a/spec/unit/parser/ast/collexpr_spec.rb b/spec/unit/parser/ast/collexpr_spec.rb index 04ce69cd3..f5e340ce8 100755 --- a/spec/unit/parser/ast/collexpr_spec.rb +++ b/spec/unit/parser/ast/collexpr_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::CollExpr do diff --git a/spec/unit/parser/ast/comparison_operator_spec.rb b/spec/unit/parser/ast/comparison_operator_spec.rb index 03c9069cb..169d92d0a 100755 --- a/spec/unit/parser/ast/comparison_operator_spec.rb +++ b/spec/unit/parser/ast/comparison_operator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::ComparisonOperator do before :each do diff --git a/spec/unit/parser/ast/definition_spec.rb b/spec/unit/parser/ast/definition_spec.rb old mode 100644 new mode 100755 index e7f55d258..f2a211ad2 --- a/spec/unit/parser/ast/definition_spec.rb +++ b/spec/unit/parser/ast/definition_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Definition do it "should make its context available through an accessor" do diff --git a/spec/unit/parser/ast/function_spec.rb b/spec/unit/parser/ast/function_spec.rb old mode 100644 new mode 100755 index cd4b0f94e..6f9f33b8e --- a/spec/unit/parser/ast/function_spec.rb +++ b/spec/unit/parser/ast/function_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Function do before :each do diff --git a/spec/unit/parser/ast/hostclass_spec.rb b/spec/unit/parser/ast/hostclass_spec.rb old mode 100644 new mode 100755 index 390490788..9c320d1be --- a/spec/unit/parser/ast/hostclass_spec.rb +++ b/spec/unit/parser/ast/hostclass_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Hostclass do def ast diff --git a/spec/unit/parser/ast/ifstatement_spec.rb b/spec/unit/parser/ast/ifstatement_spec.rb index 6a2fed22c..24e07f5fe 100755 --- a/spec/unit/parser/ast/ifstatement_spec.rb +++ b/spec/unit/parser/ast/ifstatement_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::IfStatement do before :each do diff --git a/spec/unit/parser/ast/in_operator_spec.rb b/spec/unit/parser/ast/in_operator_spec.rb old mode 100644 new mode 100755 index 08c01582e..95349d45d --- a/spec/unit/parser/ast/in_operator_spec.rb +++ b/spec/unit/parser/ast/in_operator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'puppet/parser/ast/in_operator' diff --git a/spec/unit/parser/ast/leaf_spec.rb b/spec/unit/parser/ast/leaf_spec.rb index 2119a27a8..3b8c14efa 100755 --- a/spec/unit/parser/ast/leaf_spec.rb +++ b/spec/unit/parser/ast/leaf_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Leaf do before :each do diff --git a/spec/unit/parser/ast/match_operator_spec.rb b/spec/unit/parser/ast/match_operator_spec.rb index f2a68b676..188b837b3 100755 --- a/spec/unit/parser/ast/match_operator_spec.rb +++ b/spec/unit/parser/ast/match_operator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::MatchOperator do before :each do diff --git a/spec/unit/parser/ast/minus_spec.rb b/spec/unit/parser/ast/minus_spec.rb index 339087e80..c8e5339a7 100755 --- a/spec/unit/parser/ast/minus_spec.rb +++ b/spec/unit/parser/ast/minus_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Minus do before :each do diff --git a/spec/unit/parser/ast/node_spec.rb b/spec/unit/parser/ast/node_spec.rb old mode 100644 new mode 100755 index c4e20ca67..434cb95bf --- a/spec/unit/parser/ast/node_spec.rb +++ b/spec/unit/parser/ast/node_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Node do describe "when instantiated" do diff --git a/spec/unit/parser/ast/nop_spec.rb b/spec/unit/parser/ast/nop_spec.rb index 3fa2fc0ee..d2307c84a 100755 --- a/spec/unit/parser/ast/nop_spec.rb +++ b/spec/unit/parser/ast/nop_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Nop do diff --git a/spec/unit/parser/ast/not_spec.rb b/spec/unit/parser/ast/not_spec.rb index 31a425132..60fc11c5c 100755 --- a/spec/unit/parser/ast/not_spec.rb +++ b/spec/unit/parser/ast/not_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Not do before :each do diff --git a/spec/unit/parser/ast/relationship_spec.rb b/spec/unit/parser/ast/relationship_spec.rb old mode 100644 new mode 100755 index d8bc3a535..871b05c30 --- a/spec/unit/parser/ast/relationship_spec.rb +++ b/spec/unit/parser/ast/relationship_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Relationship do before do diff --git a/spec/unit/parser/ast/resource_defaults_spec.rb b/spec/unit/parser/ast/resource_defaults_spec.rb index 36eb8df5f..7402be8ea 100755 --- a/spec/unit/parser/ast/resource_defaults_spec.rb +++ b/spec/unit/parser/ast/resource_defaults_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::ResourceDefaults do diff --git a/spec/unit/parser/ast/resource_override_spec.rb b/spec/unit/parser/ast/resource_override_spec.rb index 7ca3a7e8c..cb126ce62 100755 --- a/spec/unit/parser/ast/resource_override_spec.rb +++ b/spec/unit/parser/ast/resource_override_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::ResourceOverride do diff --git a/spec/unit/parser/ast/resource_reference_spec.rb b/spec/unit/parser/ast/resource_reference_spec.rb index 492c25490..b581e9305 100755 --- a/spec/unit/parser/ast/resource_reference_spec.rb +++ b/spec/unit/parser/ast/resource_reference_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::ResourceReference do diff --git a/spec/unit/parser/ast/resource_spec.rb b/spec/unit/parser/ast/resource_spec.rb index b00fee587..883b71866 100755 --- a/spec/unit/parser/ast/resource_spec.rb +++ b/spec/unit/parser/ast/resource_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Resource do ast = Puppet::Parser::AST diff --git a/spec/unit/parser/ast/selector_spec.rb b/spec/unit/parser/ast/selector_spec.rb index 4c13aa7ba..787a3360f 100755 --- a/spec/unit/parser/ast/selector_spec.rb +++ b/spec/unit/parser/ast/selector_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::Selector do before :each do diff --git a/spec/unit/parser/ast/vardef_spec.rb b/spec/unit/parser/ast/vardef_spec.rb index 9c8b77905..a462e8ef5 100755 --- a/spec/unit/parser/ast/vardef_spec.rb +++ b/spec/unit/parser/ast/vardef_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe Puppet::Parser::AST::VarDef do before :each do diff --git a/spec/unit/parser/ast_spec.rb b/spec/unit/parser/ast_spec.rb old mode 100644 new mode 100755 index cdfb51869..ba8724242 --- a/spec/unit/parser/ast_spec.rb +++ b/spec/unit/parser/ast_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/parser/ast' diff --git a/spec/unit/parser/collector_spec.rb b/spec/unit/parser/collector_spec.rb index 100a04daf..75c113eae 100755 --- a/spec/unit/parser/collector_spec.rb +++ b/spec/unit/parser/collector_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/rails' require 'puppet/parser/collector' diff --git a/spec/unit/parser/compiler_spec.rb b/spec/unit/parser/compiler_spec.rb index e4b18e14b..0c896a4e3 100755 --- a/spec/unit/parser/compiler_spec.rb +++ b/spec/unit/parser/compiler_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' class CompilerTestResource attr_accessor :builtin, :virtual, :evaluated, :type, :title diff --git a/spec/unit/parser/files_spec.rb b/spec/unit/parser/files_spec.rb old mode 100644 new mode 100755 index 525c83697..7710871dc --- a/spec/unit/parser/files_spec.rb +++ b/spec/unit/parser/files_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/parser/files' diff --git a/spec/unit/parser/functions/create_resources_spec.rb b/spec/unit/parser/functions/create_resources_spec.rb index 366fb536c..88a67e369 100755 --- a/spec/unit/parser/functions/create_resources_spec.rb +++ b/spec/unit/parser/functions/create_resources_spec.rb @@ -1,5 +1,5 @@ require 'puppet' -require File.dirname(__FILE__) + '/../../../spec_helper' +require 'spec_helper' describe 'function for dynamically creating resources' do diff --git a/spec/unit/parser/functions/defined_spec.rb b/spec/unit/parser/functions/defined_spec.rb index 0113c3233..8b0fb4e2f 100755 --- a/spec/unit/parser/functions/defined_spec.rb +++ b/spec/unit/parser/functions/defined_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the 'defined' function" do before :all do diff --git a/spec/unit/parser/functions/extlookup_spec.rb b/spec/unit/parser/functions/extlookup_spec.rb index 46cd3cc27..f2560d3d9 100755 --- a/spec/unit/parser/functions/extlookup_spec.rb +++ b/spec/unit/parser/functions/extlookup_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' require 'tempfile' describe "the extlookup function" do diff --git a/spec/unit/parser/functions/fqdn_rand_spec.rb b/spec/unit/parser/functions/fqdn_rand_spec.rb index be2e6fa76..d810741c5 100755 --- a/spec/unit/parser/functions/fqdn_rand_spec.rb +++ b/spec/unit/parser/functions/fqdn_rand_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the fqdn_rand function" do before :all do diff --git a/spec/unit/parser/functions/generate_spec.rb b/spec/unit/parser/functions/generate_spec.rb index d25015b56..3351291d5 100755 --- a/spec/unit/parser/functions/generate_spec.rb +++ b/spec/unit/parser/functions/generate_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the generate function" do before :all do diff --git a/spec/unit/parser/functions/include_spec.rb b/spec/unit/parser/functions/include_spec.rb index cfaadfbb6..b477f1439 100755 --- a/spec/unit/parser/functions/include_spec.rb +++ b/spec/unit/parser/functions/include_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the 'include' function" do before :all do diff --git a/spec/unit/parser/functions/inline_template_spec.rb b/spec/unit/parser/functions/inline_template_spec.rb index 712c68c69..e009870c5 100755 --- a/spec/unit/parser/functions/inline_template_spec.rb +++ b/spec/unit/parser/functions/inline_template_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the inline_template function" do before :all do diff --git a/spec/unit/parser/functions/realize_spec.rb b/spec/unit/parser/functions/realize_spec.rb index 3106c42b6..7a039c002 100755 --- a/spec/unit/parser/functions/realize_spec.rb +++ b/spec/unit/parser/functions/realize_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the realize function" do before :all do diff --git a/spec/unit/parser/functions/regsubst_spec.rb b/spec/unit/parser/functions/regsubst_spec.rb index 1fb8e410c..0cab3d18c 100755 --- a/spec/unit/parser/functions/regsubst_spec.rb +++ b/spec/unit/parser/functions/regsubst_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the regsubst function" do before :all do diff --git a/spec/unit/parser/functions/require_spec.rb b/spec/unit/parser/functions/require_spec.rb index edcbc4ae6..cb89db3a1 100755 --- a/spec/unit/parser/functions/require_spec.rb +++ b/spec/unit/parser/functions/require_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the require function" do before :all do diff --git a/spec/unit/parser/functions/shellquote_spec.rb b/spec/unit/parser/functions/shellquote_spec.rb index 55302b97b..86181dee0 100755 --- a/spec/unit/parser/functions/shellquote_spec.rb +++ b/spec/unit/parser/functions/shellquote_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the shellquote function" do before :all do diff --git a/spec/unit/parser/functions/split_spec.rb b/spec/unit/parser/functions/split_spec.rb index b892a5c2a..e321b6d9f 100755 --- a/spec/unit/parser/functions/split_spec.rb +++ b/spec/unit/parser/functions/split_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the split function" do before :all do diff --git a/spec/unit/parser/functions/sprintf_spec.rb b/spec/unit/parser/functions/sprintf_spec.rb index 69fbb5e97..49c5324f8 100755 --- a/spec/unit/parser/functions/sprintf_spec.rb +++ b/spec/unit/parser/functions/sprintf_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the sprintf function" do before :all do diff --git a/spec/unit/parser/functions/tag_spec.rb b/spec/unit/parser/functions/tag_spec.rb index b6bb45252..a8c57b7a4 100755 --- a/spec/unit/parser/functions/tag_spec.rb +++ b/spec/unit/parser/functions/tag_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the 'tag' function" do before :all do diff --git a/spec/unit/parser/functions/template_spec.rb b/spec/unit/parser/functions/template_spec.rb index 7eaf3554d..64d992297 100755 --- a/spec/unit/parser/functions/template_spec.rb +++ b/spec/unit/parser/functions/template_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the template function" do before :all do diff --git a/spec/unit/parser/functions/versioncmp_spec.rb b/spec/unit/parser/functions/versioncmp_spec.rb index ddc79cd85..d7ae0152a 100755 --- a/spec/unit/parser/functions/versioncmp_spec.rb +++ b/spec/unit/parser/functions/versioncmp_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') +require 'spec_helper' describe "the versioncmp function" do before :all do diff --git a/spec/unit/parser/functions_spec.rb b/spec/unit/parser/functions_spec.rb old mode 100644 new mode 100755 index 51e52faee..79585f12d --- a/spec/unit/parser/functions_spec.rb +++ b/spec/unit/parser/functions_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Parser::Functions do diff --git a/spec/unit/parser/lexer_spec.rb b/spec/unit/parser/lexer_spec.rb index bc9e22e48..2eb2581a2 100755 --- a/spec/unit/parser/lexer_spec.rb +++ b/spec/unit/parser/lexer_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/parser/lexer' diff --git a/spec/unit/parser/parser_spec.rb b/spec/unit/parser/parser_spec.rb index 01cdcb976..cb90939fa 100755 --- a/spec/unit/parser/parser_spec.rb +++ b/spec/unit/parser/parser_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Parser do diff --git a/spec/unit/parser/relationship_spec.rb b/spec/unit/parser/relationship_spec.rb old mode 100644 new mode 100755 index 883a38d11..f44a5c844 --- a/spec/unit/parser/relationship_spec.rb +++ b/spec/unit/parser/relationship_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/parser/relationship' diff --git a/spec/unit/parser/resource_spec.rb b/spec/unit/parser/resource_spec.rb index 73c4412dd..078b7de95 100755 --- a/spec/unit/parser/resource_spec.rb +++ b/spec/unit/parser/resource_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' # LAK: FIXME This is just new tests for resources; I have # not moved all tests over yet. diff --git a/spec/unit/parser/scope_spec.rb b/spec/unit/parser/scope_spec.rb index 32a87f1f4..44e255956 100755 --- a/spec/unit/parser/scope_spec.rb +++ b/spec/unit/parser/scope_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' describe Puppet::Parser::Scope do before :each do diff --git a/spec/unit/parser/templatewrapper_spec.rb b/spec/unit/parser/templatewrapper_spec.rb index aab169348..afb0032fd 100755 --- a/spec/unit/parser/templatewrapper_spec.rb +++ b/spec/unit/parser/templatewrapper_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/parser/templatewrapper' describe Puppet::Parser::TemplateWrapper do diff --git a/spec/unit/parser/type_loader_spec.rb b/spec/unit/parser/type_loader_spec.rb old mode 100644 new mode 100755 index 12bc1ccd6..dfbd2f278 --- a/spec/unit/parser/type_loader_spec.rb +++ b/spec/unit/parser/type_loader_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require 'spec_helper' require 'puppet/parser/type_loader' require 'puppet_spec/files' -- cgit From b3baee8c625d1a8d8fb8be20d1534ed71188a5f2 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Thu, 21 Oct 2010 14:02:12 -0700 Subject: Refactor on the way to #5063 -- removing unused Scope#level This attribute is apparently no longer set or accessed. --- spec/unit/parser/compiler_spec.rb | 4 ---- 1 file changed, 4 deletions(-) (limited to 'spec/unit/parser') diff --git a/spec/unit/parser/compiler_spec.rb b/spec/unit/parser/compiler_spec.rb index 0c896a4e3..de4bee3e9 100755 --- a/spec/unit/parser/compiler_spec.rb +++ b/spec/unit/parser/compiler_spec.rb @@ -131,10 +131,6 @@ describe Puppet::Parser::Compiler do @compiler.newscope(@compiler.topscope).should be_instance_of(Puppet::Parser::Scope) end - it "should correctly set the level of newly created scopes" do - @compiler.newscope(@compiler.topscope, :level => 5).level.should == 5 - end - it "should set the parent scope of the new scope to be the passed-in parent" do scope = mock 'scope' newscope = @compiler.newscope(scope) -- cgit From d5dc3036eda210f318160e2442f7b65e0995ee23 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Thu, 21 Oct 2010 14:23:32 -0700 Subject: Fix for #5063 -- explicitly scope internal variable lookups When we lookup a global variable / fact from code we should explicitly look in the global scope. --- spec/unit/parser/functions/extlookup_spec.rb | 10 +++++----- spec/unit/parser/functions/fqdn_rand_spec.rb | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'spec/unit/parser') diff --git a/spec/unit/parser/functions/extlookup_spec.rb b/spec/unit/parser/functions/extlookup_spec.rb index f2560d3d9..ad89f6575 100755 --- a/spec/unit/parser/functions/extlookup_spec.rb +++ b/spec/unit/parser/functions/extlookup_spec.rb @@ -65,7 +65,7 @@ describe "the extlookup function" do describe "should look in $extlookup_datadir for data files listed by $extlookup_precedence" do before do - @scope.stubs(:lookupvar).with('extlookup_datadir').returns("/tmp") + @scope.stubs(:lookupvar).with('::extlookup_datadir').returns("/tmp") File.open("/tmp/one.csv","w"){|one| one.puts "key,value1" } File.open("/tmp/two.csv","w") do |two| two.puts "key,value2" @@ -74,21 +74,21 @@ describe "the extlookup function" do end it "when the key is in the first file" do - @scope.stubs(:lookupvar).with('extlookup_precedence').returns(["one","two"]) + @scope.stubs(:lookupvar).with('::extlookup_precedence').returns(["one","two"]) result = @scope.function_extlookup([ "key" ]) result.should == "value1" end it "when the key is in the second file" do - @scope.stubs(:lookupvar).with('extlookup_precedence').returns(["one","two"]) + @scope.stubs(:lookupvar).with('::extlookup_precedence').returns(["one","two"]) result = @scope.function_extlookup([ "key2" ]) result.should == "value_two" end it "should not modify extlookup_precedence data" do variable = '%{fqdn}' - @scope.stubs(:lookupvar).with('extlookup_precedence').returns([variable,"one"]) - @scope.stubs(:lookupvar).with('fqdn').returns('myfqdn') + @scope.stubs(:lookupvar).with('::extlookup_precedence').returns([variable,"one"]) + @scope.stubs(:lookupvar).with('::fqdn').returns('myfqdn') result = @scope.function_extlookup([ "key" ]) variable.should == '%{fqdn}' end diff --git a/spec/unit/parser/functions/fqdn_rand_spec.rb b/spec/unit/parser/functions/fqdn_rand_spec.rb index d810741c5..90792e182 100755 --- a/spec/unit/parser/functions/fqdn_rand_spec.rb +++ b/spec/unit/parser/functions/fqdn_rand_spec.rb @@ -16,49 +16,49 @@ describe "the fqdn_rand function" do end it "should handle 0 arguments" do - @scope.expects(:lookupvar).with("fqdn").returns("127.0.0.1") + @scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1") lambda { @scope.function_fqdn_rand([]) }.should_not raise_error(Puppet::ParseError) end it "should handle 1 argument'}" do - @scope.expects(:lookupvar).with("fqdn").returns("127.0.0.1") + @scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1") lambda { @scope.function_fqdn_rand([3]) }.should_not raise_error(Puppet::ParseError) end (1..10).each { |n| it "should handle #{n} additional arguments" do - @scope.expects(:lookupvar).with("fqdn").returns("127.0.0.1") + @scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1") lambda { @scope.function_fqdn_rand([3,1,2,3,4,5,6,7,8,9,10][0..n]) }.should_not raise_error(Puppet::ParseError) end it "should handle #{n} additional string arguments" do - @scope.expects(:lookupvar).with("fqdn").returns("127.0.0.1") + @scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1") lambda { @scope.function_fqdn_rand([3,%w{ 1 2 3 4 5 6 7 8 9 10}].flatten[0..n]) }.should_not raise_error(Puppet::ParseError) end } it "should return a value less than max" do - @scope.expects(:lookupvar).with("fqdn").returns("127.0.0.1") + @scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1") @scope.function_fqdn_rand([3]).should satisfy {|n| n.to_i < 3 } end it "should return the same values on subsequent invocations for the same host" do - @scope.expects(:lookupvar).with("fqdn").returns("127.0.0.1").twice + @scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1").twice @scope.function_fqdn_rand([3,4]).should eql(@scope.function_fqdn_rand([3, 4])) end it "should return different sequences of value for different hosts" do - @scope.expects(:lookupvar).with("fqdn").returns("127.0.0.1") + @scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1") val1 = @scope.function_fqdn_rand([10000000,4]) - @scope.expects(:lookupvar).with("fqdn").returns("127.0.0.2") + @scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.2") val2 = @scope.function_fqdn_rand([10000000,4]) val1.should_not eql(val2) end it "should return different values for the same hosts with different seeds" do - @scope.expects(:lookupvar).with("fqdn").returns("127.0.0.1") + @scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1") val1 = @scope.function_fqdn_rand([10000000,4]) - @scope.expects(:lookupvar).with("fqdn").returns("127.0.0.1") + @scope.expects(:lookupvar).with("::fqdn").returns("127.0.0.1") val2 = @scope.function_fqdn_rand([10000000,42]) val1.should_not eql(val2) end -- cgit From 31f8e660c8f4c0ec01f140322cf7c585144a0888 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Thu, 21 Oct 2010 17:24:09 -0700 Subject: Refactor en route to #5027 -- remove usestring parameter from lookupvar The usestring parameter to lookupvar was objectionable for several reasons; first, it performed a function orthogonal to the main purpose of the method, second its default was the least common value, and third it was causing other code to work for reasons that were not obvious (extlookup). This refactor breaks the value-transforming function out into a seperate method which allows the user to specify the value to be used in lieu of :undef and removes the parameter. The function, Scope#undef_as(default,exp) is written so that it can be used in user code (templates, functions, etc.) if needed. This refactor will introduce a user-visible behaviour change in the case where users were counting on lookupvar to return "" for undefined variables. The best solution is to have them use undef_as, replacing: lookupvar('myvar') with undef_as('',lookupvar('myvar')) (with the option to specify another default value if desired). If this is too objectionable, we could rename the existing lookupvar as raw_lookupvar and define def lookupvar(v) undef_as('',raw_lookupvar(v)) end to restore the present behaviour. --- spec/unit/parser/ast/arithmetic_operator_spec.rb | 4 +-- spec/unit/parser/ast/comparison_operator_spec.rb | 4 +-- spec/unit/parser/ast/leaf_spec.rb | 4 +-- spec/unit/parser/scope_spec.rb | 44 ++++++++++-------------- spec/unit/parser/templatewrapper_spec.rb | 8 ++--- 5 files changed, 28 insertions(+), 36 deletions(-) (limited to 'spec/unit/parser') diff --git a/spec/unit/parser/ast/arithmetic_operator_spec.rb b/spec/unit/parser/ast/arithmetic_operator_spec.rb index 6f57fd9b6..0aab6f080 100755 --- a/spec/unit/parser/ast/arithmetic_operator_spec.rb +++ b/spec/unit/parser/ast/arithmetic_operator_spec.rb @@ -61,8 +61,8 @@ describe Puppet::Parser::AST::ArithmeticOperator do end it "should work for variables too" do - @scope.expects(:lookupvar).with("one", false).returns(1) - @scope.expects(:lookupvar).with("two", false).returns(2) + @scope.expects(:lookupvar).with("one").returns(1) + @scope.expects(:lookupvar).with("two").returns(2) one = ast::Variable.new( :value => "one" ) two = ast::Variable.new( :value => "two" ) diff --git a/spec/unit/parser/ast/comparison_operator_spec.rb b/spec/unit/parser/ast/comparison_operator_spec.rb index 169d92d0a..3efe28bb6 100755 --- a/spec/unit/parser/ast/comparison_operator_spec.rb +++ b/spec/unit/parser/ast/comparison_operator_spec.rb @@ -95,8 +95,8 @@ describe Puppet::Parser::AST::ComparisonOperator do one = Puppet::Parser::AST::Variable.new( :value => "one" ) two = Puppet::Parser::AST::Variable.new( :value => "two" ) - @scope.expects(:lookupvar).with("one", false).returns(1) - @scope.expects(:lookupvar).with("two", false).returns(2) + @scope.expects(:lookupvar).with("one").returns(1) + @scope.expects(:lookupvar).with("two").returns(2) operator = Puppet::Parser::AST::ComparisonOperator.new :lval => one, :operator => "<", :rval => two operator.evaluate(@scope).should == true diff --git a/spec/unit/parser/ast/leaf_spec.rb b/spec/unit/parser/ast/leaf_spec.rb index 3b8c14efa..97c996b40 100755 --- a/spec/unit/parser/ast/leaf_spec.rb +++ b/spec/unit/parser/ast/leaf_spec.rb @@ -336,12 +336,12 @@ describe Puppet::Parser::AST::Variable do end it "should lookup the variable in scope" do - @scope.expects(:lookupvar).with("myvar", false).returns(:myvalue) + @scope.expects(:lookupvar).with("myvar").returns(:myvalue) @var.safeevaluate(@scope).should == :myvalue end it "should return undef if the variable wasn't set" do - @scope.expects(:lookupvar).with("myvar", false).returns(:undefined) + @scope.expects(:lookupvar).with("myvar").returns(:undefined) @var.safeevaluate(@scope).should == :undef end diff --git a/spec/unit/parser/scope_spec.rb b/spec/unit/parser/scope_spec.rb index 44e255956..b37cb4add 100755 --- a/spec/unit/parser/scope_spec.rb +++ b/spec/unit/parser/scope_spec.rb @@ -76,16 +76,8 @@ describe Puppet::Parser::Scope do end describe "when looking up a variable" do - it "should default to an empty string" do - @scope.lookupvar("var").should == "" - end - - it "should return an string when asked for a string" do - @scope.lookupvar("var", true).should == "" - end - - it "should return ':undefined' for unset variables when asked not to return a string" do - @scope.lookupvar("var", false).should == :undefined + it "should return ':undefined' for unset variables" do + @scope.lookupvar("var").should == :undefined end it "should be able to look up values" do @@ -151,32 +143,32 @@ describe Puppet::Parser::Scope do @scope.lookupvar("other::deep::klass::var").should == "otherval" end - it "should return an empty string for qualified variables that cannot be found in other classes" do + it "should return ':undefined' for qualified variables that cannot be found in other classes" do other_scope = create_class_scope("other::deep::klass") - @scope.lookupvar("other::deep::klass::var").should == "" + @scope.lookupvar("other::deep::klass::var").should == :undefined end - it "should warn and return an empty string for qualified variables whose classes have not been evaluated" do + it "should warn and return ':undefined' for qualified variables whose classes have not been evaluated" do klass = newclass("other::deep::klass") @scope.expects(:warning) - @scope.lookupvar("other::deep::klass::var").should == "" + @scope.lookupvar("other::deep::klass::var").should == :undefined end - it "should warn and return an empty string for qualified variables whose classes do not exist" do + it "should warn and return ':undefined' for qualified variables whose classes do not exist" do @scope.expects(:warning) - @scope.lookupvar("other::deep::klass::var").should == "" + @scope.lookupvar("other::deep::klass::var").should == :undefined end it "should return ':undefined' when asked for a non-string qualified variable from a class that does not exist" do @scope.stubs(:warning) - @scope.lookupvar("other::deep::klass::var", false).should == :undefined + @scope.lookupvar("other::deep::klass::var").should == :undefined end it "should return ':undefined' when asked for a non-string qualified variable from a class that has not been evaluated" do @scope.stubs(:warning) klass = newclass("other::deep::klass") - @scope.lookupvar("other::deep::klass::var", false).should == :undefined + @scope.lookupvar("other::deep::klass::var").should == :undefined end end end @@ -291,7 +283,7 @@ describe Puppet::Parser::Scope do @scope.unset_ephemeral_var - @scope.lookupvar("1", false).should == :undefined + @scope.lookupvar("1").should == :undefined end it "should not remove classic variables when unset_ephemeral_var is called" do @@ -301,7 +293,7 @@ describe Puppet::Parser::Scope do @scope.unset_ephemeral_var - @scope.lookupvar("myvar", false).should == :value1 + @scope.lookupvar("myvar").should == :value1 end it "should raise an error when setting it again" do @@ -322,7 +314,7 @@ describe Puppet::Parser::Scope do @scope.setvar("0", :earliest, :ephemeral => true) @scope.new_ephemeral @scope.setvar("0", :latest, :ephemeral => true) - @scope.lookupvar("0", false).should == :latest + @scope.lookupvar("0").should == :latest end it "should be able to report the current level" do @@ -353,7 +345,7 @@ describe Puppet::Parser::Scope do @scope.setvar("1", :value1, :ephemeral => true) @scope.new_ephemeral @scope.setvar("0", :value2, :ephemeral => true) - @scope.lookupvar("1", false).should == :value1 + @scope.lookupvar("1").should == :value1 end describe "when calling unset_ephemeral_var without a level" do @@ -364,7 +356,7 @@ describe Puppet::Parser::Scope do @scope.unset_ephemeral_var - @scope.lookupvar("1", false).should == :undefined + @scope.lookupvar("1").should == :undefined end end @@ -378,7 +370,7 @@ describe Puppet::Parser::Scope do @scope.unset_ephemeral_var(2) - @scope.lookupvar("1", false).should == :value2 + @scope.lookupvar("1").should == :value2 end end end @@ -563,13 +555,13 @@ describe Puppet::Parser::Scope do it "should be able to unset normal variables" do @scope.setvar("foo", "bar") @scope.unsetvar("foo") - @scope.lookupvar("foo").should == "" + @scope.lookupvar("foo").should == :undefined end it "should be able to unset ephemeral variables" do @scope.setvar("0", "bar", :ephemeral => true) @scope.unsetvar("0") - @scope.lookupvar("0").should == "" + @scope.lookupvar("0").should == :undefined end it "should not unset ephemeral variables in previous ephemeral scope" do diff --git a/spec/unit/parser/templatewrapper_spec.rb b/spec/unit/parser/templatewrapper_spec.rb index afb0032fd..4a713b8a8 100755 --- a/spec/unit/parser/templatewrapper_spec.rb +++ b/spec/unit/parser/templatewrapper_spec.rb @@ -70,25 +70,25 @@ describe Puppet::Parser::TemplateWrapper do end it "should return the contents of a variable if called via method_missing" do - @scope.expects(:lookupvar).with("chicken", false).returns("is good") + @scope.expects(:lookupvar).with("chicken").returns("is good") tw = Puppet::Parser::TemplateWrapper.new(@scope) tw.chicken.should eql("is good") end it "should throw an exception if a variable is called via method_missing and it does not exist" do - @scope.expects(:lookupvar).with("chicken", false).returns(:undefined) + @scope.expects(:lookupvar).with("chicken").returns(:undefined) tw = Puppet::Parser::TemplateWrapper.new(@scope) lambda { tw.chicken }.should raise_error(Puppet::ParseError) end it "should allow you to check whether a variable is defined with has_variable?" do - @scope.expects(:lookupvar).with("chicken", false).returns("is good") + @scope.expects(:lookupvar).with("chicken").returns("is good") tw = Puppet::Parser::TemplateWrapper.new(@scope) tw.has_variable?("chicken").should eql(true) end it "should allow you to check whether a variable is not defined with has_variable?" do - @scope.expects(:lookupvar).with("chicken", false).returns(:undefined) + @scope.expects(:lookupvar).with("chicken").returns(:undefined) tw = Puppet::Parser::TemplateWrapper.new(@scope) tw.has_variable?("chicken").should eql(false) end -- cgit From 1954bbfe175ae7f18316e57af43362eb4ed73553 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Thu, 21 Oct 2010 20:39:33 -0700 Subject: Refactor on the road to #5027 -- remove unused Scope#strinterp One of the uses of lookupvar was in the method Scope#strinterp; this method is no longer used (string interpolation is now handled by the parser (for the syntax) and AST nodes (for the semantics)) so this use of lookupvar can be excised, along with a fair amount of surrounding code. --- spec/unit/parser/scope_spec.rb | 143 ----------------------------------------- 1 file changed, 143 deletions(-) (limited to 'spec/unit/parser') diff --git a/spec/unit/parser/scope_spec.rb b/spec/unit/parser/scope_spec.rb index b37cb4add..17f485c03 100755 --- a/spec/unit/parser/scope_spec.rb +++ b/spec/unit/parser/scope_spec.rb @@ -376,149 +376,6 @@ describe Puppet::Parser::Scope do end end - describe "when interpolating string" do - (0..9).each do |n| - it "should allow $#{n} to match" do - @scope.setvar(n.to_s, "value", :ephemeral => true) - - @scope.strinterp("$#{n}").should == "value" - end - end - - (0..9).each do |n| - it "should not allow $#{n} to match if not ephemeral" do - @scope.setvar(n.to_s, "value", :ephemeral => false) - - @scope.strinterp("$#{n}").should_not == "value" - end - end - - it "should not allow $10 to match" do - @scope.setvar("10", "value", :ephemeral => true) - - @scope.strinterp('==$10==').should_not == "==value==" - end - - it "should not allow ${10} to match" do - @scope.setvar("10", "value", :ephemeral => true) - - @scope.strinterp('==${10}==').should == "==value==" - end - - describe "with qualified variables" do - before do - @scopes = {} - klass = @scope.known_resource_types.add(Puppet::Resource::Type.new(:hostclass, "")) - Puppet::Parser::Resource.new("class", :main, :scope => @scope, :source => mock('source')).evaluate - @scopes[""] = @scope.class_scope(klass) - @scopes[""].setvar("test", "value") - - %w{one one::two one::two::three}.each do |name| - klass = @scope.known_resource_types.add(Puppet::Resource::Type.new(:hostclass, name)) - Puppet::Parser::Resource.new("class", name, :scope => @scope, :source => mock('source')).evaluate - @scopes[name] = @scope.class_scope(klass) - @scopes[name].setvar("test", "value-#{name.sub(/.+::/,'')}") - end - end - { - "===${one::two::three::test}===" => "===value-three===", - "===$one::two::three::test===" => "===value-three===", - "===${one::two::test}===" => "===value-two===", - "===$one::two::test===" => "===value-two===", - "===${one::test}===" => "===value-one===", - "===$one::test===" => "===value-one===", - "===${::test}===" => "===value===", - "===$::test===" => "===value===" - }.each do |input, output| - it "should parse '#{input}' correctly" do - @scope.strinterp(input).should == output - end - end - end - - tests = { - "===${test}===" => "===value===", - "===${test} ${test} ${test}===" => "===value value value===", - "===$test ${test} $test===" => "===value value value===", - "===\\$test===" => "===$test===", - '===\\$test string===' => "===$test string===", - '===$test string===' => "===value string===", - '===a testing $===' => "===a testing $===", - '===a testing \$===' => "===a testing $===", - "===an escaped \\\n carriage return===" => "===an escaped carriage return===", - '\$' => "$", - '\s' => "\s", - '\t' => "\t", - '\n' => "\n" - } - - tests.each do |input, output| - it "should parse '#{input}' correctly" do - @scope.setvar("test", "value") - @scope.strinterp(input).should == output - end - end - - # #523 - %w{d f h l w z}.each do |l| - it "should parse '#{l}' when escaped" do - string = "\\#{l}" - @scope.strinterp(string).should == string - end - end - end - - def test_strinterp - # Make and evaluate our classes so the qualified lookups work - parser = mkparser - klass = parser.newclass("") - scope = mkscope(:parser => parser) - Puppet::Parser::Resource.new(:type => "class", :title => :main, :scope => scope, :source => mock('source')).evaluate - - assert_nothing_raised { - scope.setvar("test","value") - } - - scopes = {"" => scope} - - %w{one one::two one::two::three}.each do |name| - klass = parser.newclass(name) - Puppet::Parser::Resource.new(:type => "class", :title => name, :scope => scope, :source => mock('source')).evaluate - scopes[name] = scope.class_scope(klass) - scopes[name].setvar("test", "value-#{name.sub(/.+::/,'')}") - end - - assert_equal("value", scope.lookupvar("::test"), "did not look up qualified value correctly") - tests.each do |input, output| - assert_nothing_raised("Failed to scan #{input.inspect}") do - assert_equal(output, scope.strinterp(input), 'did not parserret %s correctly' % input.inspect) - end - end - - logs = [] - Puppet::Util::Log.close - Puppet::Util::Log.newdestination(logs) - - # #523 - %w{d f h l w z}.each do |l| - string = "\\#{l}" - assert_nothing_raised do - - assert_equal( - string, scope.strinterp(string), - - 'did not parserret %s correctly' % string) - end - - - assert( - logs.detect { |m| m.message =~ /Unrecognised escape/ }, - - "Did not get warning about escape sequence with #{string}") - logs.clear - end - end - describe "when setting ephemeral vars from matches" do before :each do @match = stub 'match', :is_a? => true -- cgit From 10230cfc28e77dde127c157b7238fee2fc378969 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Sun, 24 Oct 2010 14:08:14 -0700 Subject: Step towards #5027 -- scopes should know if they are dynamic The logic for distinguishing dynamic / static scopes was borrowed from Nick & Paul's patch, the main differences here being 1) calling it "dynamic" (true/ false) rather than "parent_relationship" (:inherited/:dynamic) 2) aligning the default so that it only needs to get set in one place (the one that will eventually go away) and 3) setting it on createion rather than with a setter. Setting it in one place, on creation, also makes it easier to see that anytime we access a scope it will have the correct setting of Scope#dynamic and that this does not change. This commit also contains a minor refactor (removing Type#subscope) that is not strictly tied to the main purpose but lies in the direction we are needing to go and it simplified things to do it now. --- spec/unit/parser/scope_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'spec/unit/parser') diff --git a/spec/unit/parser/scope_spec.rb b/spec/unit/parser/scope_spec.rb index 17f485c03..8215535dd 100755 --- a/spec/unit/parser/scope_spec.rb +++ b/spec/unit/parser/scope_spec.rb @@ -73,6 +73,14 @@ describe Puppet::Parser::Scope do Puppet::Parser::Scope.new.singleton_class.ancestors.should be_include(mod) end + + it "should remember if it is dynamic" do + (!!Puppet::Parser::Scope.new(:dynamic => true).dynamic).should == true + end + + it "should assume it is not dynamic" do + (!Puppet::Parser::Scope.new.dynamic).should == true + end end describe "when looking up a variable" do -- cgit From 739260b28d7c09bacbb34cd4f4d4a32cfee01385 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Sun, 24 Oct 2010 23:29:38 -0700 Subject: Towards 5027 -- add options hash to lookupvar as with setvar This patch adds an options hash to lookupvar analogous to the one taken by setvar and uses it to pass in source location for error reporting. It also fixes the mechanism used by setvar (file was not being passed correctly), adds line and file information to errors in templates, and extends/corrects tests. As presently written it does not gather userful line numbers from inline templates and there are no tests for the template line number generation. --- spec/unit/parser/ast/arithmetic_operator_spec.rb | 10 ------ spec/unit/parser/ast/comparison_operator_spec.rb | 4 +-- spec/unit/parser/ast/leaf_spec.rb | 25 +++++++++------ spec/unit/parser/ast/vardef_spec.rb | 19 +++++++---- spec/unit/parser/templatewrapper_spec.rb | 40 +++++++++++------------- 5 files changed, 49 insertions(+), 49 deletions(-) (limited to 'spec/unit/parser') diff --git a/spec/unit/parser/ast/arithmetic_operator_spec.rb b/spec/unit/parser/ast/arithmetic_operator_spec.rb index 0aab6f080..9b54f09d8 100755 --- a/spec/unit/parser/ast/arithmetic_operator_spec.rb +++ b/spec/unit/parser/ast/arithmetic_operator_spec.rb @@ -60,14 +60,4 @@ describe Puppet::Parser::AST::ArithmeticOperator do operator.evaluate(@scope).should == 4.33 end - it "should work for variables too" do - @scope.expects(:lookupvar).with("one").returns(1) - @scope.expects(:lookupvar).with("two").returns(2) - one = ast::Variable.new( :value => "one" ) - two = ast::Variable.new( :value => "two" ) - - operator = ast::ArithmeticOperator.new :lval => one, :operator => "+", :rval => two - operator.evaluate(@scope).should == 3 - end - end diff --git a/spec/unit/parser/ast/comparison_operator_spec.rb b/spec/unit/parser/ast/comparison_operator_spec.rb index 3efe28bb6..060827390 100755 --- a/spec/unit/parser/ast/comparison_operator_spec.rb +++ b/spec/unit/parser/ast/comparison_operator_spec.rb @@ -95,8 +95,8 @@ describe Puppet::Parser::AST::ComparisonOperator do one = Puppet::Parser::AST::Variable.new( :value => "one" ) two = Puppet::Parser::AST::Variable.new( :value => "two" ) - @scope.expects(:lookupvar).with("one").returns(1) - @scope.expects(:lookupvar).with("two").returns(2) + one.expects(:safeevaluate).with(@scope).returns(1) + two.expects(:safeevaluate).with(@scope).returns(2) operator = Puppet::Parser::AST::ComparisonOperator.new :lval => one, :operator => "<", :rval => two operator.evaluate(@scope).should == true diff --git a/spec/unit/parser/ast/leaf_spec.rb b/spec/unit/parser/ast/leaf_spec.rb index 97c996b40..64fdcd659 100755 --- a/spec/unit/parser/ast/leaf_spec.rb +++ b/spec/unit/parser/ast/leaf_spec.rb @@ -107,7 +107,7 @@ describe Puppet::Parser::AST::HashOrArrayAccess do describe "when evaluating" do it "should evaluate the variable part if necessary" do - @scope.stubs(:lookupvar).with("a").returns(["b"]) + @scope.stubs(:lookupvar).with { |name,options| name == 'a'}.returns(["b"]) variable = stub 'variable', :evaluate => "a" access = Puppet::Parser::AST::HashOrArrayAccess.new(:variable => variable, :key => 0 ) @@ -118,7 +118,7 @@ describe Puppet::Parser::AST::HashOrArrayAccess do end it "should evaluate the access key part if necessary" do - @scope.stubs(:lookupvar).with("a").returns(["b"]) + @scope.stubs(:lookupvar).with { |name,options| name == 'a'}.returns(["b"]) index = stub 'index', :evaluate => 0 access = Puppet::Parser::AST::HashOrArrayAccess.new(:variable => "a", :key => index ) @@ -129,7 +129,7 @@ describe Puppet::Parser::AST::HashOrArrayAccess do end it "should be able to return an array member" do - @scope.stubs(:lookupvar).with("a").returns(["val1", "val2", "val3"]) + @scope.stubs(:lookupvar).with { |name,options| name == 'a'}.returns(["val1", "val2", "val3"]) access = Puppet::Parser::AST::HashOrArrayAccess.new(:variable => "a", :key => 1 ) @@ -153,7 +153,7 @@ describe Puppet::Parser::AST::HashOrArrayAccess do end it "should be able to return an hash value" do - @scope.stubs(:lookupvar).with("a").returns({ "key1" => "val1", "key2" => "val2", "key3" => "val3" }) + @scope.stubs(:lookupvar).with { |name,options| name == 'a'}.returns({ "key1" => "val1", "key2" => "val2", "key3" => "val3" }) access = Puppet::Parser::AST::HashOrArrayAccess.new(:variable => "a", :key => "key2" ) @@ -177,7 +177,7 @@ describe Puppet::Parser::AST::HashOrArrayAccess do end it "should raise an error if the variable wasn't in the scope" do - @scope.stubs(:lookupvar).with("a").returns(nil) + @scope.stubs(:lookupvar).with { |name,options| name == 'a'}.returns(nil) access = Puppet::Parser::AST::HashOrArrayAccess.new(:variable => "a", :key => "key2" ) @@ -190,7 +190,7 @@ describe Puppet::Parser::AST::HashOrArrayAccess do end it "should work with recursive hash access" do - @scope.stubs(:lookupvar).with("a").returns({ "key" => { "subkey" => "b" }}) + @scope.stubs(:lookupvar).with { |name,options| name == 'a'}.returns({ "key" => { "subkey" => "b" }}) access1 = Puppet::Parser::AST::HashOrArrayAccess.new(:variable => "a", :key => "key") access2 = Puppet::Parser::AST::HashOrArrayAccess.new(:variable => access1, :key => "subkey") @@ -199,7 +199,7 @@ describe Puppet::Parser::AST::HashOrArrayAccess do end it "should work with interleaved array and hash access" do - @scope.stubs(:lookupvar).with("a").returns({ "key" => [ "a" , "b" ]}) + @scope.stubs(:lookupvar).with { |name,options| name == 'a'}.returns({ "key" => [ "a" , "b" ]}) access1 = Puppet::Parser::AST::HashOrArrayAccess.new(:variable => "a", :key => "key") access2 = Puppet::Parser::AST::HashOrArrayAccess.new(:variable => access1, :key => 1) @@ -332,16 +332,21 @@ end describe Puppet::Parser::AST::Variable do before :each do @scope = stub 'scope' - @var = Puppet::Parser::AST::Variable.new(:value => "myvar") + @var = Puppet::Parser::AST::Variable.new(:value => "myvar", :file => 'my.pp', :line => 222) end it "should lookup the variable in scope" do - @scope.expects(:lookupvar).with("myvar").returns(:myvalue) + @scope.expects(:lookupvar).with { |name,options| name == "myvar" }.returns(:myvalue) + @var.safeevaluate(@scope).should == :myvalue + end + + it "should pass the source location to lookupvar" do + @scope.expects(:lookupvar).with { |name,options| name == "myvar" and options[:file] == 'my.pp' and options[:line] == 222 }.returns(:myvalue) @var.safeevaluate(@scope).should == :myvalue end it "should return undef if the variable wasn't set" do - @scope.expects(:lookupvar).with("myvar").returns(:undefined) + @scope.expects(:lookupvar).with { |name,options| name == "myvar" }.returns(:undefined) @var.safeevaluate(@scope).should == :undef end diff --git a/spec/unit/parser/ast/vardef_spec.rb b/spec/unit/parser/ast/vardef_spec.rb index a462e8ef5..5a851bb13 100755 --- a/spec/unit/parser/ast/vardef_spec.rb +++ b/spec/unit/parser/ast/vardef_spec.rb @@ -16,8 +16,7 @@ describe Puppet::Parser::AST::VarDef do name.expects(:safeevaluate).with(@scope) value.expects(:safeevaluate).with(@scope) - vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil, - :line => nil + vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil, :line => nil vardef.evaluate(@scope) end @@ -27,8 +26,7 @@ describe Puppet::Parser::AST::VarDef do @scope.expects(:setvar).with { |name,value,options| options[:append] == nil } - vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil, - :line => nil + vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil, :line => nil vardef.evaluate(@scope) end @@ -38,8 +36,17 @@ describe Puppet::Parser::AST::VarDef do @scope.expects(:setvar).with { |name,value,options| options[:append] == true } - vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil, - :line => nil, :append => true + vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => nil, :line => nil, :append => true + vardef.evaluate(@scope) + end + + it "should call pass the source location to setvar" do + name = stub 'name', :safeevaluate => "var" + value = stub 'value', :safeevaluate => "1" + + @scope.expects(:setvar).with { |name,value,options| options[:file] == 'setvar.pp' and options[:line] == 917 } + + vardef = Puppet::Parser::AST::VarDef.new :name => name, :value => value, :file => 'setvar.pp', :line => 917 vardef.evaluate(@scope) end diff --git a/spec/unit/parser/templatewrapper_spec.rb b/spec/unit/parser/templatewrapper_spec.rb index 4a713b8a8..0c7199ba1 100755 --- a/spec/unit/parser/templatewrapper_spec.rb +++ b/spec/unit/parser/templatewrapper_spec.rb @@ -17,6 +17,12 @@ describe Puppet::Parser::TemplateWrapper do @tw = Puppet::Parser::TemplateWrapper.new(@scope) end + def mock_template(source=nil) + template_mock = mock("template", :result => "woot!") + ERB.expects(:new).with("template contents", 0, "-").returns(template_mock) + template_mock.expects(:filename=).with(source) + end + it "should create a new object TemplateWrapper from a scope" do tw = Puppet::Parser::TemplateWrapper.new(@scope) @@ -54,41 +60,38 @@ describe Puppet::Parser::TemplateWrapper do end it "should return the processed template contents with a call to result" do - template_mock = mock("template", :result => "woot!") + mock_template("/tmp/fake_template") File.expects(:read).with("/tmp/fake_template").returns("template contents") - ERB.expects(:new).with("template contents", 0, "-").returns(template_mock) @tw.file = @file @tw.result.should eql("woot!") end it "should return the processed template contents with a call to result and a string" do - template_mock = mock("template", :result => "woot!") - ERB.expects(:new).with("template contents", 0, "-").returns(template_mock) - + mock_template @tw.result("template contents").should eql("woot!") end it "should return the contents of a variable if called via method_missing" do - @scope.expects(:lookupvar).with("chicken").returns("is good") + @scope.expects(:lookupvar).with { |name,options| name == "chicken"}.returns("is good") tw = Puppet::Parser::TemplateWrapper.new(@scope) tw.chicken.should eql("is good") end it "should throw an exception if a variable is called via method_missing and it does not exist" do - @scope.expects(:lookupvar).with("chicken").returns(:undefined) + @scope.expects(:lookupvar).with { |name,options| name == "chicken"}.returns(:undefined) tw = Puppet::Parser::TemplateWrapper.new(@scope) lambda { tw.chicken }.should raise_error(Puppet::ParseError) end it "should allow you to check whether a variable is defined with has_variable?" do - @scope.expects(:lookupvar).with("chicken").returns("is good") + @scope.expects(:lookupvar).with { |name,options| name == "chicken"}.returns("is good") tw = Puppet::Parser::TemplateWrapper.new(@scope) tw.has_variable?("chicken").should eql(true) end it "should allow you to check whether a variable is not defined with has_variable?" do - @scope.expects(:lookupvar).with("chicken").returns(:undefined) + @scope.expects(:lookupvar).with { |name,options| name == "chicken"}.returns(:undefined) tw = Puppet::Parser::TemplateWrapper.new(@scope) tw.has_variable?("chicken").should eql(false) end @@ -114,9 +117,7 @@ describe Puppet::Parser::TemplateWrapper do end it "should set all of the scope's variables as instance variables" do - template_mock = mock("template", :result => "woot!") - ERB.expects(:new).with("template contents", 0, "-").returns(template_mock) - + mock_template @scope.expects(:to_hash).returns("one" => "foo") @tw.result("template contents") @@ -124,8 +125,7 @@ describe Puppet::Parser::TemplateWrapper do end it "should not error out if one of the variables is a symbol" do - template_mock = mock("template", :result => "woot!") - ERB.expects(:new).with("template contents", 0, "-").returns(template_mock) + mock_template @scope.expects(:to_hash).returns(:_timestamp => "1234") @tw.result("template contents") @@ -133,13 +133,11 @@ describe Puppet::Parser::TemplateWrapper do %w{! . ; :}.each do |badchar| it "should translate #{badchar} to _ when setting the instance variables" do - template_mock = mock("template", :result => "woot!") - ERB.expects(:new).with("template contents", 0, "-").returns(template_mock) - - @scope.expects(:to_hash).returns("one#{badchar}" => "foo") - @tw.result("template contents") + mock_template + @scope.expects(:to_hash).returns("one#{badchar}" => "foo") + @tw.result("template contents") - @tw.instance_variable_get("@one_").should == "foo" - end + @tw.instance_variable_get("@one_").should == "foo" + end end end -- cgit From d0a56522f9c574b4a6db81caf4589175c901b09e Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Mon, 25 Oct 2010 09:59:57 -0700 Subject: Fix for #5027 -- generate a deprication warning for dynamic lookup This fix implements the same logic as Nick & Paul's patch in a different way. There aren't any tests yet and I'm still working out if I agree with the handling of some edge cases, so this should be considered premliminary. --- spec/unit/parser/ast/leaf_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'spec/unit/parser') diff --git a/spec/unit/parser/ast/leaf_spec.rb b/spec/unit/parser/ast/leaf_spec.rb index 64fdcd659..cd09eaf94 100755 --- a/spec/unit/parser/ast/leaf_spec.rb +++ b/spec/unit/parser/ast/leaf_spec.rb @@ -137,7 +137,7 @@ describe Puppet::Parser::AST::HashOrArrayAccess do end it "should be able to return an array member when index is a stringified number" do - @scope.stubs(:lookupvar).with("a").returns(["val1", "val2", "val3"]) + @scope.stubs(:lookupvar).with { |name,options| name == "a" }.returns(["val1", "val2", "val3"]) access = Puppet::Parser::AST::HashOrArrayAccess.new(:variable => "a", :key => "1" ) @@ -145,7 +145,7 @@ describe Puppet::Parser::AST::HashOrArrayAccess do end it "should raise an error when accessing an array with a key" do - @scope.stubs(:lookupvar).with("a").returns(["val1", "val2", "val3"]) + @scope.stubs(:lookupvar).with { |name,options| name == "a"}.returns(["val1", "val2", "val3"]) access = Puppet::Parser::AST::HashOrArrayAccess.new(:variable => "a", :key => "get_me_the_second_element_please" ) @@ -161,7 +161,7 @@ describe Puppet::Parser::AST::HashOrArrayAccess do end it "should be able to return an hash value with a numerical key" do - @scope.stubs(:lookupvar).with("a").returns({ "key1" => "val1", "key2" => "val2", "45" => "45", "key3" => "val3" }) + @scope.stubs(:lookupvar).with { |name,options| name == "a"}.returns({ "key1" => "val1", "key2" => "val2", "45" => "45", "key3" => "val3" }) access = Puppet::Parser::AST::HashOrArrayAccess.new(:variable => "a", :key => "45" ) @@ -169,7 +169,7 @@ describe Puppet::Parser::AST::HashOrArrayAccess do end it "should raise an error if the variable lookup didn't return an hash or an array" do - @scope.stubs(:lookupvar).with("a").returns("I'm a string") + @scope.stubs(:lookupvar).with { |name,options| name == "a"}.returns("I'm a string") access = Puppet::Parser::AST::HashOrArrayAccess.new(:variable => "a", :key => "key2" ) @@ -220,7 +220,7 @@ describe Puppet::Parser::AST::HashOrArrayAccess do end it "should raise an error when assigning an array element with a key" do - @scope.stubs(:lookupvar).with("a").returns([]) + @scope.stubs(:lookupvar).with { |name,options| name == "a"}.returns([]) access = Puppet::Parser::AST::HashOrArrayAccess.new(:variable => "a", :key => "get_me_the_second_element_please" ) @@ -238,7 +238,7 @@ describe Puppet::Parser::AST::HashOrArrayAccess do end it "should raise an error when trying to overwrite an hash value" do - @scope.stubs(:lookupvar).with("a").returns({ "key" => [ "a" , "b" ]}) + @scope.stubs(:lookupvar).with { |name,options| name == "a" }.returns({ "key" => [ "a" , "b" ]}) access = Puppet::Parser::AST::HashOrArrayAccess.new(:variable => "a", :key => "key") lambda { access.assign(@scope, "test") }.should raise_error -- cgit From db11770718c61f9ee3d5fcd703c5c0c7c05227ca Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Wed, 13 Apr 2011 00:35:11 -0700 Subject: maint: clean up the spec test headers in bulk. We now use a shebang of: #!/usr/bin/env rspec This enables the direct execution of spec tests again, which was lost earlier during the transition to more directly using the rspec2 runtime environment. --- spec/unit/parser/ast/arithmetic_operator_spec.rb | 3 +-- spec/unit/parser/ast/astarray_spec.rb | 3 +-- spec/unit/parser/ast/asthash_spec.rb | 3 +-- spec/unit/parser/ast/boolean_operator_spec.rb | 3 +-- spec/unit/parser/ast/casestatement_spec.rb | 3 +-- spec/unit/parser/ast/collection_spec.rb | 3 +-- spec/unit/parser/ast/collexpr_spec.rb | 3 +-- spec/unit/parser/ast/comparison_operator_spec.rb | 3 +-- spec/unit/parser/ast/definition_spec.rb | 3 +-- spec/unit/parser/ast/function_spec.rb | 3 +-- spec/unit/parser/ast/hostclass_spec.rb | 3 +-- spec/unit/parser/ast/ifstatement_spec.rb | 3 +-- spec/unit/parser/ast/in_operator_spec.rb | 3 +-- spec/unit/parser/ast/leaf_spec.rb | 3 +-- spec/unit/parser/ast/match_operator_spec.rb | 3 +-- spec/unit/parser/ast/minus_spec.rb | 3 +-- spec/unit/parser/ast/node_spec.rb | 3 +-- spec/unit/parser/ast/nop_spec.rb | 3 +-- spec/unit/parser/ast/not_spec.rb | 3 +-- spec/unit/parser/ast/relationship_spec.rb | 3 +-- spec/unit/parser/ast/resource_defaults_spec.rb | 3 +-- spec/unit/parser/ast/resource_override_spec.rb | 3 +-- spec/unit/parser/ast/resource_reference_spec.rb | 3 +-- spec/unit/parser/ast/resource_spec.rb | 3 +-- spec/unit/parser/ast/selector_spec.rb | 3 +-- spec/unit/parser/ast/vardef_spec.rb | 3 +-- spec/unit/parser/ast_spec.rb | 3 +-- spec/unit/parser/collector_spec.rb | 3 +-- spec/unit/parser/compiler_spec.rb | 3 +-- spec/unit/parser/files_spec.rb | 3 +-- spec/unit/parser/functions/defined_spec.rb | 3 +-- spec/unit/parser/functions/extlookup_spec.rb | 3 +-- spec/unit/parser/functions/fqdn_rand_spec.rb | 3 +-- spec/unit/parser/functions/generate_spec.rb | 3 +-- spec/unit/parser/functions/include_spec.rb | 3 +-- spec/unit/parser/functions/inline_template_spec.rb | 3 +-- spec/unit/parser/functions/realize_spec.rb | 3 +-- spec/unit/parser/functions/regsubst_spec.rb | 3 +-- spec/unit/parser/functions/require_spec.rb | 3 +-- spec/unit/parser/functions/shellquote_spec.rb | 3 +-- spec/unit/parser/functions/split_spec.rb | 3 +-- spec/unit/parser/functions/sprintf_spec.rb | 3 +-- spec/unit/parser/functions/tag_spec.rb | 3 +-- spec/unit/parser/functions/template_spec.rb | 3 +-- spec/unit/parser/functions/versioncmp_spec.rb | 3 +-- spec/unit/parser/functions_spec.rb | 3 +-- spec/unit/parser/lexer_spec.rb | 3 +-- spec/unit/parser/parser_spec.rb | 3 +-- spec/unit/parser/relationship_spec.rb | 3 +-- spec/unit/parser/resource_spec.rb | 3 +-- spec/unit/parser/scope_spec.rb | 3 +-- spec/unit/parser/templatewrapper_spec.rb | 3 +-- spec/unit/parser/type_loader_spec.rb | 3 +-- 53 files changed, 53 insertions(+), 106 deletions(-) (limited to 'spec/unit/parser') diff --git a/spec/unit/parser/ast/arithmetic_operator_spec.rb b/spec/unit/parser/ast/arithmetic_operator_spec.rb index 9b54f09d8..144ebd78c 100755 --- a/spec/unit/parser/ast/arithmetic_operator_spec.rb +++ b/spec/unit/parser/ast/arithmetic_operator_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::ArithmeticOperator do diff --git a/spec/unit/parser/ast/astarray_spec.rb b/spec/unit/parser/ast/astarray_spec.rb index 4429ab1fe..a3f56052a 100755 --- a/spec/unit/parser/ast/astarray_spec.rb +++ b/spec/unit/parser/ast/astarray_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::ASTArray do diff --git a/spec/unit/parser/ast/asthash_spec.rb b/spec/unit/parser/ast/asthash_spec.rb index 09033284e..d7fbbfae9 100755 --- a/spec/unit/parser/ast/asthash_spec.rb +++ b/spec/unit/parser/ast/asthash_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::ASTHash do diff --git a/spec/unit/parser/ast/boolean_operator_spec.rb b/spec/unit/parser/ast/boolean_operator_spec.rb index 2251d0827..287f466a7 100755 --- a/spec/unit/parser/ast/boolean_operator_spec.rb +++ b/spec/unit/parser/ast/boolean_operator_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::BooleanOperator do diff --git a/spec/unit/parser/ast/casestatement_spec.rb b/spec/unit/parser/ast/casestatement_spec.rb index d507beb58..e21190706 100755 --- a/spec/unit/parser/ast/casestatement_spec.rb +++ b/spec/unit/parser/ast/casestatement_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::CaseStatement do diff --git a/spec/unit/parser/ast/collection_spec.rb b/spec/unit/parser/ast/collection_spec.rb index fd7bf75c1..78094e68d 100755 --- a/spec/unit/parser/ast/collection_spec.rb +++ b/spec/unit/parser/ast/collection_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::Collection do diff --git a/spec/unit/parser/ast/collexpr_spec.rb b/spec/unit/parser/ast/collexpr_spec.rb index f5e340ce8..454e7481b 100755 --- a/spec/unit/parser/ast/collexpr_spec.rb +++ b/spec/unit/parser/ast/collexpr_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::CollExpr do diff --git a/spec/unit/parser/ast/comparison_operator_spec.rb b/spec/unit/parser/ast/comparison_operator_spec.rb index 060827390..96f4562e9 100755 --- a/spec/unit/parser/ast/comparison_operator_spec.rb +++ b/spec/unit/parser/ast/comparison_operator_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::ComparisonOperator do diff --git a/spec/unit/parser/ast/definition_spec.rb b/spec/unit/parser/ast/definition_spec.rb index f2a211ad2..8b2f7f26f 100755 --- a/spec/unit/parser/ast/definition_spec.rb +++ b/spec/unit/parser/ast/definition_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::Definition do diff --git a/spec/unit/parser/ast/function_spec.rb b/spec/unit/parser/ast/function_spec.rb index 6f9f33b8e..c52e806e9 100755 --- a/spec/unit/parser/ast/function_spec.rb +++ b/spec/unit/parser/ast/function_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::Function do diff --git a/spec/unit/parser/ast/hostclass_spec.rb b/spec/unit/parser/ast/hostclass_spec.rb index 9c320d1be..ee154fac8 100755 --- a/spec/unit/parser/ast/hostclass_spec.rb +++ b/spec/unit/parser/ast/hostclass_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::Hostclass do diff --git a/spec/unit/parser/ast/ifstatement_spec.rb b/spec/unit/parser/ast/ifstatement_spec.rb index 24e07f5fe..4b6e0b8e5 100755 --- a/spec/unit/parser/ast/ifstatement_spec.rb +++ b/spec/unit/parser/ast/ifstatement_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::IfStatement do diff --git a/spec/unit/parser/ast/in_operator_spec.rb b/spec/unit/parser/ast/in_operator_spec.rb index 95349d45d..b6b6fbb89 100755 --- a/spec/unit/parser/ast/in_operator_spec.rb +++ b/spec/unit/parser/ast/in_operator_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' require 'puppet/parser/ast/in_operator' diff --git a/spec/unit/parser/ast/leaf_spec.rb b/spec/unit/parser/ast/leaf_spec.rb index cd09eaf94..ff3fed5e9 100755 --- a/spec/unit/parser/ast/leaf_spec.rb +++ b/spec/unit/parser/ast/leaf_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::Leaf do diff --git a/spec/unit/parser/ast/match_operator_spec.rb b/spec/unit/parser/ast/match_operator_spec.rb index 188b837b3..0f9235aeb 100755 --- a/spec/unit/parser/ast/match_operator_spec.rb +++ b/spec/unit/parser/ast/match_operator_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::MatchOperator do diff --git a/spec/unit/parser/ast/minus_spec.rb b/spec/unit/parser/ast/minus_spec.rb index c8e5339a7..8ebd14e80 100755 --- a/spec/unit/parser/ast/minus_spec.rb +++ b/spec/unit/parser/ast/minus_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::Minus do diff --git a/spec/unit/parser/ast/node_spec.rb b/spec/unit/parser/ast/node_spec.rb index 434cb95bf..c2e187184 100755 --- a/spec/unit/parser/ast/node_spec.rb +++ b/spec/unit/parser/ast/node_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::Node do diff --git a/spec/unit/parser/ast/nop_spec.rb b/spec/unit/parser/ast/nop_spec.rb index d2307c84a..81302fa55 100755 --- a/spec/unit/parser/ast/nop_spec.rb +++ b/spec/unit/parser/ast/nop_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::Nop do diff --git a/spec/unit/parser/ast/not_spec.rb b/spec/unit/parser/ast/not_spec.rb index 60fc11c5c..6569af699 100755 --- a/spec/unit/parser/ast/not_spec.rb +++ b/spec/unit/parser/ast/not_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::Not do diff --git a/spec/unit/parser/ast/relationship_spec.rb b/spec/unit/parser/ast/relationship_spec.rb index 871b05c30..441ac45b1 100755 --- a/spec/unit/parser/ast/relationship_spec.rb +++ b/spec/unit/parser/ast/relationship_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::Relationship do diff --git a/spec/unit/parser/ast/resource_defaults_spec.rb b/spec/unit/parser/ast/resource_defaults_spec.rb index 7402be8ea..8164828e1 100755 --- a/spec/unit/parser/ast/resource_defaults_spec.rb +++ b/spec/unit/parser/ast/resource_defaults_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::ResourceDefaults do diff --git a/spec/unit/parser/ast/resource_override_spec.rb b/spec/unit/parser/ast/resource_override_spec.rb index cb126ce62..458d9a4bf 100755 --- a/spec/unit/parser/ast/resource_override_spec.rb +++ b/spec/unit/parser/ast/resource_override_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::ResourceOverride do diff --git a/spec/unit/parser/ast/resource_reference_spec.rb b/spec/unit/parser/ast/resource_reference_spec.rb index b581e9305..627754dd1 100755 --- a/spec/unit/parser/ast/resource_reference_spec.rb +++ b/spec/unit/parser/ast/resource_reference_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::ResourceReference do diff --git a/spec/unit/parser/ast/resource_spec.rb b/spec/unit/parser/ast/resource_spec.rb index 883b71866..68ad9c229 100755 --- a/spec/unit/parser/ast/resource_spec.rb +++ b/spec/unit/parser/ast/resource_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::Resource do diff --git a/spec/unit/parser/ast/selector_spec.rb b/spec/unit/parser/ast/selector_spec.rb index 787a3360f..1bf5f6757 100755 --- a/spec/unit/parser/ast/selector_spec.rb +++ b/spec/unit/parser/ast/selector_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::Selector do diff --git a/spec/unit/parser/ast/vardef_spec.rb b/spec/unit/parser/ast/vardef_spec.rb index 5a851bb13..7dd2b31e7 100755 --- a/spec/unit/parser/ast/vardef_spec.rb +++ b/spec/unit/parser/ast/vardef_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::AST::VarDef do diff --git a/spec/unit/parser/ast_spec.rb b/spec/unit/parser/ast_spec.rb index ba8724242..4d4871219 100755 --- a/spec/unit/parser/ast_spec.rb +++ b/spec/unit/parser/ast_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' require 'puppet/parser/ast' diff --git a/spec/unit/parser/collector_spec.rb b/spec/unit/parser/collector_spec.rb index 75c113eae..01918d2a0 100755 --- a/spec/unit/parser/collector_spec.rb +++ b/spec/unit/parser/collector_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' require 'puppet/rails' diff --git a/spec/unit/parser/compiler_spec.rb b/spec/unit/parser/compiler_spec.rb index de4bee3e9..ced760b76 100755 --- a/spec/unit/parser/compiler_spec.rb +++ b/spec/unit/parser/compiler_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' class CompilerTestResource diff --git a/spec/unit/parser/files_spec.rb b/spec/unit/parser/files_spec.rb index 7710871dc..04777f0ec 100755 --- a/spec/unit/parser/files_spec.rb +++ b/spec/unit/parser/files_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' require 'puppet/parser/files' diff --git a/spec/unit/parser/functions/defined_spec.rb b/spec/unit/parser/functions/defined_spec.rb index 8b0fb4e2f..0651864fb 100755 --- a/spec/unit/parser/functions/defined_spec.rb +++ b/spec/unit/parser/functions/defined_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe "the 'defined' function" do diff --git a/spec/unit/parser/functions/extlookup_spec.rb b/spec/unit/parser/functions/extlookup_spec.rb index ad89f6575..f68daaf3f 100755 --- a/spec/unit/parser/functions/extlookup_spec.rb +++ b/spec/unit/parser/functions/extlookup_spec.rb @@ -1,5 +1,4 @@ -#! /usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' require 'tempfile' diff --git a/spec/unit/parser/functions/fqdn_rand_spec.rb b/spec/unit/parser/functions/fqdn_rand_spec.rb index 90792e182..90fc0ef41 100755 --- a/spec/unit/parser/functions/fqdn_rand_spec.rb +++ b/spec/unit/parser/functions/fqdn_rand_spec.rb @@ -1,5 +1,4 @@ -#! /usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe "the fqdn_rand function" do diff --git a/spec/unit/parser/functions/generate_spec.rb b/spec/unit/parser/functions/generate_spec.rb index 3351291d5..6c90ae531 100755 --- a/spec/unit/parser/functions/generate_spec.rb +++ b/spec/unit/parser/functions/generate_spec.rb @@ -1,5 +1,4 @@ -#! /usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe "the generate function" do diff --git a/spec/unit/parser/functions/include_spec.rb b/spec/unit/parser/functions/include_spec.rb index b477f1439..15206cd7c 100755 --- a/spec/unit/parser/functions/include_spec.rb +++ b/spec/unit/parser/functions/include_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe "the 'include' function" do diff --git a/spec/unit/parser/functions/inline_template_spec.rb b/spec/unit/parser/functions/inline_template_spec.rb index e009870c5..a9ac0c2d0 100755 --- a/spec/unit/parser/functions/inline_template_spec.rb +++ b/spec/unit/parser/functions/inline_template_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe "the inline_template function" do diff --git a/spec/unit/parser/functions/realize_spec.rb b/spec/unit/parser/functions/realize_spec.rb index 7a039c002..159805cbd 100755 --- a/spec/unit/parser/functions/realize_spec.rb +++ b/spec/unit/parser/functions/realize_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe "the realize function" do diff --git a/spec/unit/parser/functions/regsubst_spec.rb b/spec/unit/parser/functions/regsubst_spec.rb index 0cab3d18c..4ed3bcf68 100755 --- a/spec/unit/parser/functions/regsubst_spec.rb +++ b/spec/unit/parser/functions/regsubst_spec.rb @@ -1,5 +1,4 @@ -#! /usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe "the regsubst function" do diff --git a/spec/unit/parser/functions/require_spec.rb b/spec/unit/parser/functions/require_spec.rb index cb89db3a1..692b35305 100755 --- a/spec/unit/parser/functions/require_spec.rb +++ b/spec/unit/parser/functions/require_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe "the require function" do diff --git a/spec/unit/parser/functions/shellquote_spec.rb b/spec/unit/parser/functions/shellquote_spec.rb index 86181dee0..b100b4913 100755 --- a/spec/unit/parser/functions/shellquote_spec.rb +++ b/spec/unit/parser/functions/shellquote_spec.rb @@ -1,5 +1,4 @@ -#! /usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe "the shellquote function" do diff --git a/spec/unit/parser/functions/split_spec.rb b/spec/unit/parser/functions/split_spec.rb index e321b6d9f..18a21a0cf 100755 --- a/spec/unit/parser/functions/split_spec.rb +++ b/spec/unit/parser/functions/split_spec.rb @@ -1,5 +1,4 @@ -#! /usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe "the split function" do diff --git a/spec/unit/parser/functions/sprintf_spec.rb b/spec/unit/parser/functions/sprintf_spec.rb index 49c5324f8..bd4863f23 100755 --- a/spec/unit/parser/functions/sprintf_spec.rb +++ b/spec/unit/parser/functions/sprintf_spec.rb @@ -1,5 +1,4 @@ -#! /usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe "the sprintf function" do diff --git a/spec/unit/parser/functions/tag_spec.rb b/spec/unit/parser/functions/tag_spec.rb index a8c57b7a4..e8a07e1bb 100755 --- a/spec/unit/parser/functions/tag_spec.rb +++ b/spec/unit/parser/functions/tag_spec.rb @@ -1,5 +1,4 @@ -#! /usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe "the 'tag' function" do diff --git a/spec/unit/parser/functions/template_spec.rb b/spec/unit/parser/functions/template_spec.rb index 64d992297..e7ee974d3 100755 --- a/spec/unit/parser/functions/template_spec.rb +++ b/spec/unit/parser/functions/template_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe "the template function" do diff --git a/spec/unit/parser/functions/versioncmp_spec.rb b/spec/unit/parser/functions/versioncmp_spec.rb index d7ae0152a..6fc724c38 100755 --- a/spec/unit/parser/functions/versioncmp_spec.rb +++ b/spec/unit/parser/functions/versioncmp_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe "the versioncmp function" do diff --git a/spec/unit/parser/functions_spec.rb b/spec/unit/parser/functions_spec.rb index 79585f12d..8240a184c 100755 --- a/spec/unit/parser/functions_spec.rb +++ b/spec/unit/parser/functions_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::Functions do diff --git a/spec/unit/parser/lexer_spec.rb b/spec/unit/parser/lexer_spec.rb index 2eb2581a2..6cdb0553a 100755 --- a/spec/unit/parser/lexer_spec.rb +++ b/spec/unit/parser/lexer_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' require 'puppet/parser/lexer' diff --git a/spec/unit/parser/parser_spec.rb b/spec/unit/parser/parser_spec.rb index cb90939fa..78adc30ee 100755 --- a/spec/unit/parser/parser_spec.rb +++ b/spec/unit/parser/parser_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser do diff --git a/spec/unit/parser/relationship_spec.rb b/spec/unit/parser/relationship_spec.rb index f44a5c844..5a49831e1 100755 --- a/spec/unit/parser/relationship_spec.rb +++ b/spec/unit/parser/relationship_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' require 'puppet/parser/relationship' diff --git a/spec/unit/parser/resource_spec.rb b/spec/unit/parser/resource_spec.rb index 078b7de95..b03c18e5f 100755 --- a/spec/unit/parser/resource_spec.rb +++ b/spec/unit/parser/resource_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' # LAK: FIXME This is just new tests for resources; I have diff --git a/spec/unit/parser/scope_spec.rb b/spec/unit/parser/scope_spec.rb index 8215535dd..bf4d1e29e 100755 --- a/spec/unit/parser/scope_spec.rb +++ b/spec/unit/parser/scope_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' describe Puppet::Parser::Scope do diff --git a/spec/unit/parser/templatewrapper_spec.rb b/spec/unit/parser/templatewrapper_spec.rb index 0c7199ba1..600293bbf 100755 --- a/spec/unit/parser/templatewrapper_spec.rb +++ b/spec/unit/parser/templatewrapper_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' require 'puppet/parser/templatewrapper' diff --git a/spec/unit/parser/type_loader_spec.rb b/spec/unit/parser/type_loader_spec.rb index dfbd2f278..9367b61c8 100755 --- a/spec/unit/parser/type_loader_spec.rb +++ b/spec/unit/parser/type_loader_spec.rb @@ -1,5 +1,4 @@ -#!/usr/bin/env ruby - +#!/usr/bin/env rspec require 'spec_helper' require 'puppet/parser/type_loader' -- cgit From 24a277c5e805ce16e0b86e17e6cb2fbe1945ae07 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Wed, 13 Apr 2011 14:38:23 -0700 Subject: (#6928) Removed --ignoreimport This was only used with --parseonly, which is gone. Paired-With: Jesse Wolfe --- spec/unit/parser/type_loader_spec.rb | 6 ------ 1 file changed, 6 deletions(-) (limited to 'spec/unit/parser') diff --git a/spec/unit/parser/type_loader_spec.rb b/spec/unit/parser/type_loader_spec.rb index 9367b61c8..48a3f29d3 100755 --- a/spec/unit/parser/type_loader_spec.rb +++ b/spec/unit/parser/type_loader_spec.rb @@ -44,12 +44,6 @@ describe Puppet::Parser::TypeLoader do Puppet::Parser::Parser.any_instance.stubs(:file=) end - it "should return immediately when imports are being ignored" do - Puppet::Parser::Files.expects(:find_manifests).never - Puppet[:ignoreimport] = true - @loader.import("foo").should be_nil - end - it "should find all manifests matching the file or pattern" do Puppet::Parser::Files.expects(:find_manifests).with { |pat, opts| pat == "myfile" }.returns ["modname", %w{one}] @loader.import("myfile") -- cgit From 5915814c47649bb4b957b4be4fcee5919b859451 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Wed, 13 Apr 2011 16:57:11 -0700 Subject: Revert "(#6928) Removed --ignoreimport" This reverts commit 24a277c5e805ce16e0b86e17e6cb2fbe1945ae07. Despite not needing --ignoreimport as an option anymore, it's still used internally and has to stay. --- spec/unit/parser/type_loader_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'spec/unit/parser') diff --git a/spec/unit/parser/type_loader_spec.rb b/spec/unit/parser/type_loader_spec.rb index 48a3f29d3..9367b61c8 100755 --- a/spec/unit/parser/type_loader_spec.rb +++ b/spec/unit/parser/type_loader_spec.rb @@ -44,6 +44,12 @@ describe Puppet::Parser::TypeLoader do Puppet::Parser::Parser.any_instance.stubs(:file=) end + it "should return immediately when imports are being ignored" do + Puppet::Parser::Files.expects(:find_manifests).never + Puppet[:ignoreimport] = true + @loader.import("foo").should be_nil + end + it "should find all manifests matching the file or pattern" do Puppet::Parser::Files.expects(:find_manifests).with { |pat, opts| pat == "myfile" }.returns ["modname", %w{one}] @loader.import("myfile") -- cgit