Commit c52de943d0b1b7a11b1dcbe6cd2a7eeaa0f6e8e5
Committed by
Daniela Feitosa
1 parent
6d7a6999
Exists in
master
and in
29 other branches
Fixing crash on event with armenian language
(ActionItem1846)
Showing
2 changed files
with
14 additions
and
2 deletions
Show diff stats
app/helpers/dates_helper.rb
... | ... | @@ -46,7 +46,7 @@ module DatesHelper |
46 | 46 | if (date1 == date2) || (date2.nil?) |
47 | 47 | show_date(date1) |
48 | 48 | else |
49 | - _('from %s to %s') % [show_date(date1), show_date(date2)] | |
49 | + _('from %{date1} to %{date2}') % {:date1 => show_date(date1), :date2 => show_date(date2)} | |
50 | 50 | end |
51 | 51 | end |
52 | 52 | ... | ... |
test/unit/dates_helper_test.rb
... | ... | @@ -20,7 +20,7 @@ class DatesHelperTest < Test::Unit::TestCase |
20 | 20 | expects(:show_date).with(date1).returns('XXX') |
21 | 21 | date2 = mock |
22 | 22 | expects(:show_date).with(date2).returns('YYY') |
23 | - expects(:_).with('from %s to %s').returns('from %s to %s') | |
23 | + expects(:_).with('from %{date1} to %{date2}').returns('from %{date1} to %{date2}') | |
24 | 24 | assert_equal 'from XXX to YYY', show_period(date1, date2) |
25 | 25 | end |
26 | 26 | |
... | ... | @@ -36,6 +36,18 @@ class DatesHelperTest < Test::Unit::TestCase |
36 | 36 | assert_equal 'XXX', show_period(date1) |
37 | 37 | end |
38 | 38 | |
39 | + should 'not crash with events that have start_date and end_date' do | |
40 | + FastGettext.default_text_domain = 'noosferofull' | |
41 | + assert_nothing_raised do | |
42 | + Noosfero.locales.keys.each do |key| | |
43 | + Noosfero.with_locale(key) do | |
44 | + show_period(Date.today, Date.tomorrow) | |
45 | + end | |
46 | + end | |
47 | + end | |
48 | + FastGettext.default_text_domain = 'noosferotest' | |
49 | + end | |
50 | + | |
39 | 51 | should 'show day of week' do |
40 | 52 | expects(:_).with("Sunday").returns("Domingo") |
41 | 53 | date = mock | ... | ... |