File.size? actually returns nil instead of false
This commit is contained in:
parent
e591d3b2d3
commit
5deda9b456
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user