From 276c9f29cde80fafa23814b0039f67504255e0fd Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Mon, 15 Jan 2007 06:54:50 +0000 Subject: 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 --- activesupport/test/core_ext/duration_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 activesupport/test/core_ext/duration_test.rb (limited to 'activesupport/test/core_ext/duration_test.rb') 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 -- cgit v1.2.3