rspec error: `inherited': You cannot have more than one Rails::Application (RuntimeError)

Some background:

I set up my first rails app for testing with rspec, and everything
worked fine: I could run tests, etc. Then I created a second rails app
to play around with (and a third, fourth). But I can't get testing to
work with my second rails app. When I cd'ed to my second app's
directory
and did this:

$ bundle exec rspec spec/

it ran the tests for my first app. My first app has about 150 tests,
and my second app has 3 tests, so it was obviously not running the
correct tests. In an attempt to cure that problem, I did took these
steps:

1) I closed out all windows on my computer.
2) I restarted my computer.
3) I opened a terminal window and cd'ed into my second apps directory,
and then I did this:

$ bundle exec rpsec spec/

and I got this error:

No DRb server is running. Running in local process instead ...
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/application.rb:63:in
`inherited': You cannot have more than one Rails::Application
(RuntimeError)
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/deprecation.rb:7:in
`initialize'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/deprecation.rb:7:in
`new'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/deprecation.rb:7:in
`run'
  from
/Users/me/rails_projects/test_app/app/models/generate/config/environment.rb:9:in
`<top (required)>'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:454:in
`load'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:454:in
`block in load_file'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in
`new_constants_in'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:453:in
`load_file'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:340:in
`require_or_load'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:300:in
`depend_on'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:216:in
`require_dependency'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/engine.rb:138:in
`block (2 levels) in eager_load!'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/engine.rb:137:in
`each'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/engine.rb:137:in
`block in eager_load!'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/engine.rb:135:in
`each'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/engine.rb:135:in
`eager_load!'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/application.rb:108:in
`eager_load!'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/application/finisher.rb:41:in
`block in <module:Finisher>'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/initializable.rb:25:in
`instance_exec'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/initializable.rb:25:in
`run'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/initializable.rb:50:in
`block in run_initializers'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/initializable.rb:49:in
`each'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/initializable.rb:49:in
`run_initializers'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/application.rb:134:in
`initialize!'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/application.rb:77:in
`method_missing'
  from /Users/me/rails_projects/test_app/config/environment.rb:5:in
`<top (required)>'
  from /Users/me/rails_projects/test_app/spec/spec_helper.rb:14:in
`require'
  from /Users/me/rails_projects/test_app/spec/spec_helper.rb:14:in
`block in <top (required)>'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork.rb:24:in
`prefork'
  from /Users/me/rails_projects/test_app/spec/spec_helper.rb:4:in `<top
(required)>'
  from
/Users/me/rails_projects/test_app/spec/controllers/pages_controller_spec.rb:1:in
`require'
  from
/Users/me/rails_projects/test_app/spec/controllers/pages_controller_spec.rb:1:in
`<top (required)>'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in
`load'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in
`block in load_spec_files'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in
`map'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in
`load_spec_files'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:18:in
`run'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in
`run_in_process'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:66:in
`rescue in run'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:62:in
`run'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:11:in
`block in autorun'

cross posted here:

http://stackoverflow.com/questions/7290186/rspec-runs-the-tests-in-another-app

cross posted here:

http://stackoverflow.com/questions/7290186/rspec-runs-the-tests-in-another-app

Haven’t encountered that error before. But googling the error message gives quite a few useful results (i think) :smiley:

Jim ruther Nill wrote in post #1019886: