Sha256: 67757fcbb3f5c4768637325d620b69edd3da03dcea9af64a57d1dedbe20c8bfb

Contents?: true

Size: 973 Bytes

Versions: 4

Compression:

Stored size: 973 Bytes

Contents

require "spec_helper"

module ShipCompliant
  describe VoidSalesOrder 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(:void_sales_order)
          .with(message: message).returns(success_response)
        
        VoidSalesOrder.by_order_key('SomeOrderId')
      end

      it "returns a VoidSalesOrderResult" do
        VoidSalesOrder.stub(:void_order) { {} }
        
        result = VoidSalesOrder.by_order_key('SomeOrderId')
        result.should be_kind_of(VoidSalesOrderResult)
      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/void_sales_order_spec.rb
ship_compliant-0.1.2 spec/lib/ship_compliant/void_sales_order_spec.rb
ship_compliant-0.1.1 spec/lib/ship_compliant/void_sales_order_spec.rb
ship_compliant-0.1.0 spec/lib/ship_compliant/void_sales_order_spec.rb