Sha256: 83d0994be567d8822b1e2b6196ae4f7ae46299d079d3f23f9d00c070ef2bb199

Contents?: true

Size: 1.62 KB

Versions: 6

Compression:

Stored size: 1.62 KB

Contents

require 'spec_helper'

describe EasyPost::Order do
  describe '#create' do
    it 'creates an order out of a single shipment' do
      order = EasyPost::Order.create(
        to_address: ADDRESS[:california],
        from_address: ADDRESS[:missouri],
        shipments: [{
          parcel: {length: 8, width: 6, height: 4, weight: 12}
        }]
      )

      expect(order).to be_an_instance_of(EasyPost::Order)
      expect(order.shipments.first).to be_an_instance_of(EasyPost::Shipment)
    end

    it 'creates an order out of two shipments' do

      order = EasyPost::Order.create(
        to_address: ADDRESS[:california],
        from_address: ADDRESS[:missouri],
        shipments: [{
          parcel: {length: 8, width: 6, height: 4, weight: 12}
        },{
          parcel: {length: 8, width: 6, height: 4, weight: 12}
        }]
      )

      expect(order).to be_an_instance_of(EasyPost::Order)
      expect(order.shipments.first).to be_an_instance_of(EasyPost::Shipment)
    end

    it 'creates and buys an international order out of two shipments' do

      order = EasyPost::Order.create(
        to_address: ADDRESS[:california],
        from_address: ADDRESS[:missouri],
        customs_info: EasyPost::CustomsInfo.create(CUSTOMS_INFO[:shirt]),
        shipments: [{
          parcel: {length: 8, width: 6, height: 4, weight: 12}
        },{
          parcel: {length: 8, width: 6, height: 4, weight: 24}
        }]
      )
      order.buy(carrier: "usps", service: "ParcelSelect")

      expect(order).to be_an_instance_of(EasyPost::Order)
      expect(order.shipments.first).to be_an_instance_of(EasyPost::Shipment)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
easypost-2.1.6 spec/order_spec.rb
easypost-2.1.5 spec/order_spec.rb
easypost-2.1.3 spec/order_spec.rb
easypost-2.1.2 spec/order_spec.rb
easypost-2.1.1 spec/order_spec.rb
easypost-2.0.15 spec/order_spec.rb