diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-21 17:02:08 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-21 17:02:08 +0000 |
commit | 8401218becb5150c722f275cc4d7397fad24c201 (patch) | |
tree | d54505d838ceb4b5d67cc20ce93686a06f1aaaba /activesupport/test/core_ext | |
parent | a0455ecb43f57485b2bfc2805b3d9d39b0726798 (diff) | |
download | rails-8401218becb5150c722f275cc4d7397fad24c201.tar.gz rails-8401218becb5150c722f275cc4d7397fad24c201.tar.bz2 rails-8401218becb5150c722f275cc4d7397fad24c201.zip |
Added Time::Conversions for getting times in different convenient string representations and other objects
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@737 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/time_ext_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb index a948d21e17..dabc433c1f 100644 --- a/activesupport/test/core_ext/time_ext_test.rb +++ b/activesupport/test/core_ext/time_ext_test.rb @@ -86,4 +86,18 @@ class TimeExtCalculationsTest < Test::Unit::TestCase assert_equal Time.local(2005,2,29), Time.local(2005,2,22,15,15,10).next_week(:tuesday) assert_equal Time.local(2005,3,4), Time.local(2005,2,22,15,15,10).next_week(:friday) end + + def test_to_s + assert_equal "2005-02-21 17:44:30", Time.local(2005, 2, 21, 17, 44, 30).to_s(:db) + assert_equal "21 Feb 17:44", Time.local(2005, 2, 21, 17, 44, 30).to_s(:short) + assert_equal "21 February, 2005 17:44", Time.local(2005, 2, 21, 17, 44, 30).to_s(:long) + end + + def test_to_date + assert_equal Date.new(2005, 2, 21), Time.local(2005, 2, 21, 17, 44, 30).to_date + end + + def test_to_time + assert_equal Time.local(2005, 2, 21, 17, 44, 30), Time.local(2005, 2, 21, 17, 44, 30).to_time + end end
\ No newline at end of file |