1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix failures on non-UTF-8 environment [Bug #18077]

Call `IOSpecs.io_fixture` with the default encoding explicitly.
`IOSpecs.closed_io` calls the method without optional `mode` which
is set to UTF-8 by default, while the default external encoding
depends on the locale environment variables.
This commit is contained in:
Nobuyoshi Nakada 2021-08-22 12:03:44 +09:00
parent 18031f4102
commit d574b84182
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
2 changed files with 6 additions and 2 deletions

View file

@ -96,7 +96,9 @@ describe "IO#external_encoding" do
ruby_version_is '3.1' do ruby_version_is '3.1' do
it "can be retrieved from a closed stream" do it "can be retrieved from a closed stream" do
IOSpecs.closed_io.external_encoding.should equal(Encoding.default_external) io = IOSpecs.io_fixture("lines.txt", "r")
io.close
io.external_encoding.should equal(Encoding.default_external)
end end
end end

View file

@ -115,7 +115,9 @@ describe "IO#internal_encoding" do
ruby_version_is '3.1' do ruby_version_is '3.1' do
it "can be retrieved from a closed stream" do it "can be retrieved from a closed stream" do
IOSpecs.closed_io.internal_encoding.should equal(Encoding.default_internal) io = IOSpecs.io_fixture("lines.txt", "r")
io.close
io.internal_encoding.should equal(Encoding.default_internal)
end end
end end