Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Expand Time#to_time test to verify values and change in zone

  • Loading branch information...
commit c638e9a904d25daa0be5c796c1003807f42c9e33 1 parent dd758a5
@adzap authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 activesupport/test/core_ext/time_ext_test.rb
View
8 activesupport/test/core_ext/time_ext_test.rb
@@ -588,7 +588,13 @@ def test_to_datetime
end
def test_to_time
- assert_equal Time.local(2005, 2, 21, 17, 44, 30).to_time, Time.local(2005, 2, 21, 17, 44, 30)
+ with_env_tz 'US/Eastern' do
+ # Ruby 1.9 Time#to_time returns getlocal, which deviates from the original
+ # AS implementation returning self. The core Time class method is unchanged.
+ time = Time.utc(2005, 2, 21, 17, 44, 30)
+ # Compare as strings with values and zone
+ assert_equal time.to_time.to_s(:rfc822), time.getlocal.to_s(:rfc822)
+ end
end
# NOTE: this test seems to fail (changeset 1958) only on certain platforms,
Please sign in to comment.
Something went wrong with that request. Please try again.