Added fake FileTest.file? (Closes #94)
This commit is contained in:
parent
1e074bf636
commit
a0e02ed974
@ -7,5 +7,9 @@ module FakeFS
|
||||
def self.directory?(file_name)
|
||||
File.directory?(file_name)
|
||||
end
|
||||
|
||||
def self.file?(file_name)
|
||||
File.file?(file_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1584,6 +1584,18 @@ class FakeFSTest < Test::Unit::TestCase
|
||||
assert !FileTest.directory?('/path/to/somedir')
|
||||
end
|
||||
|
||||
def test_filetest_file_returns_correct_values
|
||||
path = '/path/to/file.txt'
|
||||
File.open(path, 'w') { |f| f.write "Yatta!" }
|
||||
assert FileTest.file?(path)
|
||||
|
||||
FileUtils.rm path
|
||||
assert !FileTest.file?(path)
|
||||
|
||||
FileUtils.mkdir_p '/path/to/somedir'
|
||||
assert !FileTest.file?('/path/to/somedir')
|
||||
end
|
||||
|
||||
def test_pathname_exists_returns_correct_value
|
||||
FileUtils.touch "foo"
|
||||
assert Pathname.new("foo").exist?
|
||||
|
Loading…
Reference in New Issue
Block a user