Sha256: c17c615d922220ebe40b1ce32150c0bc1001c3e1e584d38af8acfcec3279fa9d

Contents?: true

Size: 954 Bytes

Versions: 340

Compression:

Stored size: 954 Bytes

Contents

require 'spec_helper'
require 'puppet/indirector/envelope'

describe Puppet::Indirector::Envelope do
  before do
    @instance = Object.new
    @instance.extend(Puppet::Indirector::Envelope)
  end

  describe "when testing if it is expired" do
    it "should return false if there is no expiration set" do
      expect(@instance).not_to be_expired
    end

    it "should return true if the current date is after the expiration date" do
      @instance.expiration = Time.now - 10
      expect(@instance).to be_expired
    end

    it "should return false if the current date is prior to the expiration date" do
      @instance.expiration = Time.now + 10
      expect(@instance).not_to be_expired
    end

    it "should return false if the current date is equal to the expiration date" do
      now = Time.now
      allow(Time).to receive(:now).and_return(now)
      @instance.expiration = now
      expect(@instance).not_to be_expired
    end
  end
end

Version data entries

340 entries across 340 versions & 1 rubygems

Version Path
puppet-8.3.0 spec/unit/indirector/envelope_spec.rb
puppet-8.3.0-x86-mingw32 spec/unit/indirector/envelope_spec.rb
puppet-8.3.0-x64-mingw32 spec/unit/indirector/envelope_spec.rb
puppet-8.3.0-universal-darwin spec/unit/indirector/envelope_spec.rb
puppet-8.4.0 spec/unit/indirector/envelope_spec.rb
puppet-8.4.0-x86-mingw32 spec/unit/indirector/envelope_spec.rb
puppet-8.4.0-x64-mingw32 spec/unit/indirector/envelope_spec.rb
puppet-8.4.0-universal-darwin spec/unit/indirector/envelope_spec.rb
puppet-7.28.0 spec/unit/indirector/envelope_spec.rb
puppet-7.28.0-x86-mingw32 spec/unit/indirector/envelope_spec.rb
puppet-7.28.0-x64-mingw32 spec/unit/indirector/envelope_spec.rb
puppet-7.28.0-universal-darwin spec/unit/indirector/envelope_spec.rb
puppet-8.3.1 spec/unit/indirector/envelope_spec.rb
puppet-8.3.1-x86-mingw32 spec/unit/indirector/envelope_spec.rb
puppet-8.3.1-x64-mingw32 spec/unit/indirector/envelope_spec.rb
puppet-8.3.1-universal-darwin spec/unit/indirector/envelope_spec.rb
puppet-7.27.0 spec/unit/indirector/envelope_spec.rb
puppet-7.27.0-x86-mingw32 spec/unit/indirector/envelope_spec.rb
puppet-7.27.0-x64-mingw32 spec/unit/indirector/envelope_spec.rb
puppet-7.27.0-universal-darwin spec/unit/indirector/envelope_spec.rb