diff options
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/integration/indirector/catalog/compiler.rb | 2 | ||||
| -rwxr-xr-x | spec/unit/indirector/catalog/compiler.rb | 4 | ||||
| -rwxr-xr-x | spec/unit/parser/resource.rb | 5 | ||||
| -rwxr-xr-x | spec/unit/resource/catalog.rb | 11 | ||||
| -rwxr-xr-x | spec/unit/transaction.rb | 4 | ||||
| -rwxr-xr-x | spec/unit/type.rb | 6 |
6 files changed, 24 insertions, 8 deletions
diff --git a/spec/integration/indirector/catalog/compiler.rb b/spec/integration/indirector/catalog/compiler.rb index f3ace8d1b..211b7c237 100755 --- a/spec/integration/indirector/catalog/compiler.rb +++ b/spec/integration/indirector/catalog/compiler.rb @@ -11,7 +11,7 @@ describe Puppet::Resource::Catalog::Compiler do @catalog = Puppet::Resource::Catalog.new @one = Puppet::Resource.new(:file, "/one") - @one.exported = true + @one.virtual = true @two = Puppet::Resource.new(:file, "/two") @catalog.add_resource(@one, @two) diff --git a/spec/unit/indirector/catalog/compiler.rb b/spec/unit/indirector/catalog/compiler.rb index 78a8028a8..7f0942221 100755 --- a/spec/unit/indirector/catalog/compiler.rb +++ b/spec/unit/indirector/catalog/compiler.rb @@ -236,8 +236,8 @@ describe Puppet::Resource::Catalog::Compiler do @compiler.filter(@catalog) end - it "should filter out exported resources" do - resource = mock 'resource', :exported? => true + it "should filter out virtual resources" do + resource = mock 'resource', :virtual? => true @catalog.stubs(:filter).yields(resource) @compiler.filter(@catalog) diff --git a/spec/unit/parser/resource.rb b/spec/unit/parser/resource.rb index 8005e204c..9eb8b13d9 100755 --- a/spec/unit/parser/resource.rb +++ b/spec/unit/parser/resource.rb @@ -419,6 +419,11 @@ describe Puppet::Parser::Resource do @parser_resource.to_resource.exported.should be_true end + it "should copy over the 'virtual' value" do + @parser_resource.virtual = true + @parser_resource.to_resource.virtual.should be_true + end + it "should convert any parser resource references to Puppet::Resource::Reference instances" do ref = Puppet::Parser::Resource::Reference.new(:title => "/my/file", :type => "file") @parser_resource = mkresource :source => @source, :params => {:foo => "bar", :fee => ref} diff --git a/spec/unit/resource/catalog.rb b/spec/unit/resource/catalog.rb index 97b6ad7cc..af399aa0f 100755 --- a/spec/unit/resource/catalog.rb +++ b/spec/unit/resource/catalog.rb @@ -323,9 +323,9 @@ describe Puppet::Resource::Catalog, "when compiling" do end it "should scan each catalog resource in turn and apply filtering block" do - @resources.each { |r| r.expects(:exported?) } + @resources.each { |r| r.expects(:test?) } @original.filter do |r| - r.exported? + r.test? end end @@ -334,6 +334,13 @@ describe Puppet::Resource::Catalog, "when compiling" do r == @r1 end.resource("File[/a]").should be_nil end + + it "should not consider edges against resources that were filtered out" do + @original.add_edge(@r1,@r2) + @original.filter do |r| + r == @r1 + end.edge(@r1,@r2).should be_empty + end end describe "when functioning as a resource container" do diff --git a/spec/unit/transaction.rb b/spec/unit/transaction.rb index 0e3674775..7966c7a65 100755 --- a/spec/unit/transaction.rb +++ b/spec/unit/transaction.rb @@ -75,8 +75,8 @@ describe Puppet::Transaction do @transaction.skip?(@resource).should be_true end - it "should skip exported resource" do - @resource.stubs(:exported?).returns true + it "should skip virtual resource" do + @resource.stubs(:virtual?).returns true @transaction.skip?(@resource).should be_true end end diff --git a/spec/unit/type.rb b/spec/unit/type.rb index b179677f9..fe2788ec6 100755 --- a/spec/unit/type.rb +++ b/spec/unit/type.rb @@ -72,6 +72,10 @@ describe Puppet::Type do Puppet::Type.type(:mount).new(:name => "foo").should respond_to(:exported?) end + it "should have a method to know if the resource is virtual" do + Puppet::Type.type(:mount).new(:name => "foo").should respond_to(:virtual?) + end + it "should consider its version to be its catalog version" do resource = Puppet::Type.type(:mount).new(:name => "foo") catalog = Puppet::Resource::Catalog.new @@ -121,7 +125,7 @@ describe Puppet::Type do Puppet::Type.type(:mount).new(resource).title.should == "User[foo]" end - [:line, :file, :catalog, :exported].each do |param| + [:line, :file, :catalog, :exported, :virtual].each do |param| it "should copy '#{param}' from the resource if present" do resource = Puppet::Resource.new(:mount, "/foo") resource.send(param.to_s + "=", "foo") |
