summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-11-20 17:48:34 -0600
committerLuke Kanies <luke@madstop.com>2007-11-20 17:48:34 -0600
commitcca613d0f142e492aab8cb58087e2a6299334f7d (patch)
tree5faf5e57ee81dc3ae20e7cc117487c2f78ab0a29 /spec/unit/parser
parent96b3cde842a9efa3fbd8226c6f044a6e18c612d0 (diff)
downloadpuppet-cca613d0f142e492aab8cb58087e2a6299334f7d.tar.gz
puppet-cca613d0f142e492aab8cb58087e2a6299334f7d.tar.xz
puppet-cca613d0f142e492aab8cb58087e2a6299334f7d.zip
Fixing the first part of #787. Not all collections were
being evaluated on the first pass because they were being deleted from the collections list during evaluation, which caused some to get skipped. This commit fixes that problem, which helps in the trivial cases where the collections are in the same scope. I expect it's still broken for more complicated usages.
Diffstat (limited to 'spec/unit/parser')
-rwxr-xr-xspec/unit/parser/compile.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/unit/parser/compile.rb b/spec/unit/parser/compile.rb
index 5f239636b..3be7d1637 100755
--- a/spec/unit/parser/compile.rb
+++ b/spec/unit/parser/compile.rb
@@ -71,6 +71,31 @@ describe Puppet::Parser::Compile, " when evaluating classes" do
end
end
+describe Puppet::Parser::Compile, " when evaluating collections" do
+ before do
+ @node = stub 'node', :name => 'mynode'
+ @parser = stub 'parser', :version => "1.0"
+ @scope = stub 'scope', :source => mock("source")
+ @compile = Puppet::Parser::Compile.new(@node, @parser)
+ end
+
+ it "should evaluate each collection" do
+ 2.times { |i|
+ coll = mock 'coll%s' % i
+ @compile.add_collection(coll)
+
+ # This is the hard part -- we have to emulate the fact that
+ # collections delete themselves if they are done evaluating.
+ coll.expects(:evaluate).with do
+ @compile.delete_collection(coll)
+ end
+ }
+
+ @compile.class.publicize_methods(:evaluate_collections) { @compile.evaluate_collections }
+ end
+end
+
+
describe Puppet::Parser::Compile, " when evaluating found classes" do
before do
@node = stub 'node', :name => 'mynode'