[rspec-users] Stories - Use view matchers rather than assigns.should?
pergesu at gmail.com
Thu Apr 10 11:20:53 EDT 2008
On Wed, Apr 9, 2008 at 8:20 PM, Tim Haines <tmhaines at gmail.com> wrote:
> Thanks Pat and David. I'm implementing paging (via will_paginate) and
> thought I should start with a story. I think I grok what you're saying Pat
> - the stories should only be looking at "externally" visible stuff - i.e.
> what a real user can see or do.. That's why you consider
> controller.send("current_user=",..) a bit hacky right?
I don't actually think that that's hacky. Let's say you've got a
story that covers logging in. Does _every single_ other story require
you to cover that same basic functionality? I don't think so. The
tradeoff in this case is between purity and speed. Testing the exact
path the user takes is certainly more robust. otoh, how likely is the
authentication behavior going to fail? Not that likely. I think it's
reasonable to skip that part, cutting down on the number of requests
that your stories make, in order to keep your story suite faster.
More information about the rspec-users