Sha256: 694ef1d6aceb260f2a8f6c571e5f9b008ae494c8f92eb1b83007e8673bf0a402
Contents?: true
Size: 1.85 KB
Versions: 1
Compression:
Stored size: 1.85 KB
Contents
require 'spec_helper' module FedexShip describe Shipment do let (:fedex) { Shipment.new(fedex_credentials) } let(:filename) { require 'tmpdir' File.join(Dir.tmpdir, "manifest#{rand(15000)}.txt") } context "#ground_close" do context "with shipment ready for close", :vcr do before do shipper = { :name => "Sender", :company => "Company", :phone_number => "555-555-5555", :address => "Main Street", :city => "Harrison", :state => "AR", :postal_code => "72601", :country_code => "US" } recipient = { :name => "Recipient", :company => "Company", :phone_number => "555-555-5555", :address => "Main Street", :city => "Frankin Park", :state => "IL", :postal_code => "60131", :country_code => "US", :residential => true } packages = [ { :weight => {:units => "LB", :value => 2}, :dimensions => {:length => 10, :width => 5, :height => 4, :units => "IN" } } ] # require 'tmpdir' # filename = File.join(Dir.tmpdir, "label#{rand(15000)}.pdf") options = { :shipper => shipper, :recipient => recipient, :packages => packages, :service_type => "FEDEX_GROUND"}#, :filename => filename } fedex.ship(options) end it "completes with success result" do # When running this spec you may need to uncomment the line below to allow shipment to be created before close request #sleep(7) expect{ fedex.ground_close(:up_to_time => Time.now, :filename => filename) }.to_not raise_error end end context "raise an error when there aren't any existing shipments to close", :vcr do it "raises an error" do expect { fedex.ground_close(:up_to_time => Time.now) }.to raise_error(FedexShip::RateError, 'No Shipments to Close') end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fedex_ship-0.1.0 | spec/lib/fedex_ship/ground_close_spec.rb |