Sha256: b42818f2b65fc5905f08a93d422a2ec0280b86d420c1f3f53710c6ab1b1c6e4d

Contents?: true

Size: 1001 Bytes

Versions: 4

Compression:

Stored size: 1001 Bytes

Contents

require "spec_helper"

module ShipCompliant
  describe GetSalesOrderExtended do

    before { savon.mock! }
    after { savon.unmock! }

    let(:message) do
      {
        'Request' => {
          'Security' => {
            'PartnerKey' => 'abc-123',
            'Username' => 'bob@example.com',
            'Password' => 'secret'
          },
          'SalesOrderKey' => 'SomeOrderId'
        }
      }
    end

    let(:success_response) { File.read('spec/fixtures/void_order_success.xml') }

    context "by_order_key" do
      it "queries the client" do
        savon.expects(:get_sales_order_extended)
          .with(message: message).returns(success_response)
        
        GetSalesOrderExtended.by_order_key('SomeOrderId')
      end

      it "returns GetSalesOrderExtendedResult" do
        ShipCompliant.client.stub(:call) { {} }
        result = GetSalesOrderExtended.by_order_key('order-id')
        result.should be_kind_of(GetSalesOrderExtendedResult)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ship_compliant-0.2.0 spec/lib/ship_compliant/get_sales_order_extended_spec.rb
ship_compliant-0.1.2 spec/lib/ship_compliant/get_sales_order_extended_spec.rb
ship_compliant-0.1.1 spec/lib/ship_compliant/get_sales_order_extended_spec.rb
ship_compliant-0.1.0 spec/lib/ship_compliant/get_sales_order_extended_spec.rb