From 5309907bc0c1c451aedd142e6bf17c3175be1319 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Wed, 11 Mar 2009 15:30:04 -0300 Subject: [PATCH] ActionItem962: fixing time format --- app/helpers/dates_helper.rb | 2 +- test/unit/application_helper_test.rb | 10 ---------- test/unit/dates_helper_test.rb | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/helpers/dates_helper.rb b/app/helpers/dates_helper.rb index 317bcaf..77b97fe 100644 --- a/app/helpers/dates_helper.rb +++ b/app/helpers/dates_helper.rb @@ -33,7 +33,7 @@ module DatesHelper # formats a datetime for displaying. def show_time(time) if time - time.strftime(_('%d %B %Y, %H:%m')) + time.strftime(_('%d %B %Y, %H:%M')) else '' end diff --git a/test/unit/application_helper_test.rb b/test/unit/application_helper_test.rb index 08de7f1..ddb5828 100644 --- a/test/unit/application_helper_test.rb +++ b/test/unit/application_helper_test.rb @@ -42,16 +42,6 @@ class ApplicationHelperTest < Test::Unit::TestCase assert_equal '', show_date(nil) end - should 'translate time' do - time = mock - expects(:_).with('%d %B %Y, %H:%m').returns('the time') - time.expects(:strftime).with('the time').returns('translated time') - assert_equal 'translated time', show_time(time) - end - - should 'handle nil time' do - assert_equal '', show_time(nil) - end should 'append with-text class and keep existing classes' do expects(:button_without_text).with('type', 'label', 'url', { :class => 'with-text class1'}) diff --git a/test/unit/dates_helper_test.rb b/test/unit/dates_helper_test.rb index 41d0140..a002adc 100644 --- a/test/unit/dates_helper_test.rb +++ b/test/unit/dates_helper_test.rb @@ -126,4 +126,19 @@ class DatesHelperTest < Test::Unit::TestCase assert_equal 'KKKKKKKK', pick_date(:object, :method) end + should 'format time' do + assert_equal '22 November 2008, 15:34', show_time(Time.mktime(2008, 11, 22, 15, 34, 0, 0)) + end + + should 'translate time' do + time = mock + expects(:_).with('%d %B %Y, %H:%M').returns('the time') + time.expects(:strftime).with('the time').returns('translated time') + assert_equal 'translated time', show_time(time) + end + + should 'handle nil time' do + assert_equal '', show_time(nil) + end + end -- libgit2 0.21.2