title: "uninitialized constant" when running RSpec tests with Rails 2.3.8 and Bundler
body: <p>I just changed my Rails 2.3.8 project to load gems using Bundler, rather than the default Rails 2.3 loading mechanism. I followed <a href="http://gembundler.com/rails23.html" rel="nofollow noreferrer">the official instructions</a> and the site runs fine in development. I use RVM for gem management, and have a specific gemset loaded for the application.</p>
  
  <p>My RSpec test suite is unable to run, however. I have tried running both the entire suite and single tests using a variety of commands:</p>
  
  <pre><code>autospec # My usual way of running tests
  rake spec
  spec .
  spec spec/models/comment_spec.rb # Trying a single spec file in isolation
  ruby spec/models/comment_spec.rb
  </code></pre>
  
  <p>I have also tried running them all prefixed with <code>bundle exec</code>. Everything returns the same error:</p>
  
  <pre><code>/Users/casper/.rvm/gems/ruby-1.8.7-p248@darebusters/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant InheritedResources::Base (NameError)
      from /Users/casper/.rvm/gems/ruby-1.8.7-p248@darebusters/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:80:in `const_missing_not_from_s3_library'
      from /Users/casper/.rvm/gems/ruby-1.8.7-p248@darebusters/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing'
      from /Users/casper/Projects/cf/darebusters/app/controllers/admin/base_controller.rb:1
      from /Users/casper/.rvm/gems/ruby-1.8.7-p248@darebusters/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:158:in `require'
      from /Users/casper/.rvm/gems/ruby-1.8.7-p248@darebusters/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:158:in `require'
      from /Users/casper/.rvm/gems/ruby-1.8.7-p248@darebusters/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:265:in `require_or_load'
      from /Users/casper/.rvm/gems/ruby-1.8.7-p248@darebusters/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:224:in `depend_on'
      from /Users/casper/.rvm/gems/ruby-1.8.7-p248@darebusters/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:136:in `require_dependency'
      from /Users/casper/.rvm/gems/ruby-1.8.7-p248@darebusters/gems/rails-2.3.8/lib/initializer.rb:414:in `load_application_classes'
      from /Users/casper/.rvm/gems/ruby-1.8.7-p248@darebusters/gems/rails-2.3.8/lib/initializer.rb:413:in `each'
      from /Users/casper/.rvm/gems/ruby-1.8.7-p248@darebusters/gems/rails-2.3.8/lib/initializer.rb:413:in `load_application_classes'
      from /Users/casper/.rvm/gems/ruby-1.8.7-p248@darebusters/gems/rails-2.3.8/lib/initializer.rb:411:in `each'
      from /Users/casper/.rvm/gems/ruby-1.8.7-p248@darebusters/gems/rails-2.3.8/lib/initializer.rb:411:in `load_application_classes'
      from /Users/casper/.rvm/gems/ruby-1.8.7-p248@darebusters/gems/rails-2.3.8/lib/initializer.rb:197:in `process'
      from /Users/casper/.rvm/gems/ruby-1.8.7-p248@darebusters/gems/rails-2.3.8/lib/initializer.rb:113:in `send'
      from /Users/casper/.rvm/gems/ruby-1.8.7-p248@darebusters/gems/rails-2.3.8/lib/initializer.rb:113:in `run'
      from /Users/casper/Projects/cf/darebusters/config/environment.rb:9
      from /Users/casper/Projects/cf/darebusters/spec/spec_helper.rb:5:in `require'
      from /Users/casper/Projects/cf/darebusters/spec/spec_helper.rb:5
      from spec/models/comment_spec.rb:1:in `require'
      from spec/models/comment_spec.rb:1
  </code></pre>
  
  <p>I'm pretty sure the problem is not related to the Inherited Resources gem - I think gems are not loaded at all at this point, and Inherited Resources just happens to be the first one needed.</p>
  
  <p>The thing that's baffling me is that <code>/activesupport-2.3.8/lib/active_support/dependencies.rb:158</code> requires <code>/app/controllers/admin/base_controller</code> during the initialization phase. It shouldn't do that, and it certaintly doesn't do it in development mode. I can comment out <code>gem 'inherited_resources'</code> in my Gemfile, and site still runs. It's not until I hit an action that loads a controller that use Inherited Resources I get the "uninitialized constant" error.</p>
  
  <p>For clarity, here's my <a href="http://gist.github.com/482712" rel="nofollow noreferrer">Gemfile and spec_helper.rb</a>.</p>