diff options
Diffstat (limited to 'spec/ruby/core/argf')
26 files changed, 40 insertions, 104 deletions
diff --git a/spec/ruby/core/argf/argf_spec.rb b/spec/ruby/core/argf/argf_spec.rb index af67170b98..f9468539bb 100644 --- a/spec/ruby/core/argf/argf_spec.rb +++ b/spec/ruby/core/argf/argf_spec.rb @@ -2,10 +2,10 @@ require_relative '../../spec_helper' describe "ARGF" do it "is extended by the Enumerable module" do - ARGF.should be_kind_of(Enumerable) + ARGF.should.is_a?(Enumerable) end it "is an instance of ARGF.class" do - ARGF.should be_an_instance_of(ARGF.class) + ARGF.should.instance_of?(ARGF.class) end end diff --git a/spec/ruby/core/argf/argv_spec.rb b/spec/ruby/core/argf/argv_spec.rb index eab03c450f..77dfe78c21 100644 --- a/spec/ruby/core/argf/argv_spec.rb +++ b/spec/ruby/core/argf/argv_spec.rb @@ -7,7 +7,7 @@ describe "ARGF.argv" do end it "returns ARGV for the initial ARGF" do - ARGF.argv.should equal ARGV + ARGF.argv.should.equal? ARGV end it "returns the remaining arguments to treat" do diff --git a/spec/ruby/core/argf/binmode_spec.rb b/spec/ruby/core/argf/binmode_spec.rb index e083a30a27..5288e3199d 100644 --- a/spec/ruby/core/argf/binmode_spec.rb +++ b/spec/ruby/core/argf/binmode_spec.rb @@ -9,7 +9,7 @@ describe "ARGF.binmode" do it "returns self" do argf [@bin_file] do - @argf.binmode.should equal @argf + @argf.binmode.should.equal? @argf end end diff --git a/spec/ruby/core/argf/bytes_spec.rb b/spec/ruby/core/argf/bytes_spec.rb deleted file mode 100644 index bf35ded1db..0000000000 --- a/spec/ruby/core/argf/bytes_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -require_relative '../../spec_helper' -require_relative 'shared/each_byte' - -ruby_version_is ''...'3.0' do - describe "ARGF.bytes" do - before :each do - @verbose, $VERBOSE = $VERBOSE, nil - end - - after :each do - $VERBOSE = @verbose - end - - it_behaves_like :argf_each_byte, :bytes - end -end diff --git a/spec/ruby/core/argf/chars_spec.rb b/spec/ruby/core/argf/chars_spec.rb deleted file mode 100644 index 6af73cdabb..0000000000 --- a/spec/ruby/core/argf/chars_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -require_relative '../../spec_helper' -require_relative 'shared/each_char' - -ruby_version_is ''...'3.0' do - describe "ARGF.chars" do - before :each do - @verbose, $VERBOSE = $VERBOSE, nil - end - - after :each do - $VERBOSE = @verbose - end - - it_behaves_like :argf_each_char, :chars - end -end diff --git a/spec/ruby/core/argf/close_spec.rb b/spec/ruby/core/argf/close_spec.rb index d4d6a51e72..8ca7d71dc2 100644 --- a/spec/ruby/core/argf/close_spec.rb +++ b/spec/ruby/core/argf/close_spec.rb @@ -10,20 +10,20 @@ describe "ARGF.close" do argf [@file1_name, @file2_name] do io = @argf.to_io @argf.close - io.closed?.should be_true + io.closed?.should == true end end it "returns self" do argf [@file1_name, @file2_name] do - @argf.close.should equal(@argf) + @argf.close.should.equal?(@argf) end end it "doesn't raise an IOError if called on a closed stream" do argf [@file1_name] do - -> { @argf.close }.should_not raise_error - -> { @argf.close }.should_not raise_error + -> { @argf.close }.should_not.raise + -> { @argf.close }.should_not.raise end end end diff --git a/spec/ruby/core/argf/closed_spec.rb b/spec/ruby/core/argf/closed_spec.rb index e2dd6134e5..769381e8c3 100644 --- a/spec/ruby/core/argf/closed_spec.rb +++ b/spec/ruby/core/argf/closed_spec.rb @@ -11,7 +11,7 @@ describe "ARGF.closed?" do stream = @argf.to_io stream.close - @argf.closed?.should be_true + @argf.closed?.should == true stream.reopen(@argf.filename, 'r') end end diff --git a/spec/ruby/core/argf/codepoints_spec.rb b/spec/ruby/core/argf/codepoints_spec.rb deleted file mode 100644 index bb28c17fbb..0000000000 --- a/spec/ruby/core/argf/codepoints_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -require_relative '../../spec_helper' -require_relative 'shared/each_codepoint' - -ruby_version_is ''...'3.0' do - describe "ARGF.codepoints" do - before :each do - @verbose, $VERBOSE = $VERBOSE, nil - end - - after :each do - $VERBOSE = @verbose - end - - it_behaves_like :argf_each_codepoint, :codepoints - end -end diff --git a/spec/ruby/core/argf/lines_spec.rb b/spec/ruby/core/argf/lines_spec.rb deleted file mode 100644 index e964dbd0d3..0000000000 --- a/spec/ruby/core/argf/lines_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -require_relative '../../spec_helper' -require_relative 'shared/each_line' - -ruby_version_is ''...'3.0' do - describe "ARGF.lines" do - before :each do - @verbose, $VERBOSE = $VERBOSE, nil - end - - after :each do - $VERBOSE = @verbose - end - - it_behaves_like :argf_each_line, :lines - end -end diff --git a/spec/ruby/core/argf/read_nonblock_spec.rb b/spec/ruby/core/argf/read_nonblock_spec.rb index 804a459a62..5c6bd52d80 100644 --- a/spec/ruby/core/argf/read_nonblock_spec.rb +++ b/spec/ruby/core/argf/read_nonblock_spec.rb @@ -66,7 +66,7 @@ platform_is_not :windows do argf ['-'] do -> { @argf.read_nonblock(4) - }.should raise_error(IO::EAGAINWaitReadable) + }.should.raise(IO::EAGAINWaitReadable) end end diff --git a/spec/ruby/core/argf/readchar_spec.rb b/spec/ruby/core/argf/readchar_spec.rb index 4eca2efcf7..63632721ec 100644 --- a/spec/ruby/core/argf/readchar_spec.rb +++ b/spec/ruby/core/argf/readchar_spec.rb @@ -13,7 +13,7 @@ describe "ARGF.readchar" do it "raises EOFError when end of stream reached" do argf [@file1, @file2] do - -> { while @argf.readchar; end }.should raise_error(EOFError) + -> { while @argf.readchar; end }.should.raise(EOFError) end end end diff --git a/spec/ruby/core/argf/readline_spec.rb b/spec/ruby/core/argf/readline_spec.rb index db53c499e9..8c23549b1b 100644 --- a/spec/ruby/core/argf/readline_spec.rb +++ b/spec/ruby/core/argf/readline_spec.rb @@ -17,7 +17,7 @@ describe "ARGF.readline" do it "raises an EOFError when reaching end of files" do argf [@file1, @file2] do - -> { while @argf.readline; end }.should raise_error(EOFError) + -> { while @argf.readline; end }.should.raise(EOFError) end end end diff --git a/spec/ruby/core/argf/readpartial_spec.rb b/spec/ruby/core/argf/readpartial_spec.rb index 5e284b3423..9f04e72cc2 100644 --- a/spec/ruby/core/argf/readpartial_spec.rb +++ b/spec/ruby/core/argf/readpartial_spec.rb @@ -16,7 +16,7 @@ describe "ARGF.readpartial" do it "raises an ArgumentError if called without a maximum read length" do argf [@file1_name] do - -> { @argf.readpartial }.should raise_error(ArgumentError) + -> { @argf.readpartial }.should.raise(ArgumentError) end end @@ -29,7 +29,7 @@ describe "ARGF.readpartial" do it "clears output buffer even if EOFError is raised because @argf is at end" do begin - output = "to be cleared" + output = +"to be cleared" argf [@file1_name] do @argf.read @@ -59,8 +59,8 @@ describe "ARGF.readpartial" do @argf.readpartial(@file1.size) @argf.readpartial(1) @argf.readpartial(@file2.size) - -> { @argf.readpartial(1) }.should raise_error(EOFError) - -> { @argf.readpartial(1) }.should raise_error(EOFError) + -> { @argf.readpartial(1) }.should.raise(EOFError) + -> { @argf.readpartial(1) }.should.raise(EOFError) end end @@ -69,7 +69,7 @@ describe "ARGF.readpartial" do print ARGF.readpartial(#{@stdin.size}) ARGF.readpartial(1) rescue print $!.class STR - stdin = ruby_exe(ruby_str, args: "< #{@stdin_name}", escape: true) + stdin = ruby_exe(ruby_str, args: "< #{@stdin_name}") stdin.should == @stdin + "EOFError" end end diff --git a/spec/ruby/core/argf/rewind_spec.rb b/spec/ruby/core/argf/rewind_spec.rb index b29f0b75b7..9255f790fe 100644 --- a/spec/ruby/core/argf/rewind_spec.rb +++ b/spec/ruby/core/argf/rewind_spec.rb @@ -33,7 +33,7 @@ describe "ARGF.rewind" do it "raises an ArgumentError when end of stream reached" do argf [@file1_name, @file2_name] do @argf.read - -> { @argf.rewind }.should raise_error(ArgumentError) + -> { @argf.rewind }.should.raise(ArgumentError) end end end diff --git a/spec/ruby/core/argf/seek_spec.rb b/spec/ruby/core/argf/seek_spec.rb index 2b73bd46fb..c1ea1ea438 100644 --- a/spec/ruby/core/argf/seek_spec.rb +++ b/spec/ruby/core/argf/seek_spec.rb @@ -57,7 +57,7 @@ describe "ARGF.seek" do it "takes at least one argument (offset)" do argf [@file1_name] do - -> { @argf.seek }.should raise_error(ArgumentError) + -> { @argf.seek }.should.raise(ArgumentError) end end end diff --git a/spec/ruby/core/argf/shared/each_byte.rb b/spec/ruby/core/argf/shared/each_byte.rb index 6b1dc1dae2..48c9ae04f8 100644 --- a/spec/ruby/core/argf/shared/each_byte.rb +++ b/spec/ruby/core/argf/shared/each_byte.rb @@ -18,14 +18,14 @@ describe :argf_each_byte, shared: true do it "returns self when passed a block" do argf [@file1_name, @file2_name] do - @argf.send(@method) {}.should equal(@argf) + @argf.send(@method) {}.should.equal?(@argf) end end it "returns an Enumerator when passed no block" do argf [@file1_name, @file2_name] do enum = @argf.send(@method) - enum.should be_an_instance_of(Enumerator) + enum.should.instance_of?(Enumerator) bytes = [] enum.each { |b| bytes << b } @@ -37,7 +37,7 @@ describe :argf_each_byte, shared: true do it "returns an Enumerator" do argf [@file1_name, @file2_name] do enum = @argf.send(@method) - enum.should be_an_instance_of(Enumerator) + enum.should.instance_of?(Enumerator) bytes = [] enum.each { |b| bytes << b } diff --git a/spec/ruby/core/argf/shared/each_char.rb b/spec/ruby/core/argf/shared/each_char.rb index 9e333ecc5b..4b5e8452ab 100644 --- a/spec/ruby/core/argf/shared/each_char.rb +++ b/spec/ruby/core/argf/shared/each_char.rb @@ -18,14 +18,14 @@ describe :argf_each_char, shared: true do it "returns self when passed a block" do argf [@file1_name, @file2_name] do - @argf.send(@method) {}.should equal(@argf) + @argf.send(@method) {}.should.equal?(@argf) end end it "returns an Enumerator when passed no block" do argf [@file1_name, @file2_name] do enum = @argf.send(@method) - enum.should be_an_instance_of(Enumerator) + enum.should.instance_of?(Enumerator) chars = [] enum.each { |c| chars << c } @@ -37,7 +37,7 @@ describe :argf_each_char, shared: true do it "returns an Enumerator" do argf [@file1_name, @file2_name] do enum = @argf.send(@method) - enum.should be_an_instance_of(Enumerator) + enum.should.instance_of?(Enumerator) chars = [] enum.each { |c| chars << c } diff --git a/spec/ruby/core/argf/shared/each_codepoint.rb b/spec/ruby/core/argf/shared/each_codepoint.rb index e2a2dfff46..3137306ad5 100644 --- a/spec/ruby/core/argf/shared/each_codepoint.rb +++ b/spec/ruby/core/argf/shared/each_codepoint.rb @@ -10,7 +10,7 @@ describe :argf_each_codepoint, shared: true do it "is a public method" do argf @filenames do - @argf.public_methods(false).should include(@method) + @argf.public_methods(false).should.include?(@method) end end @@ -22,13 +22,13 @@ describe :argf_each_codepoint, shared: true do it "returns self when passed a block" do argf @filenames do - @argf.send(@method) {}.should equal(@argf) + @argf.send(@method) {}.should.equal?(@argf) end end it "returns an Enumerator when passed no block" do argf @filenames do - @argf.send(@method).should be_an_instance_of(Enumerator) + @argf.send(@method).should.instance_of?(Enumerator) end end @@ -41,7 +41,7 @@ describe :argf_each_codepoint, shared: true do describe "when no block is given" do it "returns an Enumerator" do argf @filenames do - @argf.send(@method).should be_an_instance_of(Enumerator) + @argf.send(@method).should.instance_of?(Enumerator) end end diff --git a/spec/ruby/core/argf/shared/each_line.rb b/spec/ruby/core/argf/shared/each_line.rb index c0ef77dc54..7e66e38803 100644 --- a/spec/ruby/core/argf/shared/each_line.rb +++ b/spec/ruby/core/argf/shared/each_line.rb @@ -9,7 +9,7 @@ describe :argf_each_line, shared: true do it "is a public method" do argf [@file1_name, @file2_name] do - @argf.public_methods(false).should include(@method) + @argf.public_methods(false).should.include?(@method) end end @@ -29,7 +29,7 @@ describe :argf_each_line, shared: true do it "returns self when passed a block" do argf [@file1_name, @file2_name] do - @argf.send(@method) {}.should equal(@argf) + @argf.send(@method) {}.should.equal?(@argf) end end @@ -45,7 +45,7 @@ describe :argf_each_line, shared: true do describe "when no block is given" do it "returns an Enumerator" do argf [@file1_name, @file2_name] do - @argf.send(@method).should be_an_instance_of(Enumerator) + @argf.send(@method).should.instance_of?(Enumerator) end end diff --git a/spec/ruby/core/argf/shared/eof.rb b/spec/ruby/core/argf/shared/eof.rb index 0e684f943f..8b3897b952 100644 --- a/spec/ruby/core/argf/shared/eof.rb +++ b/spec/ruby/core/argf/shared/eof.rb @@ -18,7 +18,7 @@ describe :argf_eof, shared: true do it "raises IOError when called on a closed stream" do argf [@file1] do @argf.read - -> { @argf.send(@method) }.should raise_error(IOError) + -> { @argf.send(@method) }.should.raise(IOError) end end end diff --git a/spec/ruby/core/argf/shared/fileno.rb b/spec/ruby/core/argf/shared/fileno.rb index 4350d43747..e605be46e3 100644 --- a/spec/ruby/core/argf/shared/fileno.rb +++ b/spec/ruby/core/argf/shared/fileno.rb @@ -18,7 +18,7 @@ describe :argf_fileno, shared: true do it "raises an ArgumentError when called on a closed stream" do argf [@file1] do @argf.read - -> { @argf.send(@method) }.should raise_error(ArgumentError) + -> { @argf.send(@method) }.should.raise(ArgumentError) end end end diff --git a/spec/ruby/core/argf/shared/getc.rb b/spec/ruby/core/argf/shared/getc.rb index 8be39c60b6..d63372d9d7 100644 --- a/spec/ruby/core/argf/shared/getc.rb +++ b/spec/ruby/core/argf/shared/getc.rb @@ -9,7 +9,7 @@ describe :argf_getc, shared: true do it "reads each char of files" do argf [@file1, @file2] do - chars = "" + chars = +"" @chars.size.times { chars << @argf.send(@method) } chars.should == @chars end diff --git a/spec/ruby/core/argf/shared/pos.rb b/spec/ruby/core/argf/shared/pos.rb index 9836d5f1e4..f859d3a29d 100644 --- a/spec/ruby/core/argf/shared/pos.rb +++ b/spec/ruby/core/argf/shared/pos.rb @@ -25,7 +25,7 @@ describe :argf_pos, shared: true do it "raises an ArgumentError when called on a closed stream" do argf [@file1] do @argf.read - -> { @argf.send(@method) }.should raise_error(ArgumentError) + -> { @argf.send(@method) }.should.raise(ArgumentError) end end end diff --git a/spec/ruby/core/argf/shared/read.rb b/spec/ruby/core/argf/shared/read.rb index fe903983c0..e76d022139 100644 --- a/spec/ruby/core/argf/shared/read.rb +++ b/spec/ruby/core/argf/shared/read.rb @@ -15,7 +15,7 @@ describe :argf_read, shared: true do it "treats second argument as an output buffer" do argf [@file1_name] do - buffer = "" + buffer = +"" @argf.send(@method, @file1.size, buffer) buffer.should == @file1 end @@ -23,7 +23,7 @@ describe :argf_read, shared: true do it "clears output buffer before appending to it" do argf [@file1_name] do - buffer = "to be cleared" + buffer = +"to be cleared" @argf.send(@method, @file1.size, buffer) buffer.should == @file1 end diff --git a/spec/ruby/core/argf/skip_spec.rb b/spec/ruby/core/argf/skip_spec.rb index 0181801c2d..bb1c0ae110 100644 --- a/spec/ruby/core/argf/skip_spec.rb +++ b/spec/ruby/core/argf/skip_spec.rb @@ -37,6 +37,6 @@ describe "ARGF.skip" do # which as a side-effect calls argf.file which will initialize # internals of ARGF enough for this to work. it "has no effect when nothing has been processed yet" do - -> { ARGF.class.new(@file1_name).skip }.should_not raise_error + -> { ARGF.class.new(@file1_name).skip }.should_not.raise end end diff --git a/spec/ruby/core/argf/to_io_spec.rb b/spec/ruby/core/argf/to_io_spec.rb index 062383d291..ab5de58bcf 100644 --- a/spec/ruby/core/argf/to_io_spec.rb +++ b/spec/ruby/core/argf/to_io_spec.rb @@ -15,7 +15,7 @@ describe "ARGF.to_io" do result << @argf.to_io end - result.each { |io| io.should be_kind_of(IO) } + result.each { |io| io.should.is_a?(IO) } result[0].should == result[1] result[2].should == result[3] end |
