aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-12-11 21:38:49 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-12-11 21:38:49 -0200
commit64281fb6e742fddd4a1f67abfe5554a84349e8b7 (patch)
treefc04e7c654e18e33ef474d630a272d349b687bd4 /activesupport/test
parent87a7e8752dcba5179f75a77b000d2e7eec29c736 (diff)
downloadrails-64281fb6e742fddd4a1f67abfe5554a84349e8b7.tar.gz
rails-64281fb6e742fddd4a1f67abfe5554a84349e8b7.tar.bz2
rails-64281fb6e742fddd4a1f67abfe5554a84349e8b7.zip
Add :nsec format only for Ruby 1.9
Ruby 1.8 does not support this format in Time, so the format will only be added to the available date formats on Ruby 1.9. Changelog entry was changed to explain that as well.
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/time_ext_test.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb
index 1c71c8e597..7a818411d0 100644
--- a/activesupport/test/core_ext/time_ext_test.rb
+++ b/activesupport/test/core_ext/time_ext_test.rb
@@ -539,15 +539,15 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
def test_to_s
time = Time.utc(2005, 2, 21, 17, 44, 30.12345678901)
- assert_equal time.to_default_s, time.to_s
- assert_equal time.to_default_s, time.to_s(:doesnt_exist)
- assert_equal "2005-02-21 17:44:30", time.to_s(:db)
- assert_equal "21 Feb 17:44", time.to_s(:short)
- assert_equal "17:44", time.to_s(:time)
- assert_equal "20050221174430", time.to_s(:number)
- assert_equal "20050221174430123456789", time.to_s(:nsec)
- assert_equal "February 21, 2005 17:44", time.to_s(:long)
- assert_equal "February 21st, 2005 17:44", time.to_s(:long_ordinal)
+ assert_equal time.to_default_s, time.to_s
+ assert_equal time.to_default_s, time.to_s(:doesnt_exist)
+ assert_equal "2005-02-21 17:44:30", time.to_s(:db)
+ assert_equal "21 Feb 17:44", time.to_s(:short)
+ assert_equal "17:44", time.to_s(:time)
+ assert_equal "20050221174430", time.to_s(:number)
+ assert_equal "20050221174430123456789", time.to_s(:nsec) if RUBY_VERSION >= '1.9'
+ assert_equal "February 21, 2005 17:44", time.to_s(:long)
+ assert_equal "February 21st, 2005 17:44", time.to_s(:long_ordinal)
with_env_tz "UTC" do
assert_equal "Mon, 21 Feb 2005 17:44:30 +0000", time.to_s(:rfc822)
end