Errors while testing a Rails application
I'm new to RoR and I'm trying to test my app.
In my sample app, I have in user_test.rb:
require 'test_helper'
class UserTest < ActiveSupport::TestCase
def test_truth
assert true
end
end
The error I'm getting is:
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': uninitial开发者_JS百科ized 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
I can't find what I've done wrong.
Thanks in advance.
Rails includes test-unit. If you also have the Test-unit gem installed, you will get a conflict between the two. Simply uninstall the gem and your tests should start working.
This is because you've installed a too new version of test-unit. Try uninstalling it, that should fix your issue.
精彩评论