Sha256: c6a5dbd0b6e1eba6b52d52963958f8a5cb64b5eb6fdc6165edb51c7ef6e8b971

Contents?: true

Size: 1.2 KB

Versions: 144

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

require 'puppet/http'

describe Puppet::HTTP::PoolEntry do
  let(:connection) { double('connection') }
  let(:verifier) { double('verifier') }

  def create_session(connection, expiration_time = nil)
    expiration_time ||= Time.now + 60 * 60

    described_class.new(connection, verifier, expiration_time)
  end

  it 'provides access to its connection' do
    session = create_session(connection)

    expect(session.connection).to eq(connection)
  end

  it 'provides access to its verifier' do
    session = create_session(connection)

    expect(session.verifier).to eq(verifier)
  end

  it 'expires a connection whose expiration time is in the past' do
    now = Time.now
    past = now - 1

    session = create_session(connection, past)
    expect(session.expired?(now)).to be_truthy
  end

  it 'expires a connection whose expiration time is now' do
    now = Time.now

    session = create_session(connection, now)
    expect(session.expired?(now)).to be_truthy
  end

  it 'does not expire a connection whose expiration time is in the future' do
    now = Time.now
    future = now + 1

    session = create_session(connection, future)
    expect(session.expired?(now)).to be_falsey
  end
end

Version data entries

144 entries across 144 versions & 1 rubygems

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