Skip to content
Browse files

chown fixed

  • Loading branch information...
1 parent 12ac708 commit 30afd1e80343f7ac0bdcbc58e2f1798d70889019 @mmriis committed Jan 30, 2012
Showing with 13 additions and 3 deletions.
  1. +8 −1 lib/fakefs/fileutils.rb
  2. +5 −2 test/fakefs_test.rb
View
9 lib/fakefs/fileutils.rb
@@ -130,7 +130,14 @@ def chown(user, group, list, options={})
end
def chown_R(user, group, list, options={})
- chown(user, group, list, options={})
+ list = Array(list)
+ list.each do |file|
+ chown(user, group, file)
+ [FileSystem.find("#{file}/**/**")].flatten.each do |f|
+ chown(user, group, f.to_s)
+ end
+ end
+ list
end
def chmod(mode, list, options={})
View
7 test/fakefs_test.rb
@@ -722,8 +722,11 @@ def test_can_chown_R_files
FileUtils.mkdir_p '/path/'
File.open('/path/foo', 'w') { |f| f.write 'foo' }
File.open('/path/foobar', 'w') { |f| f.write 'foo' }
- resp = FileUtils.chown_R(username, groupname, '/path')
- assert_equal ['/path'], resp
+ assert_equal ['/path'], FileUtils.chown_R(username, groupname, '/path')
+ %w(/path /path/foo /path/foobar).each do |f|
+ assert_equal File.stat(f).uid, Process.uid
+ assert_equal File.stat(f).gid, Process.gid
+ end
end
def test_can_chmod_files

0 comments on commit 30afd1e

Please sign in to comment.
Something went wrong with that request. Please try again.