On Fri, Mar 14, 2008 at 6:08 PM, Zach Dennis <[EMAIL PROTECTED]> wrote: > Pat mentioned that he uses very skinny controllers and does > integration tests which go through the whole stack to make sure things > work. So if he doesn't test the controller#action's because they are > too simple he at least will have a failing integration test if someone > breaks the implementation. > > The problem I have with what Pat is doing is that it takes a lot of > discipline from the developer to not let the controller grow into a > cesspool of logic and interaction that shouldn't be there, but you put > it there because you aren't "testing" it directly. From what I've seen > most Rails apps have important interaction in the controller actions > and logic in the before filters. I would not personally take this > approach on customer paid for software. Pat may be more disciplined > then me though. =)
The way to do this is to not put any business logic in the action, and the way to do THAT is to metaprogram the action away. Our controllers look like this: class PostsController < ApplicationController actions :show, :new, :create end with hooks for stuff like on_successful_create if the default behavior isn't sufficient. It feels pretty radical at first, but it just takes a bit of creativity to make it work. I find it to be a very elegant approach. Pat _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users