rubyspec/mspec — pull request #29 by eregon (2012-07-29 11:56:26+00:00)
Title: use FileUtils.rm_r for the rm_r helper to fix removing dangling symlinks

As @nobu and I noted in rubyspec/rubyspec#131, mspec's `rm_r` helper does not remove dangling symlinks (and therefore not directories containing dangling symlinks).

I took here the approach to use FileUtils's `rm_r`, for the sake of least surprise, and that it is well tested.
Another way would be to add a case for dangling symlinks.
The not-so-natural fact is `File.exist?` returns `false` for a dangling symlink (because it uses `stat(2)` not `lstat(2)`). This means the only way to check is via `File.lstat` and rescue the exception by `false`.

I hesitated using `:force` with `FileUtils.rm_r`, because the `rm_r` helper ignores non existent files. I chose to rescue only `ENOENT`, as others errors should not be ignored.