[rspec-users] Stories - Use view matchers rather than assigns.should?
ashley.moran at patchspace.co.uk
Thu Apr 10 18:30:23 EDT 2008
On 10 Apr 2008, at 23:06, Pat Maddox wrote:
>> Given ...
>> When I run User.create!(:foo => "bar")
>> Then the Users page should have a row with "bar" in the "foo"
> Gah, that looks hideous.
I think you misunderstood the point - it's supposed to look hideous :)
What I meant was if you have a load of steps like
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
But say that actually, "Given a user named Pat" and "Given the user
is 22 years old" are implemented as DB API calls - in this case is
there merit to having a special set of stories on one side, just to
verify that your low-level steps actually produce the user-facing data
you expect, as if they used the GUI to create the data?
I sometimes write "assumption" specs for third party code, if I am
relying on behaviour I'm unsure about, just so if the lib API changes
it gets flagged. I saw this as an extension of the idea, not a
suggestion to send ActiveRecord method calls to a client's marketing
director!!! (I'm sure there's some bizarre political situation
somewhere where that might have an advantage though...)
More information about the rspec-users