Sha256: 0bb0682a399ad4b2bbf303275feec9dd68af2d87822769e8b5cc43e42b15eb81

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

require "spec_helper"

module ShipCompliant
  describe SearchSalesOrderSummary do
    let(:response) do
      {
        purchase_date: DateTime.new(2014, 1, 1),
        sales_order_key: 'ORD-1',
        shipments: {
          shipment_summary: {
            compliance: 'Perfect Score',
            requested_ship_date: '2014-01-03T14:30:00',
            ship_date: '2014-01-03T12:23:00',
            
            ship_to: {
              first_name: 'Bob',
              last_name: 'Smith',
              zip1: 80234
            }
          }
        }
      }
    end

    let(:summary) { SearchSalesOrderSummary.new(response) }

    context "purchase_date" do
      it "returns a DateTime from the purchase date" do
        expect(summary.purchase_date).to eq(DateTime.new(2014, 1, 1))
      end
    end

    context "order_key" do
      it "returns the order_key" do
        expect(summary.order_key).to eq('ORD-1')
        expect(summary.sales_order_key).to eq('ORD-1')
      end
    end

    context "shipment_summary" do
      it "the parsed hash" do
        expect(summary.shipment_summary).to eq({
          compliance: 'Perfect Score',
          requested_ship_date: '2014-01-03T14:30:00',
          ship_date: '2014-01-03T12:23:00',
          
          ship_to: {
            first_name: 'Bob',
            last_name: 'Smith',
            zip1: 80234
          }
        })
      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_order_summary_spec.rb