Browse files

fix for one file only

  • Loading branch information...
1 parent 96faf01 commit 61a8b17c8473bedf985b48bdef4e8d1fbb91de6e @mmriis committed Jan 30, 2012
Showing with 5 additions and 1 deletion.
  1. +1 −1 lib/fakefs/fileutils.rb
  2. +4 −0 test/fakefs_test.rb
View
2 lib/fakefs/fileutils.rb
@@ -145,7 +145,7 @@ def chmod_R(mode, list, options={})
list = Array(list)
list.each do |file|
chmod(mode, file)
- FileSystem.find("#{file}/**/**").each do |f|
+ [FileSystem.find("#{file}/**/**")].flatten.each do |f|
chmod(mode, f.to_s)
end
end
View
4 test/fakefs_test.rb
@@ -750,6 +750,10 @@ def test_can_chmod_R_files
assert_equal File.stat("/path/file1").mode, 0100600
assert_equal File.stat("/path/sub").mode, 0100600
assert_equal File.stat("/path/sub/file2").mode, 0100600
+
+ FileUtils.mkdir_p "/path2"
+ FileUtils.touch "/path2/hej"
+ assert_equal ["/path2"], FileUtils.chmod_R(0600, "/path2")
end
def test_dir_globs_paths

0 comments on commit 61a8b17

Please sign in to comment.