Sha256: 895c8e008f8bb26f0d4f94fc29be1784d12657d026e6682133b2fb3c360b9ed6

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe Datatrans::XML::Transaction::Request do
  describe "ClassMethods" do
    describe "set_default_options" do
      it "should set the current proxy settings" do
        Datatrans.configure do |config|
          config.proxy = {
            :host => "test.com",
            :port => 123,
            :user => "hans",
            :password => "wurst",
          }
        end
        Datatrans::XML::Transaction::Request.should_receive(:http_proxy).with(Datatrans.proxy[:host], Datatrans.proxy[:port], Datatrans.proxy[:user], Datatrans.proxy[:password])
        Datatrans::XML::Transaction::Request.set_default_options

        Datatrans.configure do |config|
          config.proxy = nil
        end
        Datatrans::XML::Transaction::Request.should_receive(:http_proxy).with(nil, nil, nil, nil)
        Datatrans::XML::Transaction::Request.set_default_options
      end
    end

    describe "post" do
      it "should update the default options and perform the request afterwards" do
        Datatrans::XML::Transaction::Request.should_receive(:set_default_options)
        Datatrans::XML::Transaction::Request.perform_request(Net::HTTP::Post, "http://example.com", :a => "b")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datatrans-2.4.0 spec/xml/request_spec.rb