diff --git a/ChangeLog b/ChangeLog index 4eb5e2eb31..f09518718b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Sep 18 16:26:27 2014 NAKAMURA Usaku + + * test/rubygems/test_gem_commands_setup_command.rb: @ui uses StringIO + as its streams, and Encoding.default_external does not effect to + stringIOs already exist. so, we need to set external_encoding of + @ui.outs directly. this problem (test failure) does not appear in + the environments default_external is us-ascii or utf-8. + Thu Sep 18 15:02:15 2014 NAKAMURA Usaku * test/rubygems/test_gem_specification.rb: '/' is not always the root. diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb index 2fe3384954..974c157a18 100644 --- a/test/rubygems/test_gem_commands_setup_command.rb +++ b/test/rubygems/test_gem_commands_setup_command.rb @@ -77,10 +77,10 @@ class TestGemCommandsSetupCommand < Gem::TestCase def test_show_release_notes @default_external = nil - capture_io do - @default_external, Encoding.default_external = - Encoding.default_external, Encoding::US_ASCII - end if Object.const_defined? :Encoding + if Object.const_defined? :Encoding + @default_external = @ui.outs.external_encoding + @ui.outs.set_encoding Encoding::US_ASCII + end @cmd.options[:previous_version] = Gem::Version.new '2.0.2' @@ -127,11 +127,9 @@ class TestGemCommandsSetupCommand < Gem::TestCase output = @ui.output output.force_encoding Encoding::UTF_8 if Object.const_defined? :Encoding - assert_equal expected, @ui.output + assert_equal expected, output ensure - capture_io do - Encoding.default_external = @default_external - end if @default_external + @ui.outs.set_encoding @default_external if @default_external end end