aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/duration_test.rb
diff options
context:
space:
mode:
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