Forum: Ruby on Rails Writing tests for plugins

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2d52c69580d87a6e570637a48ee82b09?d=identicon&s=25 Chris Hartjes (Guest)
on 2006-05-02 20:59
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.
6076c22b65b36f5d75c30bdcfb2fda85?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-05-03 19:05
(Received via mailing list)
On May 2, 2006, at 11:59 AM, Chris Hartjes wrote:

> Rails mailing list
> Rails@lists.rubyonrails.org
> 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
C4dc94c893471878a105761a9207f29b?d=identicon&s=25 Zack Chandler (Guest)
on 2006-05-03 19:06
(Received via mailing list)
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
C4dc94c893471878a105761a9207f29b?d=identicon&s=25 Zack Chandler (Guest)
on 2006-05-03 19:06
(Received via mailing list)
One more thing.. if anyone can point me to more examples of testing
controllers in plugins that would be great.

Thanks,
Zack
This topic is locked and can not be replied to.