DOH I thinks convention = I think this convention
2008/11/21 Andrew Premdas <[EMAIL PROTECTED]>: > Interesting ... so this establishes a convention to use in features > that all Givens are written in the past tense and all whens in the > present tense. > > I think its quite important as your feature count grows that you have > conventions to stop getting to much step duplication > > e.g. > > when I create a foo with a price of £24 > when I have a foo whose price is £24 > when I have a foo priced at £24 > > are all the same, and whilst you could write a more complex regex to > match all 3 (i think) it would be much better to apply a general > convention about how you write features to deal with this > > I thinks convention is probably a hangover from the old story runner > days and isn't quite so essential with cucumber, but it does seem to > be quite a good way to restrict your choice of language constructions > in your features which is a good thing if you want to have a > consistent style > > Look like I've got alot of Givens to rewrite :) > > > 2008/11/20 David Chelimsky <[EMAIL PROTECTED]>: >> On Thu, Nov 20, 2008 at 10:40 AM, Andrew Premdas <[EMAIL PROTECTED]> wrote: >>> Also occasionally you may want to use a when as a given. Cucumber >>> doesn't actually use the given|when|then|and to differentiate steps, >>> just the regex that comes after them. Sometimes I feel that it makes >>> sense as in the following examples >>> >>> When I log in as Fred >>> .... >>> >>> Given I log in as Fred >>> >>> When I'm writing the login feature I'd use the first statement, but >>> when I'm testing foo as a logged in user I'd use the second. Both >>> would use the same step. >>> >>> Now I realise that this counters the excellent advice given on the >>> step-organisation page of the wiki. However I think in this case even >>> though the step is definitely a when it should be allowed to be used >>> as a Given in some stories as its definitely a setup step rather than >>> an interaction step in certain|most contexts >> >> I actually prefer to keep these separate: >> >> Given I am logged in as Fred >> When I log in as Fred >> >> And then have each call out to a helper method named login_as(name). >> >> This reduces the duplication in the code in the steps, but allows me >> to be consistent about the distinctions I make between how Givens and >> Thens are expressed. >> >> WDYT? >> >> David >> >> >>> >>> Finally Cucumber tells you which step is matching your feature so >>> there is much less need to organise steps by given|when... then there >>> was with the previous story runner >>> >>> All best >>> >>> Andrew >>> >>> 2008/11/20 aidy lewis <[EMAIL PROTECTED]>: >>>> Hi, >>>> >>>> Do you think this is a satisfactory way to group step files related to >>>> one feature >>>> >>>> e.g. >>>> >>>> publish_content_givens >>>> publish_content_whens >>>> publish_content_thens >>>> >>>> ? >>>> >>>> Thanks >>>> >>>> Aidy >>>> _______________________________________________ >>>> 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 >>> >> _______________________________________________ >> 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