diff options
| author | Luke Kanies <luke@madstop.com> | 2009-02-11 13:51:48 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2009-02-11 13:51:48 -0600 |
| commit | a2270b4a4f093c6c4f171dcf0c0e05fe101dd979 (patch) | |
| tree | f0d893dfe6fe13c8c9e0670c1e5459ec336318ba /spec/unit/parser/functions | |
| parent | 9bac833dcfdd8d6a00188faee0487e787b7a0101 (diff) | |
| parent | 6b0c1b9170c69829bdf5956d1dec0949dcc08b35 (diff) | |
| download | puppet-a2270b4a4f093c6c4f171dcf0c0e05fe101dd979.tar.gz puppet-a2270b4a4f093c6c4f171dcf0c0e05fe101dd979.tar.xz puppet-a2270b4a4f093c6c4f171dcf0c0e05fe101dd979.zip | |
Merge branch '0.24.x'
Conflicts:
CHANGELOG
spec/unit/type/file/selinux.rb
Diffstat (limited to 'spec/unit/parser/functions')
| -rwxr-xr-x | spec/unit/parser/functions/realize.rb | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/spec/unit/parser/functions/realize.rb b/spec/unit/parser/functions/realize.rb new file mode 100755 index 000000000..d9c94b143 --- /dev/null +++ b/spec/unit/parser/functions/realize.rb @@ -0,0 +1,51 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../spec_helper' + +describe "the realize function" do + + before :each do + @collector = stub_everything 'collector' + @scope = Puppet::Parser::Scope.new() + @compiler = stub 'compiler' + @compiler.stubs(:add_collection).with(@collector) + @scope.stubs(:compiler).returns(@compiler) + end + + it "should exist" do + Puppet::Parser::Functions.function("realize").should == "function_realize" + end + + it "should create a Collector when called" do + + Puppet::Parser::Collector.expects(:new).returns(@collector) + + @scope.function_realize("test") + end + + it "should assign the passed-in resources to the collector" do + Puppet::Parser::Collector.stubs(:new).returns(@collector) + + @collector.expects(:resources=).with(["test"]) + + @scope.function_realize("test") + end + + it "should flatten the resources assigned to the collector" do + Puppet::Parser::Collector.stubs(:new).returns(@collector) + + @collector.expects(:resources=).with(["test"]) + + @scope.function_realize([["test"]]) + end + + it "should let the compiler know this collector" do + Puppet::Parser::Collector.stubs(:new).returns(@collector) + @collector.stubs(:resources=).with(["test"]) + + @compiler.expects(:add_collection).with(@collector) + + @scope.function_realize("test") + end + +end |
