diff options
Diffstat (limited to 'spec/ruby/library/stringio')
-rw-r--r-- | spec/ruby/library/stringio/close_read_spec.rb | 7 | ||||
-rw-r--r-- | spec/ruby/library/stringio/close_spec.rb | 15 | ||||
-rw-r--r-- | spec/ruby/library/stringio/close_write_spec.rb | 7 | ||||
-rw-r--r-- | spec/ruby/library/stringio/external_encoding_spec.rb | 16 | ||||
-rw-r--r-- | spec/ruby/library/stringio/read_nonblock_spec.rb | 9 |
5 files changed, 21 insertions, 33 deletions
diff --git a/spec/ruby/library/stringio/close_read_spec.rb b/spec/ruby/library/stringio/close_read_spec.rb index 48630e0a7b..05d6c9f7d2 100644 --- a/spec/ruby/library/stringio/close_read_spec.rb +++ b/spec/ruby/library/stringio/close_read_spec.rb @@ -26,11 +26,6 @@ describe "StringIO#close_read" do io = StringIO.new("example") io.close_read - ruby_version_is ''...'2.3' do - lambda { io.close_read }.should raise_error(IOError) - end - ruby_version_is '2.3' do - io.close_read.should == nil - end + io.close_read.should == nil end end diff --git a/spec/ruby/library/stringio/close_spec.rb b/spec/ruby/library/stringio/close_spec.rb index 592dfdf526..a5a931aff1 100644 --- a/spec/ruby/library/stringio/close_spec.rb +++ b/spec/ruby/library/stringio/close_spec.rb @@ -16,17 +16,8 @@ describe "StringIO#close" do lambda { @io.write('x') }.should raise_error(IOError) end - ruby_version_is ''...'2.3' do - it "raises an IOError when self was already closed" do - @io.close - lambda { @io.close }.should raise_error(IOError) - end - end - - ruby_version_is "2.3" do - it "does not raise anything when self was already closed" do - @io.close - lambda { @io.close }.should_not raise_error(IOError) - end + it "does not raise anything when self was already closed" do + @io.close + lambda { @io.close }.should_not raise_error(IOError) end end diff --git a/spec/ruby/library/stringio/close_write_spec.rb b/spec/ruby/library/stringio/close_write_spec.rb index f6292a9253..8a7ac12581 100644 --- a/spec/ruby/library/stringio/close_write_spec.rb +++ b/spec/ruby/library/stringio/close_write_spec.rb @@ -26,11 +26,6 @@ describe "StringIO#close_write" do io = StringIO.new("example") io.close_write - ruby_version_is ''...'2.3' do - lambda { io.close_write }.should raise_error(IOError) - end - ruby_version_is '2.3' do - io.close_write.should == nil - end + io.close_write.should == nil end end diff --git a/spec/ruby/library/stringio/external_encoding_spec.rb b/spec/ruby/library/stringio/external_encoding_spec.rb index 1a57081287..9c3d4041e5 100644 --- a/spec/ruby/library/stringio/external_encoding_spec.rb +++ b/spec/ruby/library/stringio/external_encoding_spec.rb @@ -8,14 +8,12 @@ describe "StringIO#external_encoding" do io.external_encoding.should == Encoding::EUC_JP end - ruby_version_is "2.3" do - it "does not set the encoding of its buffer string if the string is frozen" do - str = "foo".freeze - enc = str.encoding - io = StringIO.new(str) - io.set_encoding Encoding::EUC_JP - io.external_encoding.should == Encoding::EUC_JP - str.encoding.should == enc - end + it "does not set the encoding of its buffer string if the string is frozen" do + str = "foo".freeze + enc = str.encoding + io = StringIO.new(str) + io.set_encoding Encoding::EUC_JP + io.external_encoding.should == Encoding::EUC_JP + str.encoding.should == enc end end diff --git a/spec/ruby/library/stringio/read_nonblock_spec.rb b/spec/ruby/library/stringio/read_nonblock_spec.rb index 88728fcc18..7a79eef3c5 100644 --- a/spec/ruby/library/stringio/read_nonblock_spec.rb +++ b/spec/ruby/library/stringio/read_nonblock_spec.rb @@ -18,3 +18,12 @@ end describe "StringIO#read_nonblock when passed length" do it_behaves_like :stringio_sysread_length, :read_nonblock end + +describe "StringIO#read_nonblock" do + + it "accepts an exception option" do + stringio = StringIO.new('foo') + stringio.read_nonblock(3, exception: false).should == 'foo' + end + +end |