summaryrefslogtreecommitdiffstats
path: root/test/unit/lib
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-01-22 09:16:19 +0000
committerGo MAEDA <maeda@farend.jp>2022-01-22 09:16:19 +0000
commit8c147ca2b1cee4e707035a5d526b11c9a91e8bcc (patch)
treeb71df27a0423dd443572791d01c7d6c191526124 /test/unit/lib
parent218948d4c58cf4358fd3c34f8f1b49bf6a338154 (diff)
downloadredmine-8c147ca2b1cee4e707035a5d526b11c9a91e8bcc.tar.gz
redmine-8c147ca2b1cee4e707035a5d526b11c9a91e8bcc.zip
Fix that I18nTest#test_custom_pluralization_rules randomly fails (#36396, #36461).
Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@21382 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/lib')
-rw-r--r--test/unit/lib/redmine/i18n_test.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/unit/lib/redmine/i18n_test.rb b/test/unit/lib/redmine/i18n_test.rb
index 4e15ae56b..f6e7a804d 100644
--- a/test/unit/lib/redmine/i18n_test.rb
+++ b/test/unit/lib/redmine/i18n_test.rb
@@ -257,11 +257,13 @@ class Redmine::I18nTest < ActiveSupport::TestCase
end
def test_custom_pluralization_rules
+ pluralizers = I18n.backend.instance_variable_get(:@pluralizers)
+ I18n.backend.instance_variable_set(:@pluralizers, nil)
I18n.backend.store_translations :pt, i18n: {plural: {rule: ->(n) {[0, 1].include?(n) ? :one : :other }}}
I18n.backend.store_translations :pt, apples: {one: 'one or none', other: 'more than one'}
assert_equal 'one or none', ll(:pt, :apples, count: 0)
assert_equal 'more than one', ll(:pt, :apples, count: 2)
ensure
- I18n.reload!
+ I18n.backend.instance_variable_set(:@pluralizers, pluralizers)
end
end