[rspec-users] StepGroup ?

Jonathan Linowes jonathan at parkerhill.com
Sun Dec 23 02:15:57 EST 2007

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.

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" ?

More information about the rspec-users mailing list