aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/fixnum_ext_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/core_ext/fixnum_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/fixnum_ext_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/fixnum_ext_test.rb b/activesupport/test/core_ext/fixnum_ext_test.rb
new file mode 100644
index 0000000000..4014ad07d0
--- /dev/null
+++ b/activesupport/test/core_ext/fixnum_ext_test.rb
@@ -0,0 +1,16 @@
+require 'test/unit'
+require File.dirname(__FILE__) + '/../../lib/core_ext/fixnum_ext'
+
+class FixnumExtTest < Test::Unit::TestCase
+ def test_time_units
+ expected = {
+ 1.minute => 60,
+ 10.minutes => 600,
+ 1.hour + 15.minutes => 4500,
+ 2.days + 4.hours + 30.minutes => 189000,
+ 5.years + 1.month + 1.fortnight => 161481600
+ }
+
+ expected.each { |actual, expected| assert_equal expected, actual }
+ end
+end \ No newline at end of file