[rspec-users] Recommendations on multi-view scenarios?

Denis Haskin denis at haskinferguson.net
Mon May 18 11:02:40 EDT 2009


I'm trying to find out best practices for a multi-view scenario.  Take 
the classic example of ecommerce, where you might first enter address 
information, then credit card information, then confirm it all and the 
purchase is made.

Seems to me this has to be done with a separate scenario for each view?

The whole process would be:

Scenario: I purchase a widget by paying for it with a credit card
  Given I am logged in as Sheila
  And I have a widget in my cart that costs $5
  When I press "Checkout"
  And enter my address information
  And press "OK"
  And enter my credit card information
  And press "OK"
  And press "OK"
  Then my credit card balance should be reduced by $5
  And I have a completed transaction in my order history

But that seems really really wrong.  So I assume it needs to be like this?

Scenario: I purchase a widget by entering my address information
  Given I am logged in as Sheila
  And I have a widget in my cart that costs $5
  When I press "Checkout"
  And enter complete address information
  And press "OK"
  Then I do not get an error message
  And I am on the "credit card information" page

Scenario: I purchase a widget by entering my credit card information
  Given I am logged in as Sheila
  And I have a widget in my cart that costs $5
  And I am on the "credit card information page"
  When I enter valid credit card information
  And press OK"
  Then I do not get an error message
  And I am on the "confirm purchase" page
...etc...

Yes?  No?  Examples?

Thanks,

dwh



More information about the rspec-users mailing list