From 05bf58dcb9c3ccec9cd5ada997cbd0cc805f3a65 Mon Sep 17 00:00:00 2001 From: Philipp Tessenow Date: Mon, 28 Oct 2013 15:52:48 +0100 Subject: [PATCH] wrap some settings in time tests into with_settings blocks --- test/unit/lib/redmine/i18n_test.rb | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/test/unit/lib/redmine/i18n_test.rb b/test/unit/lib/redmine/i18n_test.rb index 10b1025513..89979429d2 100644 --- a/test/unit/lib/redmine/i18n_test.rb +++ b/test/unit/lib/redmine/i18n_test.rb @@ -105,19 +105,23 @@ class Redmine::I18nTest < ActiveSupport::TestCase def test_time_format set_language_if_valid 'en' now = Time.now - Setting.date_format = '%d %m %Y' - Setting.time_format = '%H %M' - assert_equal now.strftime('%d %m %Y %H %M'), format_time(now) - assert_equal now.strftime('%H %M'), format_time(now, false) + with_settings :time_format => '%H %M' do + with_settings :date_format => '%d %m %Y' do + assert_equal now.strftime('%d %m %Y %H %M'), format_time(now) + assert_equal now.strftime('%H %M'), format_time(now, false) + end + end end def test_utc_time_format set_language_if_valid 'en' now = Time.now - Setting.date_format = '%d %m %Y' - Setting.time_format = '%H %M' - assert_equal now.strftime('%d %m %Y %H %M'), format_time(now.utc) - assert_equal now.strftime('%H %M'), format_time(now.utc, false) + with_settings :time_format => '%H %M' do + with_settings :date_format => '%d %m %Y' do + assert_equal now.strftime('%d %m %Y %H %M'), format_time(now.utc) + assert_equal now.strftime('%H %M'), format_time(now.utc, false) + end + end end def test_number_to_human_size_for_each_language