2012-02-04 91 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