2018-03-04 15:09:32 +00:00
|
|
|
require_relative '../../spec_helper'
|
2017-05-07 12:04:49 +00:00
|
|
|
require 'stringio'
|
2018-03-04 15:09:32 +00:00
|
|
|
require_relative 'shared/each'
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2020-12-04 16:32:14 +01:00
|
|
|
ruby_version_is ''...'3.0' do
|
2020-07-27 11:15:50 +09:00
|
|
|
describe "StringIO#lines when passed a separator" do
|
2020-12-27 17:35:32 +01:00
|
|
|
before :each do
|
|
|
|
@verbose, $VERBOSE = $VERBOSE, nil
|
|
|
|
end
|
|
|
|
|
|
|
|
after :each do
|
|
|
|
$VERBOSE = @verbose
|
|
|
|
end
|
|
|
|
|
2020-07-27 11:15:50 +09:00
|
|
|
it_behaves_like :stringio_each_separator, :lines
|
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2020-07-27 11:15:50 +09:00
|
|
|
describe "StringIO#lines when passed no arguments" do
|
2020-12-27 17:35:32 +01:00
|
|
|
before :each do
|
|
|
|
@verbose, $VERBOSE = $VERBOSE, nil
|
|
|
|
end
|
|
|
|
|
|
|
|
after :each do
|
|
|
|
$VERBOSE = @verbose
|
|
|
|
end
|
|
|
|
|
2020-07-27 11:15:50 +09:00
|
|
|
it_behaves_like :stringio_each_no_arguments, :lines
|
|
|
|
end
|
2017-05-07 12:04:49 +00:00
|
|
|
|
2020-07-27 11:15:50 +09:00
|
|
|
describe "StringIO#lines when self is not readable" do
|
2020-12-27 17:35:32 +01:00
|
|
|
before :each do
|
|
|
|
@verbose, $VERBOSE = $VERBOSE, nil
|
|
|
|
end
|
|
|
|
|
|
|
|
after :each do
|
|
|
|
$VERBOSE = @verbose
|
|
|
|
end
|
|
|
|
|
2020-07-27 11:15:50 +09:00
|
|
|
it_behaves_like :stringio_each_not_readable, :lines
|
|
|
|
end
|
2017-10-28 15:15:48 +00:00
|
|
|
|
2020-07-27 11:15:50 +09:00
|
|
|
describe "StringIO#lines when passed chomp" do
|
2020-12-27 17:35:32 +01:00
|
|
|
before :each do
|
|
|
|
@verbose, $VERBOSE = $VERBOSE, nil
|
|
|
|
end
|
|
|
|
|
|
|
|
after :each do
|
|
|
|
$VERBOSE = @verbose
|
|
|
|
end
|
|
|
|
|
2020-07-27 11:15:50 +09:00
|
|
|
it_behaves_like :stringio_each_chomp, :lines
|
|
|
|
end
|
2017-10-28 15:15:48 +00:00
|
|
|
end
|