Sha256: 0a005b899cd832340254ede69118f1475b771e5e238dc4c0bdc95acadc74e5ac

Contents?: true

Size: 1.04 KB

Versions: 39

Compression:

Stored size: 1.04 KB

Contents

#! /usr/bin/env ruby
require 'spec_helper'

require 'puppet/network/http'

describe Puppet::Network::HTTP::Session do
  let(:connection) { stub('connection') }

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

    Puppet::Network::HTTP::Session.new(connection, expiration_time)
  end

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

    session.connection.should == connection
  end

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

    session = create_session(connection, past)
    session.expired?(now).should be_true
  end

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

    session = create_session(connection, now)
    session.expired?(now).should be_true
  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)
    session.expired?(now).should be_false
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/unit/network/http/session_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/network/http/session_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/network/http/session_spec.rb
puppet-3.8.6 spec/unit/network/http/session_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/network/http/session_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/network/http/session_spec.rb
puppet-3.8.5 spec/unit/network/http/session_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/network/http/session_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/network/http/session_spec.rb
puppet-3.8.4 spec/unit/network/http/session_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/network/http/session_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/network/http/session_spec.rb
puppet-3.8.3 spec/unit/network/http/session_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/network/http/session_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/network/http/session_spec.rb
puppet-3.8.2 spec/unit/network/http/session_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/network/http/session_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/network/http/session_spec.rb
puppet-3.8.1 spec/unit/network/http/session_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/network/http/session_spec.rb