diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-10 13:14:50 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-10 13:14:50 +0000 |
commit | 38e55bac6197c937c2f1ef356ff3be234758a7c7 (patch) | |
tree | 9c87c8065ef8ff720ed08fb7a5d07b59c58c4623 /activesupport/test/core_ext | |
parent | 576b1627254ff0d40063312d7df876706a87eba6 (diff) | |
download | rails-38e55bac6197c937c2f1ef356ff3be234758a7c7.tar.gz rails-38e55bac6197c937c2f1ef356ff3be234758a7c7.tar.bz2 rails-38e55bac6197c937c2f1ef356ff3be234758a7c7.zip |
Added time unit extensions to Fixnum that'll return the period in seconds, like 2.days + 4.hours
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@365 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/fixnum_ext_test.rb | 16 |
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 |