[rspec-users] Stories - Use view matchers rather than assigns.should?
pergesu at gmail.com
Thu Apr 10 18:06:02 EDT 2008
On Thu, Apr 10, 2008 at 2:57 PM, Ashley Moran
<ashley.moran at patchspace.co.uk> wrote:
> Sorry wasn't clear what I meant. I was thinking something like
> Given ...
> When I run User.create!(:foo => "bar")
> Then the Users page should have a row with "bar" in the "foo" column
Gah, that looks hideous.
When I create a user with foo="bar"
is better because it doesn't expose the implementation. Just the
model concept and any relevant attributes.
If possible, I like to write it in a very narrative form:
Given a user named Pat
And the user is 22 years old
When I view the user list
Then I should see the user's name and age
Your implementation of the steps can be at any level you want, for the
most part. But the stories should only be in business terms.
More information about the rspec-users