Skip to content

Commit

Permalink
Make tests run on CircleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Tribone committed Nov 12, 2014
1 parent c397324 commit ae878f7
Show file tree
Hide file tree
Showing 16 changed files with 161 additions and 801 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ doc/
Icon
._*
.Spotlight-V100
.Trashes
.Trashes
vendor/
14 changes: 7 additions & 7 deletions spec/address_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@

it 'is not able to verify address' do
address = EasyPost::Address.create(
:company => 'Simpler Postage Inc',
:street1 => '388 Junk Teerts',
:street2 => 'Apt 20',
:city => 'San Francisco',
:state => 'CA',
:zip => '941abc07'
company: 'Simpler Postage Inc',
street1: '388 Junk Teerts',
street2: 'Apt 20',
city: 'San Francisco',
state: 'CA',
zip: '941abc07'
)

expect { verified_address = address.verify() }.to raise_error(EasyPost::Error, /Unable to verify address./)
expect { verified_address = address.verify() }.to raise_error(EasyPost::Error, /Address Not Found./)
end
end
end
53 changes: 20 additions & 33 deletions spec/batch_spec.rb
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
11 changes: 0 additions & 11 deletions spec/container_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'spec_helper'

describe EasyPost::Container do

describe '#create' do
it 'creates a container object' do
container = EasyPost::Container.create(
Expand Down Expand Up @@ -73,15 +72,5 @@
expect(container_2.height).to eq(container_1.height)
expect(container_1.type).to eq("BOX")
end

it 'retrieves global containers' do
container_1 = EasyPost::Container.retrieve("container_USPSFR03")
container_2 = EasyPost::Container.retrieve("container_USPSFR02")

expect(container_1).to be_an_instance_of(EasyPost::Container)
expect(container_2).to be_an_instance_of(EasyPost::Container)
expect(container_1.reference).to eq(container_2.reference)
end
end

end
180 changes: 0 additions & 180 deletions spec/fedex/domestic_spec.rb

This file was deleted.

64 changes: 0 additions & 64 deletions spec/fedex/international_spec.rb

This file was deleted.

Loading

0 comments on commit ae878f7

Please sign in to comment.