Message: 7 > Date: Sun, 14 Oct 2007 18:04:33 -0500 > From: "David Chelimsky" <[EMAIL PROTECTED]> > Subject: Re: [rspec-users] Step matchers > To: rspec-users <rspec-users@rubyforge.org> > Message-ID: > <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=ISO-8859-1 > > On 10/14/07, David Chelimsky <[EMAIL PROTECTED]> wrote: > >> On 10/14/07, Pat Maddox <[EMAIL PROTECTED]> wrote: >> >>> I think we all know that the readability of steps isn't great right >>> now, and in fact there's a very recent thread that discusses just >>> that. It was that recent thread that prompted me to explore this a >>> bit. >>> >>> The basic idea is that you define step matchers, which have a regex, >>> and then you match step names against that regex. Kind of tough for >>> me to explain so I'll just link to some code :) >>> >>> spec: http://pastie.caboo.se/107116 >>> impl: http://pastie.caboo.se/107117 >>> >>> Instead of writing >>> Given "a user named __ who is __ years old", "Pat Maddox", 22 >>> >>> it allows you to write >>> Given "a user named Pat Maddox who is 22 years old" >>> >>> I wrote it out as a separate matcher because it was just easiest to do >>> it that way while I explored this approach, no messing around with >>> RSpec internals to get it to really work. However if we went this >>> route the structure would certainly be different. >>> >>> Hopefully you can get the idea from the example code. Ideally what I >>> would like is to write step libraries that are external to the stories >>> themselves. The stories would be much clearer because the >>> implementation would not be embedded, and the step names themselves >>> would make a lot more sense. >>> >>> wdyt? >>> >> LOL - I just suggested something like this in the other thread you >> cite. Though your idea strikes me as far more flexible and usable. >> Well done!!!! >> > > This just occurs to me. If we do away with the need for special > characters/positioning, blocks, etc, we should be able to do just > this, no? > > Given a savings account with 100 dollars > When the account owner asks for 101 dollars > Then the account owner should receive 0 dollars > Then the account should have 100 dollars > > Look mom - no quotes! > I like the ideas presented so far.
What happens when a user makes a typo in a step? eg: a missing 'u' in account When the accont owner asks for 101 dollars How can we help the user to recognize the typo? Alvin. > Cheers, > David > > >> Cheers, >> David >> >> >>> Pat >>> _______________________________________________ >>> rspec-users mailing list >>> rspec-users@rubyforge.org >>> http://rubyforge.org/mailman/listinfo/rspec-users >>> >>> > > > ------------------------------ > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > > End of rspec-users Digest, Vol 16, Issue 43 > ******************************************* > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users