Commit 5309907bc0c1c451aedd142e6bf17c3175be1319
1 parent
855c329b
Exists in
master
and in
29 other branches
ActionItem962: fixing time format
Moved show_time tests from ApplicationHelperTest to DatesHelperTest
Showing
3 changed files
with
16 additions
and
11 deletions
Show diff stats
app/helpers/dates_helper.rb
@@ -33,7 +33,7 @@ module DatesHelper | @@ -33,7 +33,7 @@ module DatesHelper | ||
33 | # formats a datetime for displaying. | 33 | # formats a datetime for displaying. |
34 | def show_time(time) | 34 | def show_time(time) |
35 | if time | 35 | if time |
36 | - time.strftime(_('%d %B %Y, %H:%m')) | 36 | + time.strftime(_('%d %B %Y, %H:%M')) |
37 | else | 37 | else |
38 | '' | 38 | '' |
39 | end | 39 | end |
test/unit/application_helper_test.rb
@@ -42,16 +42,6 @@ class ApplicationHelperTest < Test::Unit::TestCase | @@ -42,16 +42,6 @@ class ApplicationHelperTest < Test::Unit::TestCase | ||
42 | assert_equal '', show_date(nil) | 42 | assert_equal '', show_date(nil) |
43 | end | 43 | end |
44 | 44 | ||
45 | - should 'translate time' do | ||
46 | - time = mock | ||
47 | - expects(:_).with('%d %B %Y, %H:%m').returns('the time') | ||
48 | - time.expects(:strftime).with('the time').returns('translated time') | ||
49 | - assert_equal 'translated time', show_time(time) | ||
50 | - end | ||
51 | - | ||
52 | - should 'handle nil time' do | ||
53 | - assert_equal '', show_time(nil) | ||
54 | - end | ||
55 | 45 | ||
56 | should 'append with-text class and keep existing classes' do | 46 | should 'append with-text class and keep existing classes' do |
57 | expects(:button_without_text).with('type', 'label', 'url', { :class => 'with-text class1'}) | 47 | expects(:button_without_text).with('type', 'label', 'url', { :class => 'with-text class1'}) |
test/unit/dates_helper_test.rb
@@ -126,4 +126,19 @@ class DatesHelperTest < Test::Unit::TestCase | @@ -126,4 +126,19 @@ class DatesHelperTest < Test::Unit::TestCase | ||
126 | assert_equal 'KKKKKKKK', pick_date(:object, :method) | 126 | assert_equal 'KKKKKKKK', pick_date(:object, :method) |
127 | end | 127 | end |
128 | 128 | ||
129 | + should 'format time' do | ||
130 | + assert_equal '22 November 2008, 15:34', show_time(Time.mktime(2008, 11, 22, 15, 34, 0, 0)) | ||
131 | + end | ||
132 | + | ||
133 | + should 'translate time' do | ||
134 | + time = mock | ||
135 | + expects(:_).with('%d %B %Y, %H:%M').returns('the time') | ||
136 | + time.expects(:strftime).with('the time').returns('translated time') | ||
137 | + assert_equal 'translated time', show_time(time) | ||
138 | + end | ||
139 | + | ||
140 | + should 'handle nil time' do | ||
141 | + assert_equal '', show_time(nil) | ||
142 | + end | ||
143 | + | ||
129 | end | 144 | end |