summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2008-12-01 21:03:20 +0100
committerJames Turnbull <james@lovedthanlost.net>2008-12-02 09:17:33 +1100
commit3fe9cc748a7bca9b5fead1f9c1e0d82f1207bb3f (patch)
treee76489621663cddbd79a4314777a13fdb1998de9 /spec/unit/parser
parent3570c71cf41a1705f36e48724012661dbca42b84 (diff)
downloadpuppet-3fe9cc748a7bca9b5fead1f9c1e0d82f1207bb3f.tar.gz
puppet-3fe9cc748a7bca9b5fead1f9c1e0d82f1207bb3f.tar.xz
puppet-3fe9cc748a7bca9b5fead1f9c1e0d82f1207bb3f.zip
Fix #1741 - fix some failing tests on some ruby versions.
Nigelk reported those tests were failing on ubuntu 8.04. I wasn't able to reproduce the issue myself but he confirmed the above patch fixed the tests.
Diffstat (limited to 'spec/unit/parser')
-rw-r--r--spec/unit/parser/functions.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/spec/unit/parser/functions.rb b/spec/unit/parser/functions.rb
index 8d0492d13..fe449139d 100644
--- a/spec/unit/parser/functions.rb
+++ b/spec/unit/parser/functions.rb
@@ -25,20 +25,20 @@ describe Puppet::Parser::Functions do
describe "when calling newfunction" do
it "should create the function in the scope class" do
- Puppet::Parser::Scope.expects(:define_method).with("function_name", nil)
+ Puppet::Parser::Scope.expects(:define_method).with { |name,block| name == "function_name" }
Puppet::Parser::Functions.newfunction("name", :type => :rvalue)
end
it "should raise an error if the function already exists" do
- Puppet::Parser::Scope.expects(:define_method).with("function_name", nil).once
+ Puppet::Parser::Scope.expects(:define_method).with { |name,block| name == "function_name" }.once
Puppet::Parser::Functions.newfunction("name", :type => :rvalue)
lambda { Puppet::Parser::Functions.newfunction("name", :type => :rvalue) }.should raise_error
end
it "should raise an error if the function type is not correct" do
- Puppet::Parser::Scope.expects(:define_method).with("function_name", nil).never
+ Puppet::Parser::Scope.expects(:define_method).with { |name,block| name == "function_name" }.never
lambda { Puppet::Parser::Functions.newfunction("name", :type => :unknown) }.should raise_error
end
@@ -46,7 +46,7 @@ describe Puppet::Parser::Functions do
describe "when calling rmfunction" do
it "should remove the function in the scope class" do
- Puppet::Parser::Scope.stubs(:define_method).with("function_name", nil)
+ Puppet::Parser::Scope.expects(:define_method).with { |name,block| name == "function_name" }
Puppet::Parser::Functions.newfunction("name", :type => :rvalue)
Puppet::Parser::Scope.expects(:remove_method).with("function_name").once
@@ -68,7 +68,7 @@ describe Puppet::Parser::Functions do
end
it "should return it's name if the function exists" do
- Puppet::Parser::Scope.stubs(:define_method).with("function_name", nil)
+ Puppet::Parser::Scope.expects(:define_method).with { |name,block| name == "function_name" }
Puppet::Parser::Functions.newfunction("name", :type => :rvalue)
Puppet::Parser::Functions.function("name").should == "function_name"