Hi, I have a need for the StepGroup feature in stories but not clear what''s the current api. Could you provide an example? In my case I have several scenarios which vary in the Givens, but not the results. Ideally I''m hoping to achieve something like: (but anything will do for now :) Scenario: one Given something When he does foo Then good things should happen Scenario: two Given something different When he does foo Group Of good things should happen Group: good things should happen Then good thing one And good thing two And good thing three
Sorry, I guess stepgroup is the steps_for framework, and not what I''m asking about. Is there a way to hierarchically combine steps under a single step to achieve? On Dec 22, 2007, at 2:51 AM, Jonathan Linowes wrote:> Hi, > I have a need for the StepGroup feature in stories but not clear > what''s the current api. Could you provide an example? > > In my case I have several scenarios which vary in the Givens, but not > the results. Ideally I''m hoping to achieve something like: (but > anything will do for now :) > > Scenario: one > Given something > When he does foo > Then good things should happen > > Scenario: two > Given something different > When he does foo > Then good things should happen > > > Group: good things should happen > Then good thing one > And good thing two > And good thing three > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
On Dec 22, 2007 1:51 AM, Jonathan Linowes <jonathan at linowes.com> wrote:> Hi, > I have a need for the StepGroup feature in stories but not clear > what''s the current api. Could you provide an example? > > In my case I have several scenarios which vary in the Givens, but not > the results. Ideally I''m hoping to achieve something like: (but > anything will do for now :) > > Scenario: one > Given something > When he does foo > Then good things should happen > > Scenario: two > Given something different > When he does foo > Group Of good things should happen > > > Group: good things should happen > Then good thing one > And good thing two > And good thing threeThere is "Given Scenario", but that only lets you call up scenarios defined earlier in the same story. So you could use that but the semantics don''t seem right for what you''re wanting - which seems to be a collection of verifications that should be the same for different pretexts, as opposed to a collection of givens that diverge at some point. Regardless - take a look at examples/stories/game-of-life. It uses Given Scenario as intended.> > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On Dec 22, 2007, at 9:46 PM, David Chelimsky wrote:> On Dec 22, 2007 1:51 AM, Jonathan Linowes <jonathan at linowes.com> > wrote: >> Hi, >> I have a need for the StepGroup feature in stories but not clear >> what''s the current api. Could you provide an example? >> >> In my case I have several scenarios which vary in the Givens, but not >> the results. Ideally I''m hoping to achieve something like: (but >> anything will do for now :) >> >> Scenario: one >> Given something >> When he does foo >> Then good things should happen >> >> Scenario: two >> Given something different >> When he does foo >> Group Of good things should happen >> >> >> Group: good things should happen >> Then good thing one >> And good thing two >> And good thing three > > There is "Given Scenario", but that only lets you call up scenarios > defined earlier in the same story. So you could use that but the > semantics don''t seem right for what you''re wanting - which seems to be > a collection of verifications that should be the same for different > pretexts, as opposed to a collection of givens that diverge at some > point. > > Regardless - take a look at examples/stories/game-of-life. It uses > Given Scenario as intended.Thanks. That might be feasible if there were a way to tell a scenario not to run unless its called from GivenScenario How about something like "Scenario Segment" and a corresponding "Follow Scenario" ?
On Dec 23, 2007 2:15 AM, Jonathan Linowes <jonathan at parkerhill.com> wrote:> > > On Dec 22, 2007, at 9:46 PM, David Chelimsky wrote: > > > On Dec 22, 2007 1:51 AM, Jonathan Linowes <jonathan at linowes.com> > > wrote: > >> Hi, > >> I have a need for the StepGroup feature in stories but not clear > >> what''s the current api. Could you provide an example? > >> > >> In my case I have several scenarios which vary in the Givens, but not > >> the results. Ideally I''m hoping to achieve something like: (but > >> anything will do for now :) > >> > >> Scenario: one > >> Given something > >> When he does foo > >> Then good things should happen > >> > >> Scenario: two > >> Given something different > >> When he does foo > >> Group Of good things should happen > >> > >> > >> Group: good things should happen > >> Then good thing one > >> And good thing two > >> And good thing three > > > > There is "Given Scenario", but that only lets you call up scenarios > > defined earlier in the same story. So you could use that but the > > semantics don''t seem right for what you''re wanting - which seems to be > > a collection of verifications that should be the same for different > > pretexts, as opposed to a collection of givens that diverge at some > > point. > > > > Regardless - take a look at examples/stories/game-of-life. It uses > > Given Scenario as intended. > > Thanks. > That might be feasible if there were a way to tell a scenario not to > run unless its called from GivenScenario > How about something like "Scenario Segment" and a corresponding > "Follow Scenario" ?Please submit a ticket for this: http://rspec.lighthouseapp.com/. Can''t say whether or not we''ll do it, but if you want this to get on/stay on the radar, that''s your best bet. Thanks, David> > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >