test/unit/carriers/ups_test.rb in active_shipping-1.7.3 vs test/unit/carriers/ups_test.rb in active_shipping-1.8.0
- old
+ new
@@ -240,20 +240,21 @@
end
def test_delivery_range_takes_weekend_into_consideration
mock_response = xml_fixture('ups/test_real_home_as_residential_destination_response')
@carrier.expects(:commit).returns(mock_response)
- Timecop.freeze(DateTime.new(2012, 6, 15))
- response = @carrier.find_rates( location_fixtures[:beverly_hills],
- location_fixtures[:real_home_as_residential],
- package_fixtures.values_at(:chocolate_stuff))
- date_test = [nil, 3, 2, 1, 1, 1].map do |days|
- DateTime.now.utc + days + 2 if days
- end
- Timecop.return
+ Timecop.freeze(DateTime.new(2012, 6, 15)) do
+ response = @carrier.find_rates( location_fixtures[:beverly_hills],
+ location_fixtures[:real_home_as_residential],
+ package_fixtures.values_at(:chocolate_stuff))
- assert_equal date_test, response.rates.map(&:delivery_date)
+ date_test = [nil, 3, 2, 1, 1, 1].map do |days|
+ DateTime.now.utc + (days + 2).days if days
+ end
+
+ assert_equal date_test, response.rates.map(&:delivery_date)
+ end
end
def test_maximum_weight
assert Package.new(150 * 16, [5, 5, 5], :units => :imperial).mass == @carrier.maximum_weight
assert Package.new((150 * 16) + 0.01, [5, 5, 5], :units => :imperial).mass > @carrier.maximum_weight