Sha256: 8a65bf6915f9563e4e73583514ca31f36dba3e4ec07fc8e14dd11c2815ce09b5

Contents?: true

Size: 954 Bytes

Versions: 4

Compression:

Stored size: 954 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'
      })

      result.should be_kind_of(CommitSalesOrderResult)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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