[rspec-users] StepGroup ?

David Chelimsky dchelimsky at gmail.com
Sat Dec 22 21:46:21 EST 2007


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.

>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list