Fix FakeFS#close

This commit is contained in:
Scott Taylor 2009-11-08 00:56:00 -05:00
parent dd8ff05eec
commit d2264eb646
2 changed files with 10 additions and 4 deletions

View File

@ -217,10 +217,6 @@ module FakeFS
super(@file.content, mode)
end
def close
@open = false
end
def exists?
true
end

View File

@ -330,6 +330,16 @@ class FakeFSTest < Test::Unit::TestCase
end
end
def test_File_close_disallows_further_writes
path = '/path/to/file.txt'
file = File.open(path, 'w')
file.write 'Yada'
file.close
assert_raise IOError do
file << "foo"
end
end
def test_can_read_from_file_objects
path = '/path/to/file.txt'
File.open(path, 'w') do |f|