Skip to content

Commit

Permalink
Update Timecop dates to bypass weird test bug
Browse files Browse the repository at this point in the history
When running the tests locally, I had two tests fail due to an issue
with Timecop. A similar issue has been opened on Timecop's repo, but it
has not been addressed:
travisjeffery/timecop#100

It seems that using a string in Timecop.freeze fixes this issue. This
pull request is opened for conversation and direction on the best way to
resolve the issue.
  • Loading branch information
Alex Kitchens committed Nov 14, 2016
1 parent 7c5ae9d commit 36c132a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/unit/carriers/fedex_test.rb
Expand Up @@ -39,7 +39,7 @@ def test_home_delivery_business_days
def test_turn_around_time_default
mock_response = xml_fixture('fedex/ottawa_to_beverly_hills_rate_response').gsub('<v6:DeliveryTimestamp>2011-07-29</v6:DeliveryTimestamp>', '')

today = DateTime.civil(2013, 3, 11, 0, 0, 0, "-4") #Monday
today = "2013-03-11" #Monday

Timecop.freeze(today) do
delivery_date = Date.today + 7.days # FIVE_DAYS in fixture response, plus weekend
Expand Down Expand Up @@ -278,7 +278,7 @@ def test_delivery_date_from_ground_home_transit_time

@carrier.expects(:commit).returns(mock_response)

today = DateTime.civil(2015, 06, 04, 0, 0, 0, "-4") #Thursday
today = "2015-06-04" #Thursday

Timecop.freeze(today) do
rate_estimates = @carrier.find_rates( location_fixtures[:ottawa],
Expand Down

0 comments on commit 36c132a

Please sign in to comment.