Permalink
Browse files

Merge pull request #102 from marano/issue_102

Dir.mkdir would fail if path starts with dot.

Conflicts:
	lib/fakefs/dir.rb
	test/fakefs_test.rb
  • Loading branch information...
2 parents 2a87046 + 55e1d60 commit 5c3f970efbd4b04889ab1ceccc5a9304cf7a5103 @jfirebaugh jfirebaugh committed Apr 17, 2012
Showing with 6 additions and 1 deletion.
  1. +1 −1 lib/fakefs/fileutils.rb
  2. +5 −0 test/fakefs_test.rb
View
2 lib/fakefs/fileutils.rb
@@ -11,7 +11,7 @@ def mkdir_p(path, options = {})
def mkdir(path)
parent = path.split('/')
parent.pop
- raise Errno::ENOENT, "No such file or directory - #{path}" unless parent.join == "" || FileSystem.find(parent.join('/'))
+ raise Errno::ENOENT, "No such file or directory - #{path}" unless parent.join == "" || parent.join == "." || FileSystem.find(parent.join('/'))
raise Errno::EEXIST, "File exists - #{path}" if FileSystem.find(path)
FileSystem.add(path, FakeDir.new)
end
View
5 test/fakefs_test.rb
@@ -1594,6 +1594,11 @@ def test_can_create_absolute_subdirectories_with_dir_mkdir
assert Dir.exists?('/foo/bar')
end
+ def test_can_create_directories_starting_with_dot
+ Dir.mkdir './path'
+ assert File.exists? './path'
+ end
+
def test_directory_mkdir_relative
FileUtils.mkdir_p('/new/root')
FileSystem.chdir('/new/root')

0 comments on commit 5c3f970

Please sign in to comment.