2012-02-04 66 views
5

我只是克隆了GitHub上轨的源代码,并试图运行测试套件...我得到重大故障:试图运行“耙测试”轨道内的源代码

[email protected]:~/coding/rails/rails(master)>bundle exec rake test --trace 
** Invoke test (first_time) 
** Execute test 
/Users/patrick/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -w -I"lib:test" -I"/Users/patrick/.rvm/gems/[email protected]_patch/gems/rake-0.9.2.2/lib" "/Users/patrick/.rvm/gems/[email protected]_patch/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/**/*_test.rb" 
/Users/patrick/coding/rails/rails/activesupport/lib/active_support/test_case.rb:20:in `<class:TestCase>': undefined method `register_spec_type' for ActiveSupport::TestCase:Class (NoMethodError) 
    from /Users/patrick/coding/rails/rails/activesupport/lib/active_support/test_case.rb:11:in `<module:ActiveSupport>' 
    from /Users/patrick/coding/rails/rails/activesupport/lib/active_support/test_case.rb:10:in `<top (required)>' 
    from /Users/patrick/coding/rails/rails/activesupport/test/benchmarkable_test.rb:3:in `<top (required)>' 
    from /Users/patrick/.rvm/gems/[email protected]_patch/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `require' 
    from /Users/patrick/.rvm/gems/[email protected]_patch/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>' 
    from /Users/patrick/.rvm/gems/[email protected]_patch/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `each' 
    from /Users/patrick/.rvm/gems/[email protected]_patch/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `block in <main>' 
    from /Users/patrick/.rvm/gems/[email protected]_patch/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `select' 
    from /Users/patrick/.rvm/gems/[email protected]_patch/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `<main>' 
rake aborted! 
Command failed with status (1): [/Users/patrick/.rvm/rubies/ruby-1.9.2-p180...] 

Tasks: TOP => test 
(See full trace by running task with --trace) 

而且还有很多更多类似的错误输出后,看起来相当相同,所以我不会在这里粘贴它...

有谁知道我怎么能得到这些测试运行?

回答

9

你正在ruby 1.9.2下运行。 rails master分支(又名Rails 4)需要Ruby 1.9.3或更高版本。缺少的方法register_spec_type将由ruby 1.9.3解决。

我看你使用的是RVM,这很棒。这将使升级到1.9.3容易...

取决于多大您的RVM的副本,您可能需要对其进行升级:

$ rvm get stable 

然后,请确保您有红宝石1.9。 3安装和正在使用它:

$ rvm install 1.9.3 
$ rvm use 1.9.3 

你可能需要重新安装所有的宝石在包:

$ bundle install 

现在,你应该能够与成功运行测试:

$ bundle exec rake test 
+1

请不要做'RVM获得head',使用'RVM GET latest'更新到最新发布的版本,而不是发展的头。 – 2012-02-07 01:04:56

+0

谢谢@AndrewMarshall,很好。我已更新上述答案以反映您的建议。 – scottwb 2012-02-07 03:52:27

+1

'rvm get latest'已被弃用。 “rvm变得稳定”显然是新的热点。 – 2012-05-10 08:42:29