Sha256: dfc49828007f427a085a2817ace8375252d70226a134defe0638ba9efe898489

Contents?: true

Size: 1.16 KB

Versions: 313

Compression:

Stored size: 1.16 KB

Contents

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

require 'puppet/network/http'
require 'puppet/network/http/connection'

describe Puppet::Network::HTTP::NoCachePool do
  let(:site) { Puppet::Network::HTTP::Site.new('https', 'rubygems.org', 443) }
  let(:verify) { stub('verify', :setup_connection => nil) }

  it 'yields a connection' do
    http  = stub('http')

    factory = Puppet::Network::HTTP::Factory.new
    factory.stubs(:create_connection).returns(http)
    pool = Puppet::Network::HTTP::NoCachePool.new(factory)

    expect { |b|
      pool.with_connection(site, verify, &b)
    }.to yield_with_args(http)
  end

  it 'yields a new connection each time' do
    http1  = stub('http1')
    http2  = stub('http2')

    factory = Puppet::Network::HTTP::Factory.new
    factory.stubs(:create_connection).returns(http1).then.returns(http2)
    pool = Puppet::Network::HTTP::NoCachePool.new(factory)

    expect { |b|
      pool.with_connection(site, verify, &b)
    }.to yield_with_args(http1)

    expect { |b|
      pool.with_connection(site, verify, &b)
    }.to yield_with_args(http2)
  end

  it 'has a close method' do
    Puppet::Network::HTTP::NoCachePool.new.close
  end
end

Version data entries

313 entries across 313 versions & 1 rubygems

Version Path
puppet-6.0.7 spec/unit/network/http/nocache_pool_spec.rb
puppet-6.0.7-x86-mingw32 spec/unit/network/http/nocache_pool_spec.rb
puppet-6.0.7-x64-mingw32 spec/unit/network/http/nocache_pool_spec.rb
puppet-6.0.7-universal-darwin spec/unit/network/http/nocache_pool_spec.rb
puppet-5.5.12 spec/unit/network/http/nocache_pool_spec.rb
puppet-5.5.12-x86-mingw32 spec/unit/network/http/nocache_pool_spec.rb
puppet-5.5.12-x64-mingw32 spec/unit/network/http/nocache_pool_spec.rb
puppet-5.5.12-universal-darwin spec/unit/network/http/nocache_pool_spec.rb
puppet-6.3.0 spec/unit/network/http/nocache_pool_spec.rb
puppet-6.3.0-x86-mingw32 spec/unit/network/http/nocache_pool_spec.rb
puppet-6.3.0-x64-mingw32 spec/unit/network/http/nocache_pool_spec.rb
puppet-6.3.0-universal-darwin spec/unit/network/http/nocache_pool_spec.rb
puppet-6.2.0 spec/unit/network/http/nocache_pool_spec.rb
puppet-6.2.0-x86-mingw32 spec/unit/network/http/nocache_pool_spec.rb
puppet-6.2.0-x64-mingw32 spec/unit/network/http/nocache_pool_spec.rb
puppet-6.2.0-universal-darwin spec/unit/network/http/nocache_pool_spec.rb
puppet-6.0.5 spec/unit/network/http/nocache_pool_spec.rb
puppet-6.0.5-x86-mingw32 spec/unit/network/http/nocache_pool_spec.rb
puppet-6.0.5-x64-mingw32 spec/unit/network/http/nocache_pool_spec.rb
puppet-6.0.5-universal-darwin spec/unit/network/http/nocache_pool_spec.rb