Permalink
Browse files

Be sure to restore the default I18n.locale after changed its value in…

… a test
  • Loading branch information...
1 parent c48cbb0 commit 633be2cbbde9eb9da8e0b0a27e02e0133f65fe20 @amatsuda amatsuda committed Jul 25, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 activesupport/test/transliterate_test.rb
@@ -3,7 +3,6 @@
require 'active_support/inflector/transliterate'
class TransliterateTest < ActiveSupport::TestCase
-
def test_transliterate_should_not_change_ascii_chars
(0..127).each do |byte|
char = [byte].pack("U")
@@ -24,12 +23,13 @@ def test_transliterate_should_approximate_ascii
def test_transliterate_should_work_with_custom_i18n_rules_and_uncomposed_utf8
char = [117, 776].pack("U*") # "ü" as ASCII "u" plus COMBINING DIAERESIS
I18n.backend.store_translations(:de, :i18n => {:transliterate => {:rule => {"ü" => "ue"}}})
- I18n.locale = :de
+ default_locale, I18n.locale = I18n.locale, :de
assert_equal "ue", ActiveSupport::Inflector.transliterate(char)
+ ensure
+ I18n.locale = default_locale
end
def test_transliterate_should_allow_a_custom_replacement_char
assert_equal "a*b", ActiveSupport::Inflector.transliterate("a索b", "*")
end
-
end

0 comments on commit 633be2c

Please sign in to comment.