Sha256: fc0c0f56fddd71b0ea629abe5e5c0fcd811932478251324f7621032d3ec6249f

Contents?: true

Size: 1002 Bytes

Versions: 4

Compression:

Stored size: 1002 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
        SearchSalesOrders.stub(:search_sales) { {} }

        result = SearchSalesOrders.find_by({})
        result.should be_kind_of(SearchSalesOrdersResult)
      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/search_sales_orders_spec.rb
ship_compliant-0.1.2 spec/lib/ship_compliant/search_sales_orders_spec.rb
ship_compliant-0.1.1 spec/lib/ship_compliant/search_sales_orders_spec.rb
ship_compliant-0.1.0 spec/lib/ship_compliant/search_sales_orders_spec.rb