For the longest time, I wasn’t able to run autotest on one of my projects. That was OK; I was intrigued by autotest, but had never really committed to it. The problem: whenever I would try to run autotest, I’d get the following error:
loading autotest/rails_rspec
Autotest style autotest/rails_rspec doesn't seem to exist. Aborting.
I’m running Shoulda, not RSpec, so I had no idea why this was happening. I tried installing (and uninstalling) RSpec in various configurations, to no avail. Nothing worked.
Then I started a new project. Autotest worked just fine on it. After a few days, I got used to autotest, and a few days later, I came to really like it. It helps me get into a TDD “flow” – all tests pass; write failing tests; write code; all tests pass.
So when I came back to my previous project where autotest didn’t work, I decided to dig deeper. Eventually I found a plugin that was causing the problem: acts-as-taggable-on. The plugin was written to allow autotesting, as explained in a blog post. Supposedly, this is supposed to be a different autotest instance from your app’s main instance, but it wasn’t working that way for me.
The fix? Delete lib/discover.rb from the acts-as-taggable-on plugin. That’s it – autotest works now.
In the end, I maybe could have solved the problem by getting RSpec configured properly, but just running the gem locally didn’t do the trick for me, and I don’t want to add any code to my app to support autotesting of a plugin that I never want to test.
So should plugins even ship with test code? Yes, they should. Not for normal use; I never run plugin tests, assuming instead that the plugin is tested by the author. But if an open source plugin ships without tests, it’s that much harder for other developers to fork/fix/improve the plugin. But really, that’s about the only reason for plugin/gem tests. And they should never touch application tests.


Just wanted to let you know that the autotest code has been removed from the latest patch version of acts-as-taggable-on. I had meant to remove it a long time ago (had similar problems reported with Shoulda on subdomain-fu) but never got around to it.
I just wish autotesting plugins was easier generally, then these kinds of issues wouldn’t crop up!
This sounds more like a bug/over-excited-feature of ZenTest/autotest rather than the fault of the plugin/gem.
Michael: thanks for the quick response, and for the useful plugin!
Dr. Nic: yeah, I haven’t taken the time to dig into why autotest is picking this up. Overagressive on autotest’s part, or on the plugin’s part? I’d be interested to find out.
for what it’s worth, that’s a feature of autotest, not a bug—looking for discover.rb files in subdirs to help it decide what to (auto)test.
and, i agree that usually you don’t want to test plugins in the same breath as your app. Except for the case of Engine plugins, where the plugin is kind of part of your app—especially while you’re developing the engine/plugin itself. In that case, since it’s got controllers and models and views, you might want to autotest that alongside your app. (i wrote about how, http://code.whatcould.com/2009/02/09/gentlemen-test-your-engines.html)