NoMethodError:rails测试文件中的未定义方法`ActiveSupport'

时间:2015-03-28 16:07:57

标签: ruby-on-rails ruby

我升级了ruby&今天铁路(2.2.0,4.2.1)。

在`app / test / models / user_test.rb'

require 'test_helper'

class UserTest < ActiveSupport:TestCase
    test 'the truth' do
      assert false
    end
end 

我跑了耙db:test:prepare然后rake test

rake aborted!
NoMethodError: undefined method `ActiveSupport' for main:Object
/Users/quantum/sonar/app/test/models/user_test.rb:3:in `<top (required)>'

全新的Rails项目。我错过了什么?

app/test/testhelper:

ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'

class ActiveSupport::TestCase
  # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
  fixtures :all

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

1 个答案:

答案 0 :(得分:0)

尝试使用此命令。希望它有所帮助。

rake db:migrate RAILS_ENV=test