Missing Gems = Strange Rails Errors
I was working on a project for a client yesterday and kept getting a strange error message when I tried to run the unit tests.
I would type in "rake test:units" at the prompt and get the following:
test_helper.rb:18: undefined method `use_transactional_fixtures=' for Test::Unit::TestCase:Class (NoMethodError)
What? How could "use_transactional_fixtures" be undefined? I kept poking around and finally discovered I was missing a Ruby gem required by the project. Strange how it would generate the above error...
Bottom line, make sure you have all of your required gems installed and updated!
Comments
Howdy, I'm having the same problem. Mind sharing which gem you had to install?
Posted by: wuputah
|
May 10, 2006 10:20 AM
If I remember correctly, it was a gem called 'pdf-writer' - but I think this problem could be caused by any required gem that is missing.
Posted by: pdsphil
|
May 10, 2006 10:27 AM
Hmm, well I'm not using the PDF writer, so I don't think that's it. How did you figure out which gem was missing?
Posted by: wuputah
|
May 10, 2006 11:48 AM
In my case I had some documentation I was able to look at that listed the required gems. If you look at the "require" statements in your files, that should tell you what libraries you are loading. Some of them are gems. And "gem list --local" will show you what you have installed locally. That's what I would try.
Posted by: pdsphil
|
May 10, 2006 1:14 PM
Well, it was indeed a 'require' problem. I tested my code through other means and found that I had a few things out of place - not gems but just regular requires. It is truly strange that you don't get a better error when that happens. Very odd! Might be a good thing to report as a bug…
Posted by: wuputah
|
May 10, 2006 1:59 PM
We ran into this issue -- careful that libs are case sensitive, and failures do not bubble up. In this case one of our requires:
uri should have been URI
This is also common when including Rmagick not rmagick -- crazy!
Posted by: SeeBQ
|
June 19, 2006 3:42 PM
I'm working on fixing rake to give better error messages for problems like this: http://www.embracingchaos.com/2006/10/misleading_erro.html
Posted by: Leo Dirac
|
October 31, 2006 1:35 AM