[rspec-users] Ruby 1.9 - autospec loadpath problem

David Chelimsky dchelimsky at gmail.com
Thu Feb 19 11:49:45 EST 2009

On Thu, Feb 19, 2009 at 8:52 AM, lasitha <lasitha.ranatunga at gmail.com> wrote:
> On Mon, Dec 01, 2008 at 03:51pm, David Chelimsky <dchelimsky at gmail.com>
> wrote:
>>On Sun, Nov 30, 2008 at 4:24 PM, Mikel Lindsaar <raasdnil at gmail.com> wrote:
>>> [...]
>>> mikel at baci.local ~/ruby_programs/mail
>>>  $ autospec
>>> /usr/local/bin/autotest:19:in `load': Is a directory -
>>> /usr/local/lib/ruby-trunk/gems/1.9.1/gems/rspec-1.1.11/lib/autotest
>>> (Errno::EISDIR)
>>> from /usr/local/bin/autotest:19:in `<main>'
>>> [...]
>>> So load is trying to load autotest the directory instead of autotest the
>>> script.
>>> Any ideas on how to get it to load the right thing?
>>I'm not sure how to fix that problem, but before you go much further
>>you should know that RSpec does not yet run under 1.9. [...]
> I just ran across this (rspec, zentest 3.11.1, ruby 1.9.1-p0) and
> thought i'd follow up.
> It appears this is related to rubygems being loaded automatically in ruby
> 1.9... Cucumber (and rspec for that matter) contains an 'autotest' directory
> under /lib and it appears earlier in the load path than the ZenTest
> directories.
> As evidence, running the following gets past the error:
> $ ruby --disable-gems `which autotest`
> Of course that would then necessitate activating needed gems manually, which
> seems to be counter-productive if 1.9 is encouraging the opposite approach.
> It's not clear to me that this is a rspec or zentest bug - it might just as
> easily be a rubygems or ruby deficiency (couldn't 'load' just ignore
> directories?).

Sounds like Autotest's discovery process is going to need to be
revisited. rspec and rspec-rails each have their own subclasses of
Autotest, and the autotest executable decides what specific class to
load by combing the load path for "autotest/discover" - so rspec and
rspec-rails both need to have autotest directories to make that work.
Merb apps do the same.

> Unfortunately i'm not experienced enough with any of these libraries to know
> where to take this next.
> If anyone would point me in a direction, i'd be happy to keep digging.
> In the meantime, here's a hack to $RUBY_HOME/bin/autotest (the one generated
> by rubygems):
> @@ -19 +19,2 @@
> -load 'autotest'
> +zentest_gem_dir = Gem.source_index.find_name('ZenTest',
> version).first.full_gem_path
> +load File.join(zentest_gem_dir, 'bin', 'autotest')
> That is very likely the _wrong_ way to calculate zentest_gem_dir...  I
> googled and poked around but couldn't find any definitive API.  Any
> enlightenment on that would also be appreciated.

For a temp solution this seems reasonable to me. Anybody else have a
better idea?

> Cheers,
> lasitha
> --
> View this message in context: http://www.nabble.com/Ruby-1.9---autospec-loadpath-problem-tp20763177p22102148.html
> Sent from the rspec-users mailing list archive at Nabble.com.

More information about the rspec-users mailing list