From 57d02ab8b2a8674045855926a5933e01f944ebd5 Mon Sep 17 00:00:00 2001 From: Pat Nakajima Date: Fri, 12 Jun 2009 18:16:16 -0400 Subject: [PATCH] More accurate test for File.file? --- lib/fakefs.rb | 2 +- test/fakefs_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fakefs.rb b/lib/fakefs.rb index 54913b0..11f5e36 100644 --- a/lib/fakefs.rb +++ b/lib/fakefs.rb @@ -129,7 +129,7 @@ module FakeFS path.entry.is_a? MockFile else result = FileSystem.find(path) - result && result.entry.is_a?(MockFile) + result ? result.entry.is_a?(MockFile) : false end end diff --git a/test/fakefs_test.rb b/test/fakefs_test.rb index 36abfd7..058df0d 100644 --- a/test/fakefs_test.rb +++ b/test/fakefs_test.rb @@ -134,7 +134,7 @@ class FakeFSTest < Test::Unit::TestCase end def test_knows_non_existent_files_arent_files - assert ! File.file?('does/not/exist.txt') + assert_equal RealFile.file?('does/not/exist.txt'), File.file?('does/not/exist.txt') end def test_can_chown_files