-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andrew Tribone
committed
Nov 12, 2014
1 parent
c397324
commit ae878f7
Showing
16 changed files
with
161 additions
and
801 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,5 @@ doc/ | |
Icon | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
.Trashes | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,48 @@ | ||
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 => ADDRESS[:missouri], | ||
:parcel => PARCEL[:dimensions] | ||
shipment: [{ | ||
from_address: ADDRESS[:california], | ||
to_address: EasyPost::Address.create(ADDRESS[:missouri]), | ||
parcel: EasyPost::Parcel.create(PARCEL[:dimensions]) | ||
}, { | ||
:from_address => ADDRESS[:california], | ||
:to_address => ADDRESS[:canada], | ||
:parcel => PARCEL[:dimensions], | ||
from_address: ADDRESS[:california], | ||
to_address: EasyPost::Address.create(ADDRESS[:canada]), | ||
parcel: EasyPost::Parcel.create(PARCEL[:dimensions]), | ||
}], | ||
:reference => "batch123456789" | ||
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") | ||
|
||
# sleeps_left = 10 | ||
# while (batch.state == "creating" && sleeps_left > 0) do | ||
# sleep(3) | ||
# batch.refresh | ||
# sleeps_left -= 1 | ||
# end | ||
|
||
# expect(batch.state).to equal("created") | ||
# expect(batch.status[:created]).to equal(2) | ||
|
||
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 => ADDRESS[:missouri], | ||
:parcel => PARCEL[:dimensions], | ||
:carrier => "usps", | ||
:service => "priority" | ||
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 => ADDRESS[:canada], | ||
:parcel => PARCEL[:dimensions], | ||
:carrier => "usps", | ||
:service => "prioritymailinternational" | ||
from_address: ADDRESS[:california], | ||
to_address: EasyPost::Address.create(ADDRESS[:canada]), | ||
parcel: EasyPost::Parcel.create(PARCEL[:dimensions]), | ||
carrier: "usps", | ||
service: "prioritymailinternational" | ||
}], | ||
:reference => "batch123456789" | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.