I'm reading the book Ruby on Rails 3 Tutorial, and as instructed I set up my rails app to use rspec for testing. Whenever I was instructed to, I created new tests, and the tests ran automatically using autotest and spork. Everything seemed to work fine. Then I created a second app in order to test some code, but when I ran a couple of tests in my second app with the command:
$ bundle exec rspec spec/
...the tests for the first app executed. How can run开发者_高级运维ning rspec in one app execute the tests in another app? I cd'ed to another directory, cd'ed back into the second app, and ran the tests again, but the same thing happened.
In an attempt to correct that sad state of affairs, I closed out every window on my computer, and then I restarted my computer. After my computer rebooted, I opened one Terminal window, cd'ed into the directory for the second app, and once again I issued the command:
$ bundle exec rspec spec/
Now I get an error that says, "You cannot have more than one Rails::Application (RuntimeError)":
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)
Is there something obvious I'm missing? The setup was laborious for the first app, and I tried to repeat the same setup for my second app, but I can't get any tests to run. Both apps have identical Gemfiles.
osx 10.6.7
You can name your app test_app. It's probably something with drb/spork. Post your spec_helper.rb. Also, take out the drb option out of spec_helper.rb, comment out the Spork config, copy what is in the prefork block back to the bottom of the spec_helper file (where it used to be). Run rspec spec without bundle exec. If that doesn't work, run one test with rspec/spec/some_file.rb.
精彩评论