3
require File.dirname(__FILE__) + '/../../spec_helper'
4
require 'puppet/indirector/envelope'
6
describe Puppet::Indirector::Envelope do
9
@instance.extend(Puppet::Indirector::Envelope)
12
it "should have an expiration accessor" do
13
@instance.expiration = "testing"
14
@instance.expiration.should == "testing"
17
it "should have an expiration setter" do
18
@instance.should respond_to(:expiration=)
21
it "should have a means of testing whether it is expired" do
22
@instance.should respond_to(:expired?)
25
describe "when testing if it is expired" do
26
it "should return false if there is no expiration set" do
27
@instance.should_not be_expired
30
it "should return true if the current date is after the expiration date" do
31
@instance.expiration = Time.now - 10
32
@instance.should be_expired
35
it "should return false if the current date is prior to the expiration date" do
36
@instance.expiration = Time.now + 10
37
@instance.should_not be_expired
40
it "should return false if the current date is equal to the expiration date" do
42
Time.stubs(:now).returns(now)
43
@instance.expiration = now
44
@instance.should_not be_expired