aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/date_ext_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-05-30 06:24:32 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-05-30 06:24:32 +0000
commitb7d2dae6dcf00b38a1dba8687d6b70d863da915e (patch)
tree7bbc63855cf78b39a60abc1fd1f26b970cc56890 /activesupport/test/core_ext/date_ext_test.rb
parent6503da69910beb382b18127c51cd318631245607 (diff)
downloadrails-b7d2dae6dcf00b38a1dba8687d6b70d863da915e.tar.gz
rails-b7d2dae6dcf00b38a1dba8687d6b70d863da915e.tar.bz2
rails-b7d2dae6dcf00b38a1dba8687d6b70d863da915e.zip
DateTime#to_time converts to Time unless out of range. Date#to_datetime and Date#to_s(:rfc822). Closes #8512.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6902 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext/date_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/date_ext_test.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/activesupport/test/core_ext/date_ext_test.rb b/activesupport/test/core_ext/date_ext_test.rb
index 6a0508b8c4..3557c11748 100644
--- a/activesupport/test/core_ext/date_ext_test.rb
+++ b/activesupport/test/core_ext/date_ext_test.rb
@@ -6,14 +6,16 @@ class DateExtCalculationsTest < Test::Unit::TestCase
assert_equal "February 21, 2005", Date.new(2005, 2, 21).to_s(:long)
assert_equal "February 21st, 2005", Date.new(2005, 2, 21).to_s(:long_ordinal)
assert_equal "2005-02-21", Date.new(2005, 2, 21).to_s(:db)
+ assert_equal "21 Feb 2005", Date.new(2005, 2, 21).to_s(:rfc822)
end
def test_to_time
assert_equal Time.local(2005, 2, 21), Date.new(2005, 2, 21).to_time
+ assert_equal Time.local_time(2039, 2, 21), Date.new(2039, 2, 21).to_time
end
-
- def test_to_time_on_datetime
- assert_equal Time.local(2005, 2, 21, 10, 11, 12), DateTime.new(2005, 2, 21, 10, 11, 12).to_time
+
+ def test_to_datetime
+ assert_equal DateTime.civil(2005, 2, 21), Date.new(2005, 2, 21).to_datetime
end
def test_to_date