I am trying to re-write a unit test cases for a web application for the test cases is not updated for long. The following is the error that I get when I run 'rake test'.
Note: the web application is upgraded from 2.3.1 to 2.3.8 in mean while.
And the following is the stacktrace:
Loaded suite /apps/rails/website/install/local/ruby-1.8.7-p299/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
/apps/rails/website/install/local/ruby-1.8.7-p299/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant Mocha::Integration (NameError)
from /apps/rails/website/install/local/ruby-1.8.7-p299/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:80:in `const_missing'
from /apps/rails/website/install/local/ruby-1.8.7-p299/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/testing/setup_and_teardown.rb:51:in `run'
from /apps/rails/website/install/local/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
from /apps/rails/website/install/local/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
from /apps/rails/website/install/local/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
from /apps/rails/website/install/local/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
from /apps/rails/website/install/local/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
from /apps/rails/website/install/local/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
from /apps/rails/website/install/local/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in `run_suite'
from /apps/rails/website/install/local/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in `start_mediator'
from /apps/rails/website/install/local/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in `start'
from /apps/rails/website/install/local/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in `run'
from /apps/rails/website/install/loca开发者_运维问答l/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'
from /apps/rails/website/install/local/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
from /apps/rails/website/install/local/ruby-1.8.7-p299/lib/ruby/1.8/test/unit.rb:279
from /apps/rails/website/install/local/ruby-1.8.7-p299/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
please help me in this regard.
This helped me in this regard:
require 'mocha'
require 'mocha/integration/test_unit'
To be done in the test file, or in a helper if you are including one.
I had the same error, and re-installing of all gems helped me.
精彩评论