Sha256: f3d1a3fc0d81a7024fa3aa159a67026fef9cc93d27d0236ee61054673d1e5627

Contents?: true

Size: 1.07 KB

Versions: 16

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe ActiveZuora::Connection do
  context "custom header" do
    before do
      @connection = ActiveZuora::Connection.new
      @stub_was_called = false
    end

    it "passes the regular header if not set" do
      allow(Savon::SOAP::Request).to receive(:new) do |config, http, soap|
        @stub_was_called = true
        expect(soap.header).to eq( { "SessionHeader" => {"session" => nil} } )

        double('response').as_null_object
      end

      @connection.request(:amend) {}

      expect(@stub_was_called).to be_truthy
    end

    it "merges in a custom header if set" do
      @connection.custom_header = {'CallOptions' => {'useSingleTransaction' => true}}
      allow(Savon::SOAP::Request).to receive(:new) do |config, http, soap|
        @stub_was_called = true
        expect(soap.header).to eq( { "SessionHeader" => {"session" => nil}, 'CallOptions' => {'useSingleTransaction' => true} } )

        double('response').as_null_object
      end

      @connection.request(:amend) {}

      expect(@stub_was_called).to be_truthy
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
active_zuora-2.2.7 spec/connection_spec.rb
active_zuora-2.2.6 spec/connection_spec.rb
active_zuora-2.2.5 spec/connection_spec.rb
active_zuora-2.2.4 spec/connection_spec.rb
active_zuora-2.2.3 spec/connection_spec.rb
active_zuora-2.2.2 spec/connection_spec.rb
active_zuora-2.2.1 spec/connection_spec.rb
active_zuora-2.2.0 spec/connection_spec.rb
active_zuora-2.1.4 spec/connection_spec.rb
active_zuora-2.1.3 spec/connection_spec.rb
active_zuora-2.1.2 spec/connection_spec.rb
active_zuora-2.1.1 spec/connection_spec.rb
active_zuora-2.0.6 spec/connection_spec.rb
active_zuora-2.1.0 spec/connection_spec.rb
active_zuora-2.0.5 spec/connection_spec.rb
active_zuora-2.0.4 spec/connection_spec.rb