Rails Unit Tests: uninitialized constant error
Wed Oct 28 06:59:45 -0700 2009
Rails doesn’t play well with test-unit 2.x… if you try you get something like: Test::Unit::TestResult::TestResultFailureSupport on from /Library/Ruby/Gems/1.8/gems/test-unit-2.0.5/lib/test/unit/testresult.rb:28
If you are getting something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
mikel@baci.local ~/rails_programs/rails/actionmailer
$ rake test
(in /Users/mikel/rails_programs/rails/actionmailer)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:test" "/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/adv_attr_test.rb" "test/asset_host_test.rb" "test/delivery_method_test.rb" "test/mail_helper_test.rb" "test/mail_layout_test.rb" "test/mail_render_test.rb" "test/mail_service_test.rb" "test/quoting_test.rb" "test/test_helper_test.rb" "test/tmail_test.rb" "test/url_test.rb"
DEPRECATION WARNING: ActiveSupport::DeprecatedCallbacks has been deprecated in favor of ActiveSupport::Callbacks. (called from included at /Users/mikel/rails_programs/rails/actionmailer/lib/../../actionpack/lib/../../activesupport/lib/active_support/testing/setup_and_teardown.rb:7)
/Users/mikel/rails_programs/rails/actionmailer/lib/../../actionpack/lib/../../activesupport/lib/active_support/dependencies.rb:116:in `const_missing': uninitialized constant Test::Unit::TestResult::TestResultFailureSupport (NameError)
from /Library/Ruby/Gems/1.8/gems/test-unit-2.0.5/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 /Users/mikel/rails_programs/rails/actionmailer/lib/../../actionpack/lib/../../activesupport/lib/active_support/dependencies.rb:167:in `require'
from /Users/mikel/rails_programs/rails/actionmailer/lib/../../actionpack/lib/../../activesupport/lib/active_support/dependencies.rb:537:in `new_constants_in'
from /Users/mikel/rails_programs/rails/actionmailer/lib/../../actionpack/lib/../../activesupport/lib/active_support/dependencies.rb:167:in `require'
from /Library/Ruby/Gems/1.8/gems/test-unit-2.0.5/lib/test/unit/ui/testrunnermediator.rb:9 |
Then you need to downgrade from test-unit 2.x to test-unit 1.2.3 or so.
1 2 |
# gem uninstall test-unit # gem install test-unit -v 1.2.3 |
Enjoy




Wed Nov 04 18:40:46 -0800 2009
I’ve noticed the same thing. This is a pain in the butt, especially with gems that install the latest test-unit as a dependency. Does anybody know if this is a problem with Rails 2.3.x? (I’m using 2.2.2)
Fri Nov 20 02:03:43 -0800 2009
Evne in Rails 2.3.4, I’m having this same issue and scratching google to figure out but none is helpful.