Skip to content

Commit

Permalink
Fix testing timezone dates
Browse files Browse the repository at this point in the history
The test_timezones_apply_dates test actually fails to test
timezones. It is comparing the local time with the time zone
specific time. Therefore the test actually only "passes" if the
time zone is to the "west" of the local time zone. A person in
the America/Los_Angeles time zone will receive a failure when
running the current test as the Central Time zone is to the "east".

Change the test to use Time.zone.now for the comparison date
  • Loading branch information
wishdev authored and joshuacronemeyer committed Oct 13, 2020
1 parent b794cf6 commit f427aa9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/time_stack_item_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def test_timezones_apply_dates
time = Time.zone.local(2013,1,3)

Timecop.freeze(time) do
assert_equal time.to_date, Time.now.to_date
assert_equal time.to_date, Time.zone.now.to_date
end
end

Expand Down

0 comments on commit f427aa9

Please sign in to comment.