On Wed, Jan 21, 2009 at 6:49 AM, Juanma Cervera <li...@ruby-forum.com> wrote: > I am specing a feature, maybe at more high level of what it should be, > and this makes scenarios that involves more that one rails controller. > > Is it possible or convenient? > > I have scenarios like this (although it's only an unreal example): > > Feature: Making a reservation for a service. > Scenario: Making the reservation > Given I want to make a reservation for a service > When I choose the service > Then I see the page 'service1/1/options' > When I select option 1 > And I click on "submit" > Then I will be asked for a confirmation > When I answer 'Yes' > Then I see "Ok" > And I go to "/services/1" > > > Is this ok or I should define the features with only one single > iteration?
It's OK to have more than one series of When/Then as long as they make for a cohesive scenario, which you've done here. I'd recommend avoiding URLs in the steps though. For example (I don't know what service and option mean in your case, but this should give you an idea): Scenario: Make a new reservation Given a 'Foo' service And the 'Foo' service includes a 'Bar' option When I choose the 'Foo' service Then I see the 'Foo Service' detail When I select the 'Bar' option And I submit my request Then I am be asked for a confirmation When I answer 'Yes' Then I see 'OK' And I see the 'Foo' service in the 'My Services' Note the lack of references to URLS and even pages. I might have taken it too far, depending on your situation. For example, "And I submit my request" instead of "And I click 'submit'" - If there is particular text on the button that is deemed to have business value, then you might say "And I click 'Request Service'" - but if you're referencing DOM IDs or HTML element names like 'submit', I'd hide those. HTH, David > > Juanma Cervera. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > 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