开发者

Can't run Rails tests

I've reviewed the questions that seem to be relevant to my problem, and I can't find a solution. When I try to run the tests in a Rails 3.0.3 App, I get this error:

willmac:signalkit wbarrett$ rake test
(in /Users/wbarrett/Sites/signalkit)
LOADING CONFIG/ENVIRONMENT.RB
./test/unit/authentication_test.rb:3: uninitialized constant ActiveSupport (NameError)
    from /Users/wbarrett/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
    from /Users/wbarrett/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
    from /Users/wbarrett/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
    from /Users/wbarrett/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
./test/functional/authentications_controller_test.rb:3: uninitialized constant ActionController (NameError)
    from /Users/wbarrett/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
    from /Users/wbarrett/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
    from /Users/wbarrett/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
    from /Users/wbarrett/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
Errors running test:units, test:functionals!

As you can see, the tests are requirin开发者_Python百科g test_helper and requiring environment.rb (I added the LOADING.. output to the top of the environment.rb config file)

Here's my Gemfile:

source 'http://rubygems.org'

gem 'rails', '3.0.3'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'devise'
gem 'unicorn'
gem 'omniauth', :git => 'git://github.com/signalkit/omniauth.git', :branch => 'signalkit'
gem 'mongrel'
# gem 'tinder'
gem 'oauth2', :git => 'git://github.com/signalkit/oauth2.git', :branch => 'signalkit' #0.1.1 with modification for Basecamp
gem 'crack'
gem 'delayed_job'
gem "builder", "2.1.2"
gem "haml", "3.0.12"
gem "maruku", "0.6.0"
gem "RedCloth", "4.2.2"
gem "sinatra", "1.1.0", :require => "sinatra/base"
gem "monkeywrench"
gem "httparty"
gem "hoptoad_notifier"

group :test do
  gem "shoulda", "~> 2.11.3"
  gem "mocha", "~> 0.9.12"
  gem "webmock", "= 0.7.3"
  gem "test-unit"
end

What's wrong with this picture? Thanks all!

UPDATE: 6/30/2011 4:05PM CST

For whatever reason, changing the require at the top of all the test files from

require 'test_helper'

to

require File.dirname(__FILE__) + '/../test_helper'

solved my problem. +25 to whoever can tell me why this is, since the helper was being loaded fine the other way as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜