Skip to content

Commit 494126d

Browse files
authored
Merge pull request #147 from EasyPost/id_test
chore: add shipment ID test
2 parents a8917d5 + 4d59afb commit 494126d

File tree

2 files changed

+312
-0
lines changed

2 files changed

+312
-0
lines changed

spec/cassettes/shipment/EasyPost_Shipment_create_creates_a_shipment_when_only_IDs_are_used.yml

Lines changed: 291 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/shipment_spec.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,27 @@
4141
expect(shipment.id).to match('shp_')
4242
expect(shipment.tax_identifiers[0].tax_id_type).to eq('IOSS')
4343
end
44+
45+
it 'creates a shipment when only IDs are used' do
46+
from_address = EasyPost::Address.create(Fixture.basic_address)
47+
to_address = EasyPost::Address.create(Fixture.basic_address)
48+
parcel = EasyPost::Parcel.create(Fixture.basic_parcel)
49+
50+
shipment = described_class.create(
51+
{
52+
from_address: { id: from_address.id },
53+
to_address: { id: to_address.id },
54+
parcel: { id: parcel.id },
55+
},
56+
)
57+
58+
expect(shipment).to be_an_instance_of(described_class)
59+
expect(shipment.id).to match('shp_')
60+
expect(shipment.from_address.id).to match('adr_')
61+
expect(shipment.to_address.id).to match('adr_')
62+
expect(shipment.parcel.id).to match('prcl_')
63+
expect(shipment.from_address.street1).to eq('388 Townsend St')
64+
end
4465
end
4566

4667
describe '.retrieve' do

0 commit comments

Comments
 (0)