测试任务有什么问题? RAILS RAKE

时间:2011-04-27 07:31:37

标签: ruby-on-rails testing rake

测试框架有什么问题?我只是为模型编写测试代码。

分别运行每个单独的测试时,它们工作正常
cd test
ruby ./unit/model_name_test.rb

但是现在我想通过使用像

这样的rake测试任务一次运行所有测试
$ bundle exec rake test -t

我收到错误消息ActiveSupport未初始化..请参阅下面的详细信息。

RAILS VERSION:3.0.7 RAKE VERSION:0.8.7

(in /Users/lewisou/Workspaces/scs)
** Invoke test (first_time)
** Execute test
** Invoke test:units (first_time)
** Invoke test:prepare (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment 
** Execute db:test:purge
** Execute db:test:load
** Invoke db:schema:load (first_time)
** Invoke environment 
** Execute db:schema:load
** Execute test:prepare
** Execute test:units
./test/unit/assign_test.rb:3: uninitialized constant ActiveSupport (NameError)
    from /Users/lewisou/.rvm/gems/ree-1.8.7-2011.03@scs/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
    from /Users/lewisou/.rvm/gems/ree-1.8.7-2011.03@scs/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
    from /Users/lewisou/.rvm/gems/ree-1.8.7-2011.03@scs/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
    from /Users/lewisou/.rvm/gems/ree-1.8.7-2011.03@scs/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
** Invoke test:functionals (first_time)
** Invoke test:prepare 
** Execute test:functionals
** Invoke test:integration (first_time)
** Invoke test:prepare 
** Execute test:integration
Errors running test:units!

这是我的test_helper.rb

ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'ext/ruby-ole'
require "#{Rails.root}/db/seeds.rb"

class ActiveSupport::TestCase
  # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
  #
  # Note: You'll currently still have to declare fixtures explicitly in integration tests
  # -- they do not yet inherit this setting
  # fixtures :all

  # Add more helper methods to be used by all tests here...
end

0 个答案:

没有答案