summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser/functions
diff options
context:
space:
mode:
authorMax Martin <max@puppetlabs.com>2011-04-13 17:30:44 -0700
committerMax Martin <max@puppetlabs.com>2011-04-13 17:30:44 -0700
commit3dde838ac992571e13262ea29ba3a0eb8152e753 (patch)
tree90520cf62bfa2f1bb9c992bbfe1bc47ae10471f2 /spec/unit/parser/functions
parentfe45c2417af580597cd39adec96a30a05a7cd66a (diff)
parent3ab44c7ce01ab86a995deb66228f5be95239c92a (diff)
downloadpuppet-3dde838ac992571e13262ea29ba3a0eb8152e753.tar.gz
puppet-3dde838ac992571e13262ea29ba3a0eb8152e753.tar.xz
puppet-3dde838ac992571e13262ea29ba3a0eb8152e753.zip
Merge branch 'next'
* next: (204 commits) Revert "(#6928) Removed --ignoreimport" Updated CHANGELOG for 2.6.8rc1 (#6928) Removed --ignoreimport (#6928) Remove --parseonly (#6928) Add a Parser face with Validate action (#6830) Fix sha1 to digest/sha1 require issue for Ruby 1.9 (#6830) Fix UTF-8 encoding issue for Ruby 1.9 (#6830) Fix string method sub call on a symbol for Ruby 1.9 (#2331) Remove darwinports pkg provider, replace with rewritten macports provider (#7059) handle inherited action binding scope maint: ensure we handle '-foo=' options correctly in faces. (#2150) Fix File const lookup when configuring routes Fixed #7082 - Added system support for groups maint: install erb templates under lib/ maint: clean up the spec test headers in bulk. (#7056) Use 'face' rather than 'faces' in the production code. maint: eliminate deprecated since 2008 code from Puppet. (#6117) Add POST support to indirector requests (#6962) Move option handling into #parse_options, not #preinit. maint: whitespace cleanup for puppet/util/command_line. ...
Diffstat (limited to 'spec/unit/parser/functions')
-rwxr-xr-xspec/unit/parser/functions/create_resources_spec.rb2
-rwxr-xr-xspec/unit/parser/functions/defined_spec.rb5
-rwxr-xr-xspec/unit/parser/functions/extlookup_spec.rb15
-rwxr-xr-xspec/unit/parser/functions/fqdn_rand_spec.rb25
-rwxr-xr-xspec/unit/parser/functions/generate_spec.rb5
-rwxr-xr-xspec/unit/parser/functions/include_spec.rb5
-rwxr-xr-xspec/unit/parser/functions/inline_template_spec.rb5
-rwxr-xr-xspec/unit/parser/functions/realize_spec.rb5
-rwxr-xr-xspec/unit/parser/functions/regsubst_spec.rb5
-rwxr-xr-xspec/unit/parser/functions/require_spec.rb5
-rwxr-xr-xspec/unit/parser/functions/shellquote_spec.rb5
-rwxr-xr-xspec/unit/parser/functions/split_spec.rb5
-rwxr-xr-xspec/unit/parser/functions/sprintf_spec.rb5
-rwxr-xr-xspec/unit/parser/functions/tag_spec.rb5
-rwxr-xr-xspec/unit/parser/functions/template_spec.rb5
-rwxr-xr-xspec/unit/parser/functions/versioncmp_spec.rb5
16 files changed, 46 insertions, 61 deletions
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..0651864fb 100755
--- a/spec/unit/parser/functions/defined_spec.rb
+++ b/spec/unit/parser/functions/defined_spec.rb
@@ -1,6 +1,5 @@
-#!/usr/bin/env ruby
-
-require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+#!/usr/bin/env rspec
+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..f68daaf3f 100755
--- a/spec/unit/parser/functions/extlookup_spec.rb
+++ b/spec/unit/parser/functions/extlookup_spec.rb
@@ -1,6 +1,5 @@
-#! /usr/bin/env ruby
-
-require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+#!/usr/bin/env rspec
+require 'spec_helper'
require 'tempfile'
describe "the extlookup function" do
@@ -65,7 +64,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 +73,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 be2e6fa76..90fc0ef41 100755
--- a/spec/unit/parser/functions/fqdn_rand_spec.rb
+++ b/spec/unit/parser/functions/fqdn_rand_spec.rb
@@ -1,6 +1,5 @@
-#! /usr/bin/env ruby
-
-require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+#!/usr/bin/env rspec
+require 'spec_helper'
describe "the fqdn_rand function" do
before :all do
@@ -16,49 +15,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
diff --git a/spec/unit/parser/functions/generate_spec.rb b/spec/unit/parser/functions/generate_spec.rb
index d25015b56..6c90ae531 100755
--- a/spec/unit/parser/functions/generate_spec.rb
+++ b/spec/unit/parser/functions/generate_spec.rb
@@ -1,6 +1,5 @@
-#! /usr/bin/env ruby
-
-require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+#!/usr/bin/env rspec
+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..15206cd7c 100755
--- a/spec/unit/parser/functions/include_spec.rb
+++ b/spec/unit/parser/functions/include_spec.rb
@@ -1,6 +1,5 @@
-#!/usr/bin/env ruby
-
-require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+#!/usr/bin/env rspec
+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..a9ac0c2d0 100755
--- a/spec/unit/parser/functions/inline_template_spec.rb
+++ b/spec/unit/parser/functions/inline_template_spec.rb
@@ -1,6 +1,5 @@
-#!/usr/bin/env ruby
-
-require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+#!/usr/bin/env rspec
+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..159805cbd 100755
--- a/spec/unit/parser/functions/realize_spec.rb
+++ b/spec/unit/parser/functions/realize_spec.rb
@@ -1,6 +1,5 @@
-#!/usr/bin/env ruby
-
-require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+#!/usr/bin/env rspec
+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..4ed3bcf68 100755
--- a/spec/unit/parser/functions/regsubst_spec.rb
+++ b/spec/unit/parser/functions/regsubst_spec.rb
@@ -1,6 +1,5 @@
-#! /usr/bin/env ruby
-
-require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+#!/usr/bin/env rspec
+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..692b35305 100755
--- a/spec/unit/parser/functions/require_spec.rb
+++ b/spec/unit/parser/functions/require_spec.rb
@@ -1,6 +1,5 @@
-#!/usr/bin/env ruby
-
-require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+#!/usr/bin/env rspec
+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..b100b4913 100755
--- a/spec/unit/parser/functions/shellquote_spec.rb
+++ b/spec/unit/parser/functions/shellquote_spec.rb
@@ -1,6 +1,5 @@
-#! /usr/bin/env ruby
-
-require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+#!/usr/bin/env rspec
+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..18a21a0cf 100755
--- a/spec/unit/parser/functions/split_spec.rb
+++ b/spec/unit/parser/functions/split_spec.rb
@@ -1,6 +1,5 @@
-#! /usr/bin/env ruby
-
-require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+#!/usr/bin/env rspec
+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..bd4863f23 100755
--- a/spec/unit/parser/functions/sprintf_spec.rb
+++ b/spec/unit/parser/functions/sprintf_spec.rb
@@ -1,6 +1,5 @@
-#! /usr/bin/env ruby
-
-require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+#!/usr/bin/env rspec
+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..e8a07e1bb 100755
--- a/spec/unit/parser/functions/tag_spec.rb
+++ b/spec/unit/parser/functions/tag_spec.rb
@@ -1,6 +1,5 @@
-#! /usr/bin/env ruby
-
-require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+#!/usr/bin/env rspec
+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..e7ee974d3 100755
--- a/spec/unit/parser/functions/template_spec.rb
+++ b/spec/unit/parser/functions/template_spec.rb
@@ -1,6 +1,5 @@
-#!/usr/bin/env ruby
-
-require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+#!/usr/bin/env rspec
+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..6fc724c38 100755
--- a/spec/unit/parser/functions/versioncmp_spec.rb
+++ b/spec/unit/parser/functions/versioncmp_spec.rb
@@ -1,6 +1,5 @@
-#!/usr/bin/env ruby
-
-require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
+#!/usr/bin/env rspec
+require 'spec_helper'
describe "the versioncmp function" do
before :all do