Skip to content

Commit

Permalink
Added FakeFS::Dir.exist? as alias for .exists? and wrote a test for b…
Browse files Browse the repository at this point in the history
…oth.
  • Loading branch information
tovodeverett authored and smtlaissezfaire committed Dec 1, 2012
1 parent 673b0eb commit 690c1ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/fakefs/dir.rb
Expand Up @@ -180,6 +180,7 @@ class << self
alias_method :getwd, :pwd
alias_method :rmdir, :delete
alias_method :unlink, :delete
alias_method :exist?, :exists?
end
end
end
8 changes: 8 additions & 0 deletions test/fakefs_test.rb
Expand Up @@ -1705,6 +1705,14 @@ def test_directory_open_block
test.each { |t| assert yielded.include?(t) }
end

def test_directory_exists
assert Dir.exists?('/this/path/should/be/here') == false
assert Dir.exist?('/this/path/should/be/here') == false
FileUtils.mkdir_p('/this/path/should/be/here')
assert Dir.exists?('/this/path/should/be/here') == true
assert Dir.exist?('/this/path/should/be/here') == true
end

def test_tmpdir
assert Dir.tmpdir == "/tmp"
end
Expand Down

0 comments on commit 690c1ad

Please sign in to comment.