aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/duration_test.rb
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-01-15 06:54:50 +0000
committerMichael Koziarski <michael@koziarski.com>2007-01-15 06:54:50 +0000
commit276c9f29cde80fafa23814b0039f67504255e0fd (patch)
tree15a17ddcaff52bd1aaabf70281dbe7c7ac2d1433 /activesupport/test/core_ext/duration_test.rb
parent51d840e272941023ad62d021fa2b4a491fe9953a (diff)
downloadrails-276c9f29cde80fafa23814b0039f67504255e0fd.tar.gz
rails-276c9f29cde80fafa23814b0039f67504255e0fd.tar.bz2
rails-276c9f29cde80fafa23814b0039f67504255e0fd.zip
Make 1.months and friends accurate by introducing a Duration class. #6835 [eventualbuddha]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5940 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext/duration_test.rb')
-rw-r--r--activesupport/test/core_ext/duration_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb
new file mode 100644
index 0000000000..78fc999052
--- /dev/null
+++ b/activesupport/test/core_ext/duration_test.rb
@@ -0,0 +1,13 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+class DurationTest < Test::Unit::TestCase
+ def test_inspect
+ assert_equal '1 month', 1.month.inspect
+ assert_equal '1 month and 1 day', (1.month + 1.day).inspect
+ assert_equal '6 months and -2 days', (6.months - 2.days).inspect
+ assert_equal '10 seconds', 10.seconds.inspect
+ assert_equal '10 years, 2 months, and 1 day', (10.years + 2.months + 1.day).inspect
+ assert_equal '7 days', 1.week.inspect
+ assert_equal '14 days', 1.fortnight.inspect
+ end
+end \ No newline at end of file