Sha256: b4704dc83f1d8791b1d96a56cc5e4eb13d803e4002798abd026a1bcdd23baed7

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 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
        summary.purchase_date.should == DateTime.new(2014, 1, 1)
      end
    end

    context "order_key" do
      it "returns the order_key" do
        summary.order_key.should == 'ORD-1'
        summary.sales_order_key.should == 'ORD-1'
      end
    end

    context "shipment_summary" do
      it "the parsed hash" do
        summary.shipment_summary.should == {
          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

4 entries across 4 versions & 1 rubygems

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