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.

That said, I think you want to keep stubbing to an absolute minimum.
I only stub out stuff that hits external services - even then I have a
"full integration mode" that runs the same tests but DOES hit the real
services (assuming they provide a sandbox or I have some other
innocuous way to mess with stuff).

Sometimes I'm lazy about the login step and will do
controller.send(:current_user=, User.find(1)) if I don't feel there's
any benefit at all to making a login request.

Pat
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to