Should I make plugin tests project-independent?

Hi,

I'm working on a patch for the official auto_complete plugin. I noticed that a lot of the new plugins (e.g. acts_as_tree) are set up to be testable outside of a rails project. Is this now considered best practice? If so I'll make that change while I'm working on the plugin.

Thanks, Krishna

Yes. However, there is no real official way to do it.

At some point there may be an official plugin_test_helper you'll be able to require. Maybe I'll look into this kind of thing this week.

I think it's preferable if you can assume that the rails gem is available. Some kind of plugin test helper would indeed be pretty nice though. Have it check for vendor/rails or a specific GEM version (or not, if it's an edge-only plugin).

Thanks for the quick response, Josh and Rick.

Krishna

We released a plugin/gem that provides support for this type of thing:

http://wiki.pluginaweek.org/Plugin_test_helper

We use it in many of our own plugins.

I should mention here are a few examples of its usage (besides the README):

http://svn.practical.cc/plugins/acts_as_tokenized http://svn.pluginaweek.org/trunk/plugins/active_record/attributes/encrypted_attributes