diff options
Diffstat (limited to 'spec/ruby/library/stringio/binmode_spec.rb')
| -rw-r--r-- | spec/ruby/library/stringio/binmode_spec.rb | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/spec/ruby/library/stringio/binmode_spec.rb b/spec/ruby/library/stringio/binmode_spec.rb index 11fbbaadeb..bc7ccda0a2 100644 --- a/spec/ruby/library/stringio/binmode_spec.rb +++ b/spec/ruby/library/stringio/binmode_spec.rb @@ -1,9 +1,23 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require File.expand_path('../fixtures/classes', __FILE__) +require_relative '../../spec_helper' +require_relative 'fixtures/classes' describe "StringIO#binmode" do it "returns self" do - io = StringIO.new("example") - io.binmode.should equal(io) + io = StringIO.new(+"example") + io.binmode.should.equal?(io) + end + + it "changes external encoding to BINARY" do + io = StringIO.new + io.external_encoding.should == Encoding.find('external') + 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 end |
