ruby-changes:72381
From: Nobuyoshi <ko1@a...>
Date: Fri, 1 Jul 2022 09:09:30 +0900 (JST)
Subject: [ruby-changes:72381] c684b1aa26 (master): Fix TODO in stringio/truncate_spec.rb
https://git.ruby-lang.org/ruby.git/commit/?id=c684b1aa26 From c684b1aa26c51d9163eec06890e990b430dc34c5 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Fri, 1 Jul 2022 09:08:25 +0900 Subject: Fix TODO in stringio/truncate_spec.rb --- spec/ruby/library/stringio/truncate_spec.rb | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/spec/ruby/library/stringio/truncate_spec.rb b/spec/ruby/library/stringio/truncate_spec.rb index 18af8bbb80..e8d7f1a15d 100644 --- a/spec/ruby/library/stringio/truncate_spec.rb +++ b/spec/ruby/library/stringio/truncate_spec.rb @@ -6,11 +6,9 @@ describe "StringIO#truncate when passed [length]" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/stringio/truncate_spec.rb#L6 @io = StringIO.new('123456789') end - # TODO: Report to Ruby-Core: The RDoc says it always returns 0 - it "returns the passed length" do - @io.truncate(4).should eql(4) - @io.truncate(10).should eql(10) - end if ENV['USER'] == 'nobu' + it "returns an Integer" do + @io.truncate(4).should be_kind_of(Integer) + end it "truncated the underlying string down to the passed length" do @io.truncate(4) @@ -47,13 +45,6 @@ describe "StringIO#truncate when passed [length]" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/stringio/truncate_spec.rb#L45 @io.string.should == "1234" end - it "returns the passed length Object, NOT the result of #to_int" do - obj = mock("to_int") - obj.should_receive(:to_int).and_return(4) - - @io.truncate(obj).should equal(obj) - end if ENV['USER'] == 'nobu' - it "raises a TypeError when the passed length can't be converted to an Integer" do -> { @io.truncate(Object.new) }.should raise_error(TypeError) end -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/