adding File#flush

This commit is contained in:
Jeff Hodges 2009-05-30 21:22:57 -07:00
parent 820c9df1b0
commit 45b0e2828f
2 changed files with 7 additions and 0 deletions

View File

@ -129,6 +129,8 @@ module FakeFS
@file.content += content @file.content += content
end end
alias_method :print, :write alias_method :print, :write
def flush; self; end
end end
class Dir class Dir

View File

@ -254,4 +254,9 @@ class FakeFSTest < Test::Unit::TestCase
File.open('foo','w'){|f| f.write 'bar' } File.open('foo','w'){|f| f.write 'bar' }
assert_equal 'bar', File.open('foo'){|f| f.read } assert_equal 'bar', File.open('foo'){|f| f.read }
end end
def test_flush_exists_on_file
r = File.open('foo','w'){|f| f.write 'bar'; f.flush }
assert_equal 'foo', r.path
end
end end