使用metriks进行耙子测试失败

时间:2015-06-15 17:50:42

标签: ruby rake

我下载了https://github.com/eric/metriks并做了

bundle install
gem install minitest

我仍然会收到以下错误:

$ rake test
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -I"lib:lib:test" -I"/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib" "/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb" "test/**/*_test.rb" 
Warning: you should require 'minitest/autorun' instead.
Warning: or add 'gem "minitest"' before 'require "minitest/autorun"'
From:
  /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/test/unit.rb:3:in `<top (required)>'
  /Users/purpletech/metriks/test/test_helper.rb:1:in `<top (required)>'
  /Users/purpletech/metriks/test/counter_test.rb:1:in `<top (required)>'
  /Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
  /Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb:9:in `each'
  /Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb:9:in `block in <main>'
  /Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb:4:in `select'
  /Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb:4:in `<main>'
MiniTest::Unit::TestCase is now Minitest::Test. From /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/test/unit/testcase.rb:8:in `<module:Unit>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/test/unit.rb:670:in `<class:Runner>': undefined method `_run_suite' for class `Test::Unit::Runner' (NameError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/test/unit.rb:255:in `<module:Unit>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/test/unit.rb:9:in `<module:Test>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/test/unit.rb:8:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/purpletech/metriks/test/test_helper.rb:1:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/purpletech/metriks/test/counter_test.rb:1:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
from /Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb:9:in `each'
from /Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb:9:in `block in <main>'
from /Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb:4:in `select'
from /Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb:4:in `<main>'
rake aborted!
Command failed with status (1): [ruby -I"lib:lib:test" -I"/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib" "/Library/Ruby/Gems/2.0.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb" "test/**/*_test.rb" ]

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

1 个答案:

答案 0 :(得分:0)

根据您的日志,测试使用的是当前MiniTest::Unit::TestCase的旧类名Minitest::Test。尝试用新名称替换旧名称。