Sha256: d132c54927d435491f775e9fa9a8e9fae0be8083b56d9cc4cc8032a66dabd67b
Contents?: true
Size: 1.21 KB
Versions: 83
Compression:
Stored size: 1.21 KB
Contents
describe :argf_filename, :shared => true do before :each do @file1 = fixture File.join(__rhoGetCurrentDir(), __FILE__), "file1.txt" @file2 = fixture File.join(__rhoGetCurrentDir(), __FILE__), "file2.txt" end after :each do ARGF.close end # NOTE: this test assumes that fixtures files have two lines each it "returns the current file name on each file" do argv [@file1, @file2] do result = [] # returns first current file even when not yet open result << ARGF.send(@method) result << ARGF.send(@method) while ARGF.gets # returns last current file even when closed result << ARGF.send(@method) result.map! { |f| File.expand_path(f) } result.should == [@file1, @file1, @file1, @file2, @file2, @file2] end end # NOTE: this test assumes that fixtures files have two lines each it "it sets the $FILENAME global variable with the current file name on each file" do argv [@file1, @file2] do result = [] result << $FILENAME while ARGF.gets # returns last current file even when closed result << $FILENAME result.map! { |f| File.expand_path(f) } result.should == [@file1, @file1, @file2, @file2, @file2] end end end
Version data entries
83 entries across 83 versions & 1 rubygems