summaryrefslogtreecommitdiffstats
path: root/spec/integration/parser/functions/require.rb
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2009-08-06 22:26:27 -0700
committerJames Turnbull <james@lovedthanlost.net>2009-08-14 08:49:30 +1000
commit75c6e4aed8bf60fbb1bd535fcdd5504f48ce9dde (patch)
treecc2c0b42a674b332a5b312f45664f8d36e2d9b75 /spec/integration/parser/functions/require.rb
parentb62d9668e04f40f2e3aa6c0f26dd26d1f75d8e22 (diff)
downloadpuppet-75c6e4aed8bf60fbb1bd535fcdd5504f48ce9dde.tar.gz
puppet-75c6e4aed8bf60fbb1bd535fcdd5504f48ce9dde.tar.xz
puppet-75c6e4aed8bf60fbb1bd535fcdd5504f48ce9dde.zip
Fixes #2493
Added downcasing into find_or_load (which replaced fqfind) to get back the old behaviour. Adjusted tests so that they would catch the problem & confirmed that they fail without the downcasing. Added tests to confirm the existance of #2493; improved existing autoload tests (removed inter-test interactions) and noted (with a TODO) that there was dead code in the feature loading test; added analogus case sensitivity tests where apropriate.
Diffstat (limited to 'spec/integration/parser/functions/require.rb')
-rwxr-xr-xspec/integration/parser/functions/require.rb47
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/integration/parser/functions/require.rb b/spec/integration/parser/functions/require.rb
index 68a1e0b54..15ff51b95 100755
--- a/spec/integration/parser/functions/require.rb
+++ b/spec/integration/parser/functions/require.rb
@@ -25,3 +25,50 @@ describe "the require function" do
end
end
+
+describe "the include function" do
+ require 'puppet_spec/files'
+ include PuppetSpec::Files
+
+ before :each do
+ @real_dir = Dir.getwd
+ @temp_dir = tmpfile('include_function_integration_test')
+ Dir.mkdir @temp_dir
+ Dir.chdir @temp_dir
+ @parser = Puppet::Parser::Parser.new :Code => ""
+ @node = Puppet::Node.new("mynode")
+ @compiler = Puppet::Parser::Compiler.new(@node, @parser)
+ @compiler.send(:evaluate_main)
+ @scope = @compiler.topscope
+ # preload our functions
+ Puppet::Parser::Functions.function(:include)
+ Puppet::Parser::Functions.function(:require)
+ end
+
+ after :each do
+ Dir.chdir @real_dir
+ Dir.rmdir @temp_dir
+ end
+
+ def with_file(filename,contents)
+ path = File.join(@temp_dir,filename)
+ File.open(path, "w") { |f|f.puts contents }
+ yield
+ File.delete(path)
+ end
+
+ it "should add a relationship between the 'included' class and our class" do
+ with_file('includedclass',"class includedclass {}") {
+ @scope.function_include("includedclass")
+ }
+ @compiler.catalog.edge?(@scope.resource,@compiler.findresource(:class,"includedclass")).should be_true
+ end
+
+ it "should find a file with an all lowercase name given a mixed case name" do
+ with_file('includedclass',"class includedclass {}") {
+ @scope.function_include("includedclass")
+ }
+ @compiler.catalog.edge?(@scope.resource,@compiler.findresource(:class,"IncludedClass")).should be_true
+ end
+
+end