I'm having problems running my Rails unit tests via autotest using Test::Unit 2.0.6. Running tests via rake test:units
works perfectly, but when I run the tests from autotest, I get this:
/Code/projectdir/vendor/rails/activesupport/lib/active_support/dependencies.rb:105:in `const_missing': uninitialized constant Test::Unit::TestResult::TestResultFailureSupport (NameError) from /Library/Ruby/Gems/1.8/gems/test-unit-2.0.6/lib/test/unit/testresult.rb:28 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' from /Code/projectdir/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require' from /Libr开发者_开发问答ary/Ruby/Gems/1.8/gems/test-unit-2.0.6/lib/test/unit/ui/testrunnermediator.rb:9 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' from /Code/projectdir/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require' from /Library/Ruby/Gems/1.8/gems/test-unit-2.0.6/lib/test/unit/ui/console/testrunner.rb:11 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' from /Code/projectdir/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/autorunner.rb:25 from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/autorunner.rb:214:in `[]' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/autorunner.rb:214:in `run' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit.rb:278 from -e:1
Versions:
- Mac OS X 10.6.3
- ruby 1.8.7 (2009-06-08 patchlevel 173) [universal-darwin10.0]
- Rails 2.3.5 (based on Suspenders)
- autotest (4.3.2)
- autotest-fsevent (0.1.3)
- autotest-growl (0.1.7)
- autotest-rails (4.1.0)
- ZenTest (4.3.3)
- test-unit (2.0.6)
The problem also occurs with test-unit 2.0.9. I've tried the suggestions in Getting uninitialized constant error when trying to run tests and at http://floehopper.lighthouseapp.com/projects/22289-mocha/tickets/50, but still no luck.
Autotest works just fine if I remove the assertions that require Test::Unit 2.x and remove the test-unit gem. Unfortunately, I need to use the 2.x assertions.
Any ideas? Thanks in advance for any assistance.
I'm having the same problem: tests work fine when run from rake. But when I try autotest I get the same errror:
`const_missing': uninitialized constant Test::Unit::TestResult::TestResultFailureSupport (NameError)
I'm running shoulda 2.10.3, mocha 0.9.8, and test-unit 2.1.0. I had already monkeyed around with gem loading order to make mocha and shoulda happy and as I said things are fine with rake test. I've tried multiple versions of ZenTest (4.3.3, 4.1.1). I've tried a standalone version of autotest (4.3.2). Same results. I've tried using test-unit 1.2.3 instead of 2.1.0 but that breaks other parts of my tests.
I ran into a similar issue, and while I know this is really late, the problem was that I didn't have autotest-rails installed.
精彩评论