Rails 3 and Shoulda
I really want to use Rails 3 on a project that won't see a production server until at least July. So I went for it. After having to remind myself to check github for a rails3 branch on every gem I use, I only had one nemesis to defeat: Shoulda.
When you run rake test:units, shoulda says (or something similar):
.rvm/gems/ruby-1.9.1-p378/bundler/gems/shoulda-b78dbf514bbce3272023d3a4742474857c2eb3c3-rails3/lib/shoulda/autoload_macros.rb:40:in `join': can't convert #
Following some tips at RailsPlugins.org I got shoulda working. The problem happens long before your tests run. It's in the loading phase. Until our boys at thoughtbot get it working, we can work around it by manually loading shoulda with Bundler.
In test/test_helper.rb add:
1 |
Bundler.require(:shoulda) |
And in your Gemfile, move your gem shoulda line to it's own group, like this:
1 2 3 |
group :shoulda do gem 'shoulda', :git => "git://github.com/thoughtbot/shoulda.git", :branch => "rails3" end |
Just doing those simple things got shoulda working for me. Now I have to make all my tests pass.