diff options
author | Geoff Buesing <gbuesing@gmail.com> | 2007-11-24 04:59:21 +0000 |
---|---|---|
committer | Geoff Buesing <gbuesing@gmail.com> | 2007-11-24 04:59:21 +0000 |
commit | becdb49186c575bf96a82a949ac04b6078680d52 (patch) | |
tree | 48c91b2df8feba4a7e6795c161a2e92970bc323c /activesupport/test/core_ext/string_ext_test.rb | |
parent | d84846a636fbc180b3d6fcf52aa8559e1b7bb960 (diff) | |
download | rails-becdb49186c575bf96a82a949ac04b6078680d52.tar.gz rails-becdb49186c575bf96a82a949ac04b6078680d52.tar.bz2 rails-becdb49186c575bf96a82a949ac04b6078680d52.zip |
Honor Ruby's default calendar reform setting when creating DateTime objects via ActiveRecord's Time -> DateTime overflow, Time#time_with_datetime_fallback, Time#to_datetime, Date#to_datetime and String#to_datetime. Closes #10201
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8199 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext/string_ext_test.rb')
-rw-r--r-- | activesupport/test/core_ext/string_ext_test.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 9c199e1e79..722bb24a37 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -83,8 +83,16 @@ class StringInflectionsTest < Test::Unit::TestCase assert_equal Time.local(2005, 2, 27, 23, 50), "2005-02-27 23:50".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) - assert_equal Date.new(2005, 2, 27), "2005-02-27".to_date + end + + def test_string_to_datetime 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 + end + + def test_string_to_date + assert_equal Date.new(2005, 2, 27), "2005-02-27".to_date end def test_access |