summaryrefslogtreecommitdiffstats
path: root/test/unit/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-02-08 09:34:48 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-02-08 09:34:48 +0000
commit4a6b784d143def6be99fc498cd99f06dae1b1ddb (patch)
tree505ad847f0a01843083150ee4942dd3a8649c989 /test/unit/lib
parente622ce6691775580d8e9d412c70a05b2d411dafd (diff)
downloadredmine-4a6b784d143def6be99fc498cd99f06dae1b1ddb.tar.gz
redmine-4a6b784d143def6be99fc498cd99f06dae1b1ddb.zip
Don't use current user locale to format dates (#19039).
git-svn-id: http://svn.redmine.org/redmine/trunk@13978 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/lib')
-rw-r--r--test/unit/lib/redmine/i18n_test.rb26
1 files changed, 3 insertions, 23 deletions
diff --git a/test/unit/lib/redmine/i18n_test.rb b/test/unit/lib/redmine/i18n_test.rb
index bf94e14af..0c42ccc03 100644
--- a/test/unit/lib/redmine/i18n_test.rb
+++ b/test/unit/lib/redmine/i18n_test.rb
@@ -45,15 +45,11 @@ class Redmine::I18nTest < ActiveSupport::TestCase
end
end
- def test_date_format_default_with_user_locale
+ def test_date_format_with_month_name_should_translate_with_current_locale
set_language_if_valid 'es'
- today = now = Time.parse('2011-02-20 14:00:00')
+ date = Date.parse('2011-02-20 14:00:00')
with_settings :date_format => '%d %B %Y' do
- User.current.language = 'fr'
- s1 = "20 f\xc3\xa9vrier 2011".force_encoding("UTF-8")
- assert_equal s1, format_date(today)
- User.current.language = nil
- assert_equal '20 Febrero 2011', format_date(today)
+ assert_equal '20 Febrero 2011', format_date(date)
end
end
@@ -118,22 +114,6 @@ class Redmine::I18nTest < ActiveSupport::TestCase
end
end
- def test_time_format_default_with_user_locale
- set_language_if_valid 'en'
- User.current.language = 'fr'
- now = Time.parse('2011-02-20 15:45:22')
- with_settings :time_format => '' do
- with_settings :date_format => '' do
- assert_equal '20/02/2011 15:45', format_time(now)
- assert_equal '15:45', format_time(now, false)
- end
- with_settings :date_format => '%Y-%m-%d' do
- assert_equal '2011-02-20 15:45', format_time(now)
- assert_equal '15:45', format_time(now, false)
- end
- end
- end
-
def test_utc_time_format
set_language_if_valid 'en'
now = Time.now