aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/multibyte_utils_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-09-13 04:48:40 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2009-09-13 04:48:40 -0700
commitcce2112f12324f5e44e31060f840821c81b2dbf1 (patch)
treecec5be0a963ef2cae1aa24fdec4b0c92c8cb60f5 /activesupport/test/multibyte_utils_test.rb
parent91ffddca57d754f024b90d981acb146a5e9f5ab9 (diff)
downloadrails-cce2112f12324f5e44e31060f840821c81b2dbf1.tar.gz
rails-cce2112f12324f5e44e31060f840821c81b2dbf1.tar.bz2
rails-cce2112f12324f5e44e31060f840821c81b2dbf1.zip
Silence warning for Encoding.default_external=
Diffstat (limited to 'activesupport/test/multibyte_utils_test.rb')
-rw-r--r--activesupport/test/multibyte_utils_test.rb14
1 files changed, 5 insertions, 9 deletions
diff --git a/activesupport/test/multibyte_utils_test.rb b/activesupport/test/multibyte_utils_test.rb
index dea9e74510..0a2f20d282 100644
--- a/activesupport/test/multibyte_utils_test.rb
+++ b/activesupport/test/multibyte_utils_test.rb
@@ -120,20 +120,16 @@ class MultibyteUtilsTest < ActiveSupport::TestCase
end
if 'string'.respond_to?(:encoding)
+ KCODE_TO_ENCODING = Hash.new(Encoding::BINARY).
+ update('UTF8' => Encoding::UTF_8, 'SJIS' => Encoding::Shift_JIS)
+
def with_encoding(enc)
before = Encoding.default_external
+ silence_warnings { Encoding.default_external = KCODE_TO_ENCODING[enc] }
- case enc
- when 'UTF8'
- Encoding.default_external = Encoding::UTF_8
- when 'SJIS'
- Encoding.default_external = Encoding::Shift_JIS
- else
- Encoding.default_external = Encoding::BINARY
- end
yield
- Encoding.default_external = before
+ silence_warnings { Encoding.default_external = before }
end
else
alias with_encoding with_kcode