1describe :argf_eof, shared: true do 2 before :each do 3 @file1 = fixture __FILE__, "file1.txt" 4 @file2 = fixture __FILE__, "file2.txt" 5 end 6 7 # NOTE: this test assumes that fixtures files have two lines each 8 it "returns true when reaching the end of a file" do 9 argf [@file1, @file2] do 10 result = [] 11 while @argf.gets 12 result << @argf.send(@method) 13 end 14 result.should == [false, true, false, true] 15 end 16 end 17 18 it "raises IOError when called on a closed stream" do 19 argf [@file1] do 20 @argf.read 21 lambda { @argf.send(@method) }.should raise_error(IOError) 22 end 23 end 24end 25