Bulk Defining moles

0 views
Skip to first unread message

Ana Nelson

unread,
Sep 24, 2007, 6:58:00 AM9/24/07
to MOle Plugin
I have set up my mole.conf like this:

[:index, :list, :show, :create, :update, :export, :search ... (common
action names)].each do |action|
[
ClientsController,
CountriesController,
....
].each do |controller|
if controller.method_defined?(action)
controller.before(:feature => action) do |context, feature,
*args|
Mole::DbMole.mole_it(context, feature,
context.session[:current_user], args)
end
end
end
end

I am looking for comprehensive usage information for a small, internal
application and this seemed simpler than going through each controller
and manually entering action names. Also, I use active scaffold quite
a lot in this app so those are basic active scaffold action names
which would be common to most of my controllers (which makes it easy).

And, yes, Mole is fantastic for testing! A few of my controllers were
rather out of date and didn't have full test coverage (tsk tsk), and
Mole picked up problems as soon as I started up the server.

Anyway, I am posting this to see if anyone else has a better way of
automatically mole-ing an entire app, or if this is a bad idea for a
reason I haven't thought of.

Fernand Galiana

unread,
Sep 26, 2007, 3:15:57 PM9/26/07
to mole-...@googlegroups.com
Hi Ana,

   This is fine. The only reason why we did not provide a framework
   for doing the mass 'moling' was that some action may not be interesting
   to mole for a given controller but also some actions may have a different
   state or params that you may want to 'mole' and that would not fit to well
   in the bulk 'moling' example...

-Fernand

Eric Pugh

unread,
Sep 27, 2007, 12:59:44 PM9/27/07
to MOle Plugin
How did you measure the test coverage? Did you start the application
up under rcov or something?

On Sep 26, 3:15 pm, "Fernand Galiana" <fernand.gali...@gmail.com>
wrote:


> Hi Ana,
>
> This is fine. The only reason why we did not provide a framework
> for doing the mass 'moling' was that some action may not be interesting
> to mole for a given controller but also some actions may have a different
> state or params that you may want to 'mole' and that would not fit to
> well
> in the bulk 'moling' example...
>
> -Fernand
>

Reply all
Reply to author
Forward
0 new messages