Sha256: 2e873612ed32d21029843cf83694284770196f0901f7755014c57ed7547437de

Contents?: true

Size: 1.45 KB

Versions: 50

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

describe ActiveMerchant::Connection do

  before :all do
    @logger       = Logger.new(STDOUT)
    @logger.level = Logger::DEBUG

    @wiredump_device = Tempfile.new('foo')
  end

  after :all do
    @wiredump_device.close
    @wiredump_device.unlink
  end

  it 'should delegate to Typhoeus' do
    response = ssl_get('https://github.com/killbill/killbill/blob/master/pom.xml')
    response.code.should == 200
    response.return_code.should == :ok
    response.body.size.should > 0

    response = ssl_get('https://github.com/killbill/killbill/blob/master/pomme.xml')
    response.code.should == 404
    response.return_code.should == :ok
    response.body.size.should > 0

    response = ssl_get('/something')
    response.return_code.should == :url_malformat
    response.body.size.should == 0
  end

  private

  def ssl_get(endpoint, headers={})
    ssl_request(:get, endpoint, nil, headers)
  end

  def ssl_request(method, endpoint, data, headers = {})
    connection                 = ::ActiveMerchant::Connection.new(endpoint)
    connection.open_timeout    = 60
    connection.read_timeout    = 60
    connection.retry_safe      = true
    connection.verify_peer     = true
    connection.logger          = @logger
    connection.tag             = self.class.name
    connection.wiredump_device = @wiredump_device
    connection.pem             = nil
    connection.pem_password    = nil

    connection.request(method, data, headers)
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
killbill-9.4.1 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-8.3.6 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-9.4.0 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-9.3.2 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-9.3.1 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-8.3.5 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-9.3.0 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-9.2.2 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-8.3.4 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-8.3.3 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-9.2.1 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-9.2.0 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-8.3.2 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-8.3.1 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-8.3.0 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-8.2.0 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-8.1.0 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-7.0.6 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-8.0.1 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb
killbill-8.0.0 spec/killbill/remote/active_merchant_typhoeus_connection_spec.rb