uninitialized constant Test::Unit::TestResult::TestResultFailureSupport Error

Today trying to run my RSpec tests and I get an odd error:

uninitialized constant Test::Unit::TestResult::TestResultFailureSupport (NameError)
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:105:in `const_missing’
/usr/local/lib/ruby/gems/1.8/gems/test-unit-2.0.3/lib/test/unit/testresult.rb:28
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require’
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require’
….

After doing some research online I found out that the issue is caused by Shoulda and Mocha being included in my app. It seems that if you put a gem dependence for Shoulda before Mocha,  you’ll get this error, so the fix is to place the gem dependence for Mocha before Shoulda.

config.gem “rspec”, :lib => false, :version => “>=1.2.6″
config.gem “rspec-rails”, :lib => ‘spec/rails’, :version => “>=1.2.6″
config.gem “mocha”
config.gem “thoughtbot-shoulda”, :lib => “shoulda”, :source => “http://gems.github.com”

Hope that helps

UPDATE:

I hit the same error having shoulda in my environment.rb file, moving it to the test.rb (in environment folder) fixed the issue as well.

Learn More

Error with fsevent and autospec (on Mac)

Today I’ve upgraded my gems and noticed that when running my autospec I get an odd error:

[01:09:25 /usr/local/lib/ruby/gems/1.8/gems/ruby-ole-1.2.10/lib/ole/storage/base.rb:146:load]

WARN   root name was “R”

And my autospec would keep printing out:
sh: line 1:  6303 Trace/BPT trap          /usr/local/lib/ruby/gems/1.8/gems/autotest-fsevent-0.1.2/fsevent/darwin/fsevent_sleep ‘/Users/andrew/rails_apps/example_com’ 2>&1
sh: line 1:  6307 Trace/BPT trap          /usr/local/lib/ruby/gems/1.8/gems/autotest-fsevent-0.1.2/fsevent/darwin/fsevent_sleep ‘/Users/andrew/rails_apps/example_com’ 2>&1
Unfortunately I don’t have the time to look into the fsevent code to see if I can make a work around, however I found that you can remove the gem (‘sudo gem uninstall autotest-fsevent‘) and install the older version (‘sudo gem install autotest-fsevent --version 0.1.1‘)
Hopefully this helps someone out!
UPDATE: I forgot to mention I was using a Mac OS X 10.5.8, and based on the History.txt they made changes effecting Macs.
UPDATE 2 (Oct 22, 09): It seems that the same issue exists in fsevent 0.1.3 as well
UPDATE 3 (Mar 05, 2010): Issue still present in 0.2.1 however I found out that the error is only for OS X 10.5 and will not happen on OS X 10.6.
The full error message is:

/usr/local/lib/ruby/gems/1.8/gems/autotest-fsevent-0.2.1/fsevent/darwin/fsevent_sleep ; exit;
~%  /usr/local/lib/ruby/gems/1.8/gems/autotest-fsevent-0.2.1/fsevent/darwin/fsevent_sleep ; exit;
dyld: unknown required load command 0x80000022
zsh: trace trap

The only work around (outside of downgrading to version 0.1.1) is to copy fsevent_sleep from version 0.1.1 to version 0.2.1. However I’m not sure how stable that solution is.

Learn More