Sha256: 6b19f77a9bf47c5cc26bdaafceaf78442d8cc969ad53fcab669b1a76392e6536

Contents?: true

Size: 1.39 KB

Versions: 3

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'

describe Datatrans::XML::Transaction::Request do
  describe "Proxy" do
    describe "configured" do
      before(:each) do
        @datatrans = Datatrans::Config.new(
          :merchant_id => '1100000000',
          :sign_key => 'd777c17ba2010282c2d2350a68b441ca07a799d294bfaa630b7c8442207c0b69703cc55775b0ca5a4e455b818a9bb10a43669c0c20ce31f4a43f10e0cabb9525',
          :key => "value",
          :proxy => {
            :http_proxyaddr => "proxy.com",
            :http_proxyport => 80,
            :http_proxyuser => "hans",
            :http_proxpass => "xxx",
          },
          :environment => :development
        )

      end
      it "forward those options to HTTParty" do
        request = Datatrans::XML::Transaction::Request.new(@datatrans, {})
        HTTParty.should_receive(:post).with('lirum',
         :params => {:foo => :bar},
           :http_proxpass => 'xxx',
           :http_proxyuser => 'hans',
           :http_proxyaddr => 'proxy.com',
            :http_proxyport => 80)
        request.post('lirum', :params => {:foo => :bar})
      end
    end

    describe "not configured" do
      it "should not add any proxy settings" do
        request = Datatrans::XML::Transaction::Request.new(@datatrans, {})
        HTTParty.should_receive(:post).with('lirum', :params => {:foo => :bar})
        request.post('lirum', :params => {:foo => :bar})
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
datatrans-3.0.2 spec/xml/request_spec.rb
datatrans-3.0.1 spec/xml/request_spec.rb
datatrans-3.0.0 spec/xml/request_spec.rb