Sha256: a3b639c10a6425ac4a07e61bf2e9d5414e66246351e5e5cccee3f8fee33f559f

Contents?: true

Size: 958 Bytes

Versions: 1

Compression:

Stored size: 958 Bytes

Contents

require "spec_helper"

module ShipCompliant
  describe CommitSalesOrder do

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

    it "commits a sales order" do
      message = {
        'Request' => {
          'Security' => {
            'PartnerKey' => 'abc-123',
            'Username' => 'bob@example.com',
            'Password' => 'secret'
          },
          'CommitOptions' => 'AllShipments',
          'Payments' => nil,
          'SalesTaxCollected' => 0,
          'SalesOrderKey' => 'ORDER-KEY'
        }
      }

      savon.expects(:commit_sales_order)
        .with(message: message)
        .returns(File.read('spec/fixtures/void_order_success.xml'))
        
      result = ShipCompliant::CommitSalesOrder.call({
        commit_options: 'AllShipments',
        payments: nil,
        sales_tax_collected: 0,
        sales_order_key: 'ORDER-KEY'
      })

      expect(result).to be_kind_of(CommitSalesOrderResult)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ship_compliant-0.2.1 spec/lib/ship_compliant/commit_sales_order_spec.rb