[rspec-users] Stories - Use view matchers rather than assigns[].should?

Rick DeNatale rick.denatale at gmail.com
Thu Apr 10 22:14:01 EDT 2008


On Thu, Apr 10, 2008 at 6:38 PM, Pat Maddox <pergesu at gmail.com> wrote:
> On Thu, Apr 10, 2008 at 3:30 PM, Ashley Moran

>  >  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 don't know what you mean by a special set of stories.  In the
>  example I gave, the Given steps would most likely be implemented as AR
>  calls - not as separate requests.  The When and Then would likely be
>  implemented as an HTTP request and an assertion on the returned HTML.
>  But there's no way to tell that from the story narrative.  And
>  sometimes if the logic is complex and will take a couple iterations, I
>  might first implement the When and Then steps as AR calls, and then as
>  we build up the HTML pages around that infrastructure, I'd convert the
>  step implementations to go through the web request.

I'm working on a project right now in which the business rules and
logic took some time to discover via iteration and experimentation.
The UI work started later and overlapped somewhat.

I started by writing a plain text story, and steps which worked at the
AR level.  I've done the UI work mostly with specs and not stories.

I'm now at the point of converting the steps into the equivalent of a
'traditional' Rails integration test.

BUT

I'm thinking that I might just write a whole new xxx_steps.rb file
which would run the same story but at the real user interaction level,
and keep the model level steps also.  I still haven't convinced myself
one way or the other.

-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/


More information about the rspec-users mailing list