summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/node/catalog.rb11
-rwxr-xr-xspec/unit/type/file.rb4
2 files changed, 14 insertions, 1 deletions
diff --git a/spec/unit/node/catalog.rb b/spec/unit/node/catalog.rb
index 3c4da5908..e23c53d3a 100755
--- a/spec/unit/node/catalog.rb
+++ b/spec/unit/node/catalog.rb
@@ -615,6 +615,17 @@ describe Puppet::Node::Catalog do
Puppet::Node::Catalog.ancestors.should be_include(Puppet::Util::Cacher::Expirer)
end
+ it "should always be expired if it's not applying" do
+ @catalog.expects(:applying?).returns false
+ @catalog.should be_expired(Time.now)
+ end
+
+ it "should not be expired if it's applying and the timestamp is late enough" do
+ @catalog.expire
+ @catalog.expects(:applying?).returns true
+ @catalog.should_not be_expired(Time.now)
+ end
+
describe "when applying" do
it "should create and evaluate a transaction" do
@transaction.expects(:evaluate)
diff --git a/spec/unit/type/file.rb b/spec/unit/type/file.rb
index 6fd27d75b..45f9689a3 100755
--- a/spec/unit/type/file.rb
+++ b/spec/unit/type/file.rb
@@ -164,13 +164,15 @@ describe Puppet::Type.type(:file) do
@resource.stat.should == "mystat"
end
- it "should cache the stat instance if it has a catalog" do
+ it "should cache the stat instance if it has a catalog and is applying" do
stat = mock 'stat'
File.expects(:lstat).returns stat
catalog = Puppet::Node::Catalog.new
@resource.catalog = catalog
+ catalog.stubs(:applying?).returns true
+
@resource.stat.should equal(@resource.stat)
end
end