From a0e02ed974bd127c8ffb586009eb7c049765801d Mon Sep 17 00:00:00 2001
From: Andrius Chamentauskas <andrius.chamentauskas@gmail.com>
Date: Tue, 30 Aug 2011 11:19:30 +0300
Subject: [PATCH] Added fake FileTest.file? (Closes #94)

---
 lib/fakefs/file_test.rb |  4 ++++
 test/fakefs_test.rb     | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/lib/fakefs/file_test.rb b/lib/fakefs/file_test.rb
index 5dbdbf5..2f6a61d 100644
--- a/lib/fakefs/file_test.rb
+++ b/lib/fakefs/file_test.rb
@@ -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
diff --git a/test/fakefs_test.rb b/test/fakefs_test.rb
index e75aaf4..cc0041c 100644
--- a/test/fakefs_test.rb
+++ b/test/fakefs_test.rb
@@ -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?