diff options
Diffstat (limited to 'test/rubygems/test_gem_specification.rb')
-rw-r--r-- | test/rubygems/test_gem_specification.rb | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index 3062b66bc6..b1d925bb57 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -873,24 +873,21 @@ dependencies: [] end def test_self_load_utf8_with_ascii_encoding - int_enc = Encoding.default_internal - silence_warnings { Encoding.default_internal = 'US-ASCII' } - - spec2 = @a2.dup - bin = "\u5678".dup - spec2.authors = [bin] - full_path = spec2.spec_file - write_file full_path do |io| - io.write spec2.to_ruby_for_cache.force_encoding('BINARY').sub("\\u{5678}", bin.force_encoding('BINARY')) - end + with_internal_encoding('US-ASCII') do + spec2 = @a2.dup + bin = "\u5678".dup + spec2.authors = [bin] + full_path = spec2.spec_file + write_file full_path do |io| + io.write spec2.to_ruby_for_cache.force_encoding('BINARY').sub("\\u{5678}", bin.force_encoding('BINARY')) + end - spec = Gem::Specification.load full_path + spec = Gem::Specification.load full_path - spec2.files.clear + spec2.files.clear - assert_equal spec2, spec - ensure - silence_warnings { Encoding.default_internal = int_enc } + assert_equal spec2, spec + end end def test_self_load_legacy_ruby |