Zach Dennis wrote: > Can someone change this implementation and still have your tests pass, > but have the implementation be broken? If they can then yes it is > worth the 40 lines. > > 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. =) > >
I totally agree with this point. Using interaction-based testing really helps in forcing the logic down into the model. I'm curious about your comment: "From what I've seen most Rails apps have important interaction in the controller actions and logic in the before filters". What are you exactly referring to? I generally use before filters for authentication... How have you seen them abused? -Ben _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users