Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Vendorised gems (e.g. rspec-rails) not recognised as being installed

#2682

I've got rspec and rspec-rails unpacked in vendor/gems and the dependencies defined in environments/test.rb (as specified here[1]). I checked out my project to a machine that doesn't have gems installed and tried to run the rake test tasks. The result was a warning that rspec-rails wasn't installed.

$ rake spec
...
Missing these required gems:
  rspec-rails  = 1.2.0

It took a while but I managed to work that this was because rspec-rails depends upon rack and rack wasn't installed. It took so long because the Gem::LoadError exception (raised because rack was missing) is swallowed within Rails::GemDependency#add_load_paths.

The attached patch amends an existing test that exposes this behaviour and implements a very lightweight fix in the form of a warning. With the patch applied, the output looks something like this.

$ rake spec
*** WARNING: Missing dependency 'rack' (>= 0.4.0) required by 'rspec-rails'
Missing these required gems:
  rspec-rails  = 1.2.0

[1] http://wiki.github.com/dchelimsky/rspec/configgem-for-rails

Reported by Chris Roos · May 20th, 2009 @ 03:08 PM

State: invalid
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Tom Ward
    Tom Ward

    I've encountered this issue too. Giving a warning is the least I'd expect. The patch looks good to me, so +1.

    May 20th, 2009 @ 03:14 PM

  2. James Mead
    James Mead

    Swallowing exceptions is nasty. The patch looks good. +1 from me.

    May 20th, 2009 @ 03:25 PM

  3. James Andrews
    James Andrews

    I've had this problem too. Patch looks good. +1

    May 20th, 2009 @ 03:28 PM

  4. Chris Roos
    Chris Roos
    • Tag changed from gem, gem_dependency, rspec_rails to gem, gem_dependency, rspec_rails, verified

    May 20th, 2009 @ 03:36 PM

  5. Matt Jones
    Matt Jones
    1. Good catch - this bit of Rails is somewhat notorious for unhelpful error messages.

    June 6th, 2009 @ 11:32 PM

  6. Felipe Rodrigues
    Felipe Rodrigues

    I have a similar case where the patch didn't work as expected.

    #2913 config.gem causes error in some gems

    July 16th, 2009 @ 04:42 PM

  7. Rizwan Reza
    Rizwan Reza
    • State changed from new to invalid

    This isn't applicable anymore, as Rails now uses Bundler. If you think it's a bug that should be addressed in 2-3-stable, let me know and I'll have someone apply it. Thanks.

    January 25th, 2010 @ 12:49 AM