[rspec-users] Step matchers

Pat Maddox pergesu at gmail.com
Mon Oct 15 19:15:02 EDT 2007


On 10/15/07, Jay Levitt <lists-rspec at shopwatch.org> wrote:
> On 10/15/2007 6:11 PM, Pat Maddox wrote:
> > On 10/15/07, James Hughes <hughes.james at gmail.com> wrote:
> >> Just wanted to chime in and say, as a regular user of the folding
> >> features of the editor, this is what really resonated with me when
> >> Story Runner was first introduced. In fact, I recently did a short
> >> presentation to some coworkers and did exactly what is described here:
> >> put a story up with folding turned on to show the "story" without
> >> accompanying code, and then opened up various folds to show the
> >> implementation.
> >
> > I don't want my customers to need a code editor to look at specs.  I
> > also don't want them to have to understand what :type => RailsStory,
> > %{this stuff}, and do...end are.
>
> But how hard would it be to allow .story files to contain an eval block?
>   Then, programmers who are writing stories themselves can keep them in
> one file, and those with end-customers can use two files.

Well, I'm not sure that anyone was suggesting that we ditch the
current way.  I certainly wasn't.  If you want to embed code then you
can.

Although, this new way solves a more common problem than just making
specs pretty for customers.  Sharing steps right now is kind of a
pain.  You have to write a helper method somewhere, and then in every
single story file you have to do

Given "a user named", "Pat" do |name|
  create_user name
end

Which is still too much duplication for my taste.

When you realize that you don't need to embed code (because the steps
are extracted elsewhere), the reasons for expressing stories in code
at all falls away.

Pat


More information about the rspec-users mailing list