File.size? actually returns nil instead of false

This commit is contained in:
Nick Quaranto 2009-09-29 11:21:12 -04:00 committed by Chris Wanstrath
parent e591d3b2d3
commit 5deda9b456
2 changed files with 7 additions and 3 deletions

View File

@ -51,7 +51,11 @@ module FakeFS
end
def self.size?(path)
exists?(path) && !size(path).zero?
if exists?(path) && !size(path).zero?
true
else
nil
end
end
def self.const_missing(name)

View File

@ -214,7 +214,7 @@ class FakeFSTest < Test::Unit::TestCase
f << 'Yada Yada'
end
assert File.size?(path)
assert ! File.size?("/path/to/other.txt")
assert_nil File.size?("/path/to/other.txt")
end
def test_can_check_size?_of_empty_file
@ -222,7 +222,7 @@ class FakeFSTest < Test::Unit::TestCase
File.open(path, 'w') do |f|
f << ''
end
assert ! File.size?("/path/to/file.txt")
assert_nil File.size?("/path/to/file.txt")
end
def test_can_read_with_File_readlines