]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
Make sure functions are loaded for each test
authorPatrick Carlisle <patrick@puppetlabs.com>
Thu, 9 Aug 2012 21:33:10 +0000 (14:33 -0700)
committerPatrick Carlisle <patrick@puppetlabs.com>
Thu, 9 Aug 2012 21:51:37 +0000 (14:51 -0700)
The test_helper code in Puppet now resets function state between each test.
This patch fixes two spec files where the function was not actually loaded in
the tests, causing them to fail.

spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb
spec/unit/puppet/parser/functions/validate_re_spec.rb

index 9d66fcb3be492a84becfbdaa362a60ce9b74f24f..08aaf78992f75323fccceed758199c0bd5a5eeca 100644 (file)
@@ -3,8 +3,12 @@ require 'spec_helper'
 describe Puppet::Parser::Functions.function(:validate_absolute_path) do
   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
 
-  # The subject of these examplres is the method itself.
-  subject() { scope.method(:function_validate_absolute_path) }
+  # The subject of these examples is the method itself.
+  subject do
+    # This makes sure the function is loaded within each test
+    function_name = Puppet::Parser::Functions.function(:validate_absolute_path)
+    scope.method(function_name)
+  end
 
   describe "Valid Paths" do
     def self.valid_paths
index a07ad47f2b8ab857563d2f5e4a74d23be2546a4e..d189efb667d4687b6b53589f0a84182ae951d854 100644 (file)
@@ -5,7 +5,9 @@ describe Puppet::Parser::Functions.function(:validate_re) do
 
   # The subject of these examplres is the method itself.
   subject do
-    scope.method :function_validate_re
+    # This makes sure the function is loaded within each test
+    function_name = Puppet::Parser::Functions.function(:validate_re)
+    scope.method(function_name)
   end
 
   context 'Using Puppet::Parser::Scope.new' do