aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorAndrew White <andrew.white@unboxedconsulting.com>2016-04-23 19:18:38 +0100
committerAndrew White <andrew.white@unboxedconsulting.com>2016-04-23 19:18:38 +0100
commita424bbb2423297cc8bd80fc8b36f7169c3986a71 (patch)
tree6859ba8648f5f5e182dd54a5d0a9e78808208a29 /activesupport/test
parent88d844b278163f19e910fc1acadf1dbb4afac527 (diff)
downloadrails-a424bbb2423297cc8bd80fc8b36f7169c3986a71.tar.gz
rails-a424bbb2423297cc8bd80fc8b36f7169c3986a71.tar.bz2
rails-a424bbb2423297cc8bd80fc8b36f7169c3986a71.zip
Add DateTime#subsec
Mirrors the Time#subsec method by returning the fraction of the second as a Rational.
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/date_time_ext_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/date_time_ext_test.rb b/activesupport/test/core_ext/date_time_ext_test.rb
index d57e71df3b..c19992553f 100644
--- a/activesupport/test/core_ext/date_time_ext_test.rb
+++ b/activesupport/test/core_ext/date_time_ext_test.rb
@@ -400,4 +400,9 @@ class DateTimeExtCalculationsTest < ActiveSupport::TestCase
assert_equal 0, DateTime.civil(2000).nsec
assert_equal 500000000, DateTime.civil(2000, 1, 1, 0, 0, Rational(1,2)).nsec
end
+
+ def test_subsec
+ assert_equal 0, DateTime.civil(2000).subsec
+ assert_equal Rational(1,2), DateTime.civil(2000, 1, 1, 0, 0, Rational(1,2)).subsec
+ end
end