aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
diff options
context:
space:
mode:
authorJason Frey (Fryguy) <fryguy9@yahoo.com>2009-06-05 13:46:42 -0400
committerGeoff Buesing <gbuesing@gmail.com>2009-06-07 20:16:08 -0500
commit1d9346428b3f12a42f717a7b1313cd4375d23e23 (patch)
tree34eb2a4f2fc6f62e3ec54a534ec174e164077fbc /activesupport/test/core_ext
parent04eb2b72b400384fe49e31b95c11c68cab2aca8e (diff)
downloadrails-1d9346428b3f12a42f717a7b1313cd4375d23e23.tar.gz
rails-1d9346428b3f12a42f717a7b1313cd4375d23e23.tar.bz2
rails-1d9346428b3f12a42f717a7b1313cd4375d23e23.zip
String #to_time and #to_datetime: handle fractional seconds [#864 state:resolved]
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb
index 237a843f9a..6991b174b7 100644
--- a/activesupport/test/core_ext/string_ext_test.rb
+++ b/activesupport/test/core_ext/string_ext_test.rb
@@ -112,6 +112,8 @@ class StringInflectionsTest < Test::Unit::TestCase
def test_string_to_time
assert_equal Time.utc(2005, 2, 27, 23, 50), "2005-02-27 23:50".to_time
assert_equal Time.local(2005, 2, 27, 23, 50), "2005-02-27 23:50".to_time(:local)
+ assert_equal Time.utc(2005, 2, 27, 23, 50, 19, 275038), "2005-02-27T23:50:19.275038".to_time
+ assert_equal Time.local(2005, 2, 27, 23, 50, 19, 275038), "2005-02-27T23:50:19.275038".to_time(:local)
assert_equal DateTime.civil(2039, 2, 27, 23, 50), "2039-02-27 23:50".to_time
assert_equal Time.local_time(2039, 2, 27, 23, 50), "2039-02-27 23:50".to_time(:local)
end
@@ -120,6 +122,7 @@ class StringInflectionsTest < Test::Unit::TestCase
assert_equal DateTime.civil(2039, 2, 27, 23, 50), "2039-02-27 23:50".to_datetime
assert_equal 0, "2039-02-27 23:50".to_datetime.offset # use UTC offset
assert_equal ::Date::ITALY, "2039-02-27 23:50".to_datetime.start # use Ruby's default start value
+ assert_equal DateTime.civil(2039, 2, 27, 23, 50, 19 + Rational(275038, 1000000), "-04:00"), "2039-02-27T23:50:19.275038-04:00".to_datetime
end
def test_string_to_date