我是RoR的新手,我正在尝试测试我的应用。
在我的示例应用中,我有user_test.rb:
require 'test_helper'
class UserTest < ActiveSupport::TestCase
def test_truth
assert true
end
end
我得到的错误是:
Z:\web\rails\pbbg\test>ruby unit/user_test.rb
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_support/dependenci
es.rb:105:in `const_missing': uninitialized constant Test::Unit::TestResult::Tes
tResultFailureSupport (NameError)
from c:/ruby/lib/ruby/gems/1.8/gems/test-unit-2.0.3/lib/test/unit/testre
sult.rb:28
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `ge
m_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `re
quire'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo
rt/dependencies.rb:158:in `require'
from c:/ruby/lib/ruby/gems/1.8/gems/test-unit-2.0.3/lib/test/unit/ui/tes
trunnermediator.rb:9
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `ge
m_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `re
quire'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/active_suppo
rt/dependencies.rb:158:in `require'
... 6 levels...
from c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:214:in `run'
from c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
from c:/ruby/lib/ruby/1.8/test/unit.rb:278
from unit/user_test.rb:3
我找不到我做错了什么。
提前致谢。
答案 0 :(得分:0)
这是因为你安装了一个太新版本的测试单元。尝试卸载它,这应该可以解决您的问题。
答案 1 :(得分:0)
Rails包括测试单元。如果您还安装了Test-unit gem,则两者之间会发生冲突。只需卸载gem,您的测试就应该开始工作了。