Sha256: 08c7b36534817233c6a551189dd381808b3918fa08a6c85218d2ea0f4b5892dc

Contents?: true

Size: 1019 Bytes

Versions: 1

Compression:

Stored size: 1019 Bytes

Contents

require "spec_helper"

module ShipCompliant
  describe SearchSalesOrders do

    before { savon.mock! }
    after { savon.unmock! }
    
    context "find_by" do
      
      let(:message) do
        {
          'Request' => {
            'Security' => {
              'PartnerKey' => 'abc-123',
              'Username' => 'bob@example.com',
              'Password' => 'secret'
            },
            'ComplianceStatus' => 45
          }
        }
      end
      let(:response) { File.read('spec/fixtures/search_sales_orders.xml') }

      it "queries the client" do
        savon.expects(:search_sales_orders)
          .with(message: message).returns(response)

        SearchSalesOrders.find_by({
          compliance_status: 45
        })
      end
      
      it "returns a SearchSalesOrdersResult" do
        allow(SearchSalesOrders).to receive(:search_sales) { {} }

        result = SearchSalesOrders.find_by({})
        expect(result).to be_kind_of(SearchSalesOrdersResult)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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