summaryrefslogtreecommitdiff
path: root/spec/ruby/library/stringio/shared
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/stringio/shared')
-rw-r--r--spec/ruby/library/stringio/shared/each.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/ruby/library/stringio/shared/each.rb b/spec/ruby/library/stringio/shared/each.rb
index 0fde23634e..55ed27c1c7 100644
--- a/spec/ruby/library/stringio/shared/each.rb
+++ b/spec/ruby/library/stringio/shared/each.rb
@@ -103,3 +103,12 @@ describe :stringio_each_not_readable, shared: true do
lambda { io.send(@method) { |b| b } }.should raise_error(IOError)
end
end
+
+describe :stringio_each_chomp, shared: true do
+ it "yields each line with removed newline characters to the passed block" do
+ seen = []
+ io = StringIO.new("a b \rc d e\n1 2 3 4 5\r\nthe end")
+ io.send(@method, chomp: true) {|s| seen << s }
+ seen.should == ["a b \rc d e", "1 2 3 4 5", "the end"]
+ end
+end