This page contains automated test results for code from O'Reilly's Ruby Cookbook. If this code looks interesting or useful, you might want to buy the whole book.
| Deleting a File | ||
|---|---|---|
| Code | Expected | Actual |
FileUtils.touch "doomed_file" File.exists? "doomed_file" |
true | true |
File.delete "doomed_file" File.exists? "doomed_file" |
false | false |
Dir.mkdir "doomed_directory" File.exists? "doomed_directory" |
true | true |
FileUtils.remove_dir "doomed_directory" File.exists? "doomed_directory" |
false | false |
module FileUtils
module_function :fu_world_writable?
end
Dir.mkdir "/tmp/doomed_directory"
FileUtils.rm_rf("/tmp/doomed_directory", :secure=>true)
File.exists? "/tmp/doomed_directory" |
false | false |