rubyspec/rubyspec — pull request #184 by yb66 (2013-03-05 11:32:28+00:00)
Title: Added specs for require_relative to handle absolute paths

Hi,

The previous spec assumed a relative path would always be given, and so it only checked against that, which is a nice ideal to hold but an easy way to break a program. The [JRuby implementation of require_relative](https://github.com/jruby/jruby/blob/1.7.3/src/jruby/kernel19/kernel.rb#L18) puts together the path without checking if its absolute, and hence it fails. Tightening the spec to include absolute paths would stop this.

I've pretty much duplicated the specs for a relative path, and set the `before` block instance variables to use absolute paths, so that the specs for a relative and an absolute path are the same except in the values passed to them.

I've joined the paths together using `File.join` instead of joining via interpolation in case the absolute paths introduce an extra slash. I've made the specs for the relative path use `File.join` too to keep them in sync.

I should point out that the MRI implementation _does_ handle absolute paths sent to `require_relative`, so I believe this brings the spec inline with the defacto reference implementation.

Regards,
Iain