aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/date_helper_test.rb
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-06-14 15:19:03 +0000
committerJamis Buck <jamis@37signals.com>2005-06-14 15:19:03 +0000
commited7bfc96625d47ba5905628d458c2daef238f32a (patch)
treeac23101aea344f4c0d42b78d1ccd1de5224a7a4a /actionpack/test/template/date_helper_test.rb
parent3cb869eab6fec4b4310079af0409f6139ed7619c (diff)
downloadrails-ed7bfc96625d47ba5905628d458c2daef238f32a.tar.gz
rails-ed7bfc96625d47ba5905628d458c2daef238f32a.tar.bz2
rails-ed7bfc96625d47ba5905628d458c2daef238f32a.zip
Allow distance_of_time_in_words to work with any value that responds to #to_time (like dates) #969
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1420 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template/date_helper_test.rb')
-rwxr-xr-xactionpack/test/template/date_helper_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/test/template/date_helper_test.rb b/actionpack/test/template/date_helper_test.rb
index 43fccbdbdf..7ef45d2b1c 100755
--- a/actionpack/test/template/date_helper_test.rb
+++ b/actionpack/test/template/date_helper_test.rb
@@ -1,5 +1,6 @@
require 'test/unit'
require File.dirname(__FILE__) + '/../../lib/action_view/helpers/date_helper'
+require File.dirname(__FILE__) + "/../abstract_unit"
class DateHelperTest < Test::Unit::TestCase
include ActionView::Helpers::DateHelper
@@ -31,6 +32,13 @@ class DateHelperTest < Test::Unit::TestCase
assert_equal "less than 20 seconds", distance_of_time_in_words(Time.mktime(2004, 3, 6, 21, 41, 38), from, true)
end
+ def test_distance_in_words_date
+ start_date = Date.new 1904, 1, 31
+ end_date = Date.new 1906, 4, 17
+ assert_not_equal("13 minutes",
+ distance_of_time_in_words(start_date, end_date))
+ end
+
def test_select_day
expected = %(<select name="date[day]">\n)
expected <<