我在使用 Test::Unit 2.0.6 通过自动测试运行 Rails 单元测试时遇到问题。通过运行测试rake test:units
完美,但是当我从自动测试运行测试时,我得到了这个:
/Code/projectdir/vendor/rails/activesupport/lib/active_support/dependencies.rb:105:in `const_missing': 未初始化常量 Test::Unit::TestResult::TestResultFailureSupport (NameError) 来自 /Library/Ruby/Gems/1.8/gems/test-unit-2.0.6/lib/test/unit/testresult.rb:28 来自 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 来自 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' 来自 /Code/projectdir/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require' 来自 /Library/Ruby/Gems/1.8/gems/test-unit-2.0.6/lib/test/unit/ui/testrunnermediator.rb:9 来自 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 来自 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' 来自 /Code/projectdir/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require' 来自 /Library/Ruby/Gems/1.8/gems/test-unit-2.0.6/lib/test/unit/ui/console/testrunner.rb:11 来自 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 来自 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' 来自 /Code/projectdir/vendor/rails/activesupport/lib/active_support/dependencies.rb:158:in `require' 来自/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/autorunner.rb:25 来自 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/autorunner.rb:214:in `[]' 来自 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/autorunner.rb:214:in `run' 来自 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run' 来自/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/test/unit.rb:278 从 -e:1
版本:
- Mac OS X 10.6.3
- ruby 1.8.7 (2009-06-08 patchlevel 173) [universal-darwin10.0]
- Rails 2.3.5(基于 Suspenders)
- 自动测试 (4.3.2)
- 自动测试 fsevent (0.1.3)
- 自动测试咆哮(0.1.7)
- 自动测试导轨(4.1.0)
- 禅测 (4.3.3)
- 测试单元(2.0.6)
测试单元 2.0.9 也会出现此问题。我已经尝试了在尝试运行测试时出现未初始化的常量错误和http://floehopper.lighthouseapp.com/projects/22289-mocha/tickets/50中的建议,但仍然没有运气。
如果我删除需要 Test::Unit 2.x 的断言并删除 test-unit gem,自动测试就可以正常工作。不幸的是,我需要使用 2.x 断言。
有任何想法吗?提前感谢您的任何帮助。