spec/carrier/fedex_spec.rb in package_tracker-0.0.2 vs spec/carrier/fedex_spec.rb in package_tracker-0.0.3
- old
+ new
@@ -61,6 +61,26 @@
end
it 'should return the correct number of statuses' do
@client.track(@valid_tracking_number).statuses.length.should == 8
end
+
+ it 'should be able to verify delivery' do
+ @client.track(@valid_tracking_number).delivered?.should be true
+ end
+
+ it 'should properly parse the location the statuses' do
+ response = @client.track(@valid_tracking_number)
+ statuses = response.statuses
+
+ statuses[0][:location].should == "San Francisco, CA, US"
+ statuses[4][:location].should == "SACRAMENTO, CA, US"
+ statuses[7][:location].should be nil
+
+ response.current_location.should == "San Francisco, CA, US"
+ end
+
+ it 'should return the statuses in chronological order' do
+ statuses = @client.track(@valid_tracking_number).statuses
+ statuses.should == statuses.sort_by { |status| status[:time] }.reverse
+ end
end