spec/lib/fedex/track_spec.rb in fedex-2.2.2 vs spec/lib/fedex/track_spec.rb in fedex-3.0.0
- old
+ new
@@ -4,20 +4,29 @@
describe TrackingInformation do
let(:fedex) { Shipment.new(fedex_credentials) }
context "shipments with tracking number", :vcr, :focus do
let(:options) do
- { :package_id => "077973360403984",
+ { :package_id => "123456789012",
:package_type => "TRACKING_NUMBER_OR_DOORTAG",
:include_detailed_scans => true
}
end
+ let(:uuid) { "12012~123456789012~FDEG" }
+
+ it "returns an array of tracking information results" do
+ results = fedex.track(options)
+ results.should_not be_empty
+ end
+
it "returns events with tracking information" do
- tracking_info = fedex.track(options)
+ options[:uuid] = uuid
- tracking_info.events.count.should == 7
+ tracking_info = fedex.track(options).first
+
+ tracking_info.events.should_not be_empty
end
it "fails if using an invalid package type" do
fail_options = options
@@ -25,25 +34,22 @@
lambda { fedex.track(options) }.should raise_error
end
it "allows short hand tracking number queries" do
- shorthand_options = options
+ shorthand_options = { :tracking_number => options[:package_id] }
- shorthand_options.delete(:package_type)
- tracking_number = shorthand_options.delete(:package_id)
+ tracking_info = fedex.track(shorthand_options).first
- shorthand_options[:tracking_number] = tracking_number
-
- tracking_info = fedex.track(shorthand_options)
-
- tracking_info.tracking_number.should == tracking_number
+ tracking_info.tracking_number.should == options[:package_id]
end
it "reports the status of the package" do
- tracking_info = fedex.track(options)
+ options[:uuid] = uuid
- tracking_info.status.should == "Delivered"
+ tracking_info = fedex.track(options).first
+
+ tracking_info.status.should == "In transit"
end
end
end
end
\ No newline at end of file