Writing tests for plugins

I’ve been googling around trying to find some tips on creating tests for
plugins. Am I correct in assuming that I’d have to have the tests as
part of a rails app in order to test the plugin? I’d like to find a way
to do standalone tests for the plugin.

On May 2, 2006, at 11:59 AM, Chris H. wrote:

Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Chris-

It really depends on what sort of plugin you are creating. But you

can take a look at a few of my plugins to see how I test one of them
without rails and another with fixtures and all.

acl_system does all its tests without the need for rails at all. It
even has a mock controller object so you can test before filters and
such without a full rails env.

http://opensvn.csie.org/ezra/rails/plugins/dev/acl_system2/

ez_where is a think layer of ruby syntax sugar for
ActiveRecord :condition building. It has fixtures and other stuff
that ties into rails testing.

http://opensvn.csie.org/ezra/rails/plugins/dev/ez_where/

Hopefully you can learn a little bit from the tests in these plugins.

-Ezra

Ezra,
I just checked out the ez_where testing methods and am very
impressed. I like the way sqlite is used in memory and then the
fixtures are loaded as in a normal rails env. It allows for complete
testing but with it all contained in the plugin without stepping on
the app.
Thanks for pointing these out as ways to learn.

Zack

One more thing… if anyone can point me to more examples of testing
controllers in plugins that would be great.

Thanks,
Zack