eventualbuddha/fakefs — pull request #2 by eventualbuddha (2013-12-05 18:02:03+00:00)
Title: Fix Dir.chdir nested with multiple absolute paths.

The previous implementation used `File.join(*paths)`, which blindly concatenates path components and should not be used for path resolution. As a result, the following has unexpected behavior:

```ruby
# EXPECTED
#
# Dir.pwd => "/path/to/here"
# FakeFS::FileSystem.normalize_path('.') => "/path/to/here"
#
# ACTUAL
#
# Dir.pwd => ""
# FakeFS::FileSystem.normalize_path('.') => "/path/to/here/path/to/here"
#
FileUtils.mkdir_p('/path/to/here')
Dir.chdir('/path/to/here') do
Dir.chdir('/path/to/here') do
puts "Dir.pwd => #{Dir.pwd.inspect}"
puts "FakeFS::FileSystem.normalize_path('.') => #{FakeFS::FileSystem.normalize_path('.').inspect}"
end
end
```
The fix implemented here is to use `Pathname#+` to handle path resolution when there is at least one level of directories.