2018-03-04 10:09:32 -05:00
|
|
|
require_relative '../../spec_helper'
|
|
|
|
require_relative 'fixtures/classes'
|
2017-05-07 08:04:49 -04:00
|
|
|
|
|
|
|
describe "StringIO#binmode" do
|
|
|
|
it "returns self" do
|
|
|
|
io = StringIO.new("example")
|
|
|
|
io.binmode.should equal(io)
|
|
|
|
end
|
2020-02-28 13:07:17 -05:00
|
|
|
|
|
|
|
it "changes external encoding to BINARY" do
|
|
|
|
io = StringIO.new
|
|
|
|
io.external_encoding.should == Encoding.find('locale')
|
|
|
|
io.binmode
|
|
|
|
io.external_encoding.should == Encoding::BINARY
|
|
|
|
end
|
|
|
|
|
|
|
|
it "does not set internal encoding" do
|
|
|
|
io = StringIO.new
|
|
|
|
io.internal_encoding.should == nil
|
|
|
|
io.binmode
|
|
|
|
io.internal_encoding.should == nil
|
|
|
|
end
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|