On Thu, Mar 6, 2008 at 10:38 AM, Pat Maddox <[EMAIL PROTECTED]> wrote: > On Thu, Mar 6, 2008 at 7:27 AM, Ivo Dancet <[EMAIL PROTECTED]> wrote: > > You should not stub the authentication method in a story. The story > > should test the whole application framework, that way your story might > > look like this: > > > > Given a user from company x > > When logging in > > And requesting some page > > Then the application should do all the stuff it should > > > > In the given step you set your host, user name and password and you > > create that user. > > In the when steps you make the login request and then you can start > > doing the stuff you really want to test here as you'll have the > > session you want at that moment. > > That's a little too dogmatic for me. You needn't go through the > entire stack every story, and you needn't go through the entire app > path either. >
IMO you should be simulating as much as possible what the user is doing. If they have to go through path a, b, c ... to get to Z, then so be it. This involves keeping a well-factored set of helpers which can be used to navigate the app just like a user would. The only things you probably should be stubbing in a story are third party components your site may have to integrate with that aren't realistic to be run for every story (for the most part, there are other exceptions as well I know). I would avoid stubbing core functionality related to your site, -- Zach Dennis http://www.continuousthinking.com _______________________________________________ rspec-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/rspec-users
