[rspec-users] controller_name with dynamic controllers

Scott Taylor mailing_lists at railsnewbie.com
Mon Mar 19 02:21:57 EDT 2007


I'm writing a controller which should only be inherited from,  
something like the generic crud controller seen here: http:// 
geekonomics.blogspot.com/2006/07/crud-and-shared-controllers.html

Now, in my spec, I would like to create a controller which inherits  
from the generic CRUDController, without actually creating the  
controller.  This controller is *only* for testing.

How can I do this?  I can't do something like this:

Object.const_set("MyCrudController", Class.new(CRUDController))

because the method "controller_name" will complain of setting the  
constant twice.

Any ideas?

Best,

Scott Taylor



More information about the rspec-users mailing list