[rspec-users] Writing specs pointed out I need to refactor my admin area

Fernando Perez lists at ruby-forum.com
Sat May 23 13:42:28 EDT 2009


Hi,

My app now nearly has 100% coverage and when refactoring the code,
potential bugs are immediately pointed out. So that's a big win.

Moreover when writing specs for my controllers and views of the admin
zone, I quickly realized that I was often copying/pasting code and
tests. That annoyed me. Controller LOC: 700, associated tests LOC:
1500!!! That's stupid!

So I wrote an AdminController from which my other controllers inherit
from, and that enables me to drastically cut down the lines of redundant
code in the controller. But then what to do with the views? I still need
to make sure they get rendered correctly, so I still can cut down on the
tests.

One solution I see is to write an abstract set of views that controllers
will be using, but for some reason I think it will blow in my façe at
some point. Some views need to display images others don't, some display
a table others don't, etc.

What do you guys do for your admin zone to make sure it is well covered
with tests and that don't feel redundant? Do you use something like
Steamlined or ActiveScaffold?


Regards,
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list