Sha256: e4703729b9a8627f31b000dfd321010350e4c70613dfd08240a572abd52aaeb1

Contents?: true

Size: 1.66 KB

Versions: 25

Compression:

Stored size: 1.66 KB

Contents

require 'spec_helper'

describe EasyPost::Batch do
  describe '#create' do
    it 'creates a batch object' do
      batch = EasyPost::Batch.create({
        shipment: [{
          from_address: ADDRESS[:california],
          to_address: EasyPost::Address.create(ADDRESS[:missouri]),
          parcel: EasyPost::Parcel.create(PARCEL[:dimensions])
        }, {
          from_address: ADDRESS[:california],
          to_address: EasyPost::Address.create(ADDRESS[:canada]),
          parcel: EasyPost::Parcel.create(PARCEL[:dimensions]),
        }],
        reference: "batch123456789"
      })
      expect(batch).to be_an_instance_of(EasyPost::Batch)
      expect(batch.num_shipments).to eq(2)
      expect(batch.reference).to eq("batch123456789")
      expect(batch.state).to eq("creating")
    end
  end

  describe '#create_and_buy' do
    it 'creates a batch object and delayed jobs for purchasing the postage_labels' do
      batch = EasyPost::Batch.create({
        shipment: [{
          from_address: ADDRESS[:california],
          to_address: EasyPost::Address.create(ADDRESS[:missouri]),
          parcel: EasyPost::Parcel.create(PARCEL[:dimensions]),
          carrier: "usps",
          service: "priority"
        }, {
          from_address: ADDRESS[:california],
          to_address: EasyPost::Address.create(ADDRESS[:canada]),
          parcel: EasyPost::Parcel.create(PARCEL[:dimensions]),
          carrier: "usps",
          service: "prioritymailinternational"
        }],
        reference: "batch123456789"
      })
      expect(batch).to be_an_instance_of(EasyPost::Batch)
      expect(batch.state).to eq("creating")
      expect(batch.num_shipments).to eq(2)
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
easypost-3.0.1 spec/batch_spec.rb
easypost-3.0.0 spec/batch_spec.rb
easypost-2.7.3 spec/batch_spec.rb
easypost-2.7.2 spec/batch_spec.rb
easypost-2.7.1 spec/batch_spec.rb
easypost-2.7.0 spec/batch_spec.rb
easypost-2.6.2 spec/batch_spec.rb
easypost-2.6.1 spec/batch_spec.rb
easypost-2.6.0 spec/batch_spec.rb
easypost-2.5.0 spec/batch_spec.rb
easypost-2.4.0 spec/batch_spec.rb
easypost-2.3.0 spec/batch_spec.rb
easypost-2.2.0 spec/batch_spec.rb
easypost-2.1.11 spec/batch_spec.rb
easypost-2.1.10 spec/batch_spec.rb
easypost-2.1.9 spec/batch_spec.rb
easypost-2.1.8 spec/batch_spec.rb
easypost-2.1.7 spec/batch_spec.rb
easypost-2.1.6 spec/batch_spec.rb
easypost-2.1.5 spec/batch_spec.rb