diff options
author | Luke Kanies <luke@madstop.com> | 2008-04-07 23:39:21 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-04-08 11:33:49 -0500 |
commit | 1458123550140c6e45982c139daeeca80d0afd22 (patch) | |
tree | efc3b22e6bed59f0f866cc584a880e573e3a28f5 /spec | |
parent | bd858dff513c36f63bcadc13116558fc151c04be (diff) | |
download | puppet-1458123550140c6e45982c139daeeca80d0afd22.tar.gz puppet-1458123550140c6e45982c139daeeca80d0afd22.tar.xz puppet-1458123550140c6e45982c139daeeca80d0afd22.zip |
Adding an envelope module to handle indirected instance
expiration.
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/unit/indirector/envelope.rb | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/unit/indirector/envelope.rb b/spec/unit/indirector/envelope.rb new file mode 100755 index 000000000..17c62023a --- /dev/null +++ b/spec/unit/indirector/envelope.rb @@ -0,0 +1,47 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../spec_helper' +require 'puppet/indirector/envelope' + +describe Puppet::Indirector::Envelope do + before do + @instance = Object.new + @instance.extend(Puppet::Indirector::Envelope) + end + + it "should have an expiration accessor" do + @instance.expiration = "testing" + @instance.expiration.should == "testing" + end + + it "should have an expiration setter" do + @instance.should respond_to(:expiration=) + end + + it "should have a means of testing whether it is expired" do + @instance.should respond_to(:expired?) + end + + describe "when testing if it is expired" do + it "should return false if there is no expiration set" do + @instance.should_not be_expired + end + + it "should return true if the current date is after the expiration date" do + @instance.expiration = Time.now - 10 + @instance.should be_expired + end + + it "should return false if the current date is prior to the expiration date" do + @instance.expiration = Time.now + 10 + @instance.should_not be_expired + end + + it "should return false if the current date is equal to the expiration date" do + now = Time.now + Time.stubs(:now).returns(now) + @instance.expiration = now + @instance.should_not be_expired + end + end +end |