Fixed File.file? for non-existent files

This commit is contained in:
Pat Nakajima 2009-06-12 17:54:32 -04:00
parent bf6f121601
commit 94afbcabc1
2 changed files with 6 additions and 1 deletions

View File

@ -128,7 +128,8 @@ module FakeFS
if path.respond_to? :entry
path.entry.is_a? MockFile
else
FileSystem.find(path).entry.is_a? MockFile
result = FileSystem.find(path)
result && result.entry.is_a?(MockFile)
end
end

View File

@ -133,6 +133,10 @@ class FakeFSTest < Test::Unit::TestCase
assert File.file?(sympath)
end
def test_knows_non_existent_files_arent_files
assert ! File.file?('does/not/exist.txt')
end
def test_can_chown_files
good = 'file.txt'
bad = 'nofile.txt'