From ac419a06559a884c7a5839631be9e062d4498646 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Mon, 3 Oct 2005 18:30:03 +0000 Subject: Add :rfc822 as an option for Time#to_s (to get rfc822-formatted times) git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2445 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/test/core_ext/time_ext_test.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb index 60649e4c76..86f8b7e4f6 100644 --- a/activesupport/test/core_ext/time_ext_test.rb +++ b/activesupport/test/core_ext/time_ext_test.rb @@ -118,9 +118,13 @@ class TimeExtCalculationsTest < Test::Unit::TestCase 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 "February 21, 2005 17:44", Time.local(2005, 2, 21, 17, 44, 30).to_s(:long) + time = Time.local(2005, 2, 21, 17, 44, 30) + assert_equal "2005-02-21 17:44:30", time.to_s(:db) + assert_equal "21 Feb 17:44", time.to_s(:short) + assert_equal "February 21, 2005 17:44", time.to_s(:long) + + time = Time.utc(2005, 2, 21, 17, 44, 30) + assert_equal "Mon, 21 Feb 2005 17:44:30 +0000", time.to_s(:rfc822) end def test_to_date -- cgit v1.2.3