Forum: RSpec Recommendations on multi-view scenarios?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2a39aed820c125e6db9826fa8180043f?d=identicon&s=25 Denis Haskin (dwhsix)
on 2009-05-18 17:18
(Received via mailing list)
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
Cdf378de2284d8acf137122e541caa28?d=identicon&s=25 Matt Wynne (mattwynne)
on 2009-05-18 20:28
(Received via mailing list)
On 18 May 2009, at 16:02, Denis Haskin wrote:

> Scenario: I purchase a widget by paying for it with a credit card
>
> And I am on the "credit card information" page
>
> Yes?  No?  Examples?

This is a common question. See
http://www.benmabey.com/2008/05/19/imperative-vs-d...
  and also
http://wiki.github.com/aslakhellesoy/cucumber/call...

Matt Wynne
http://blog.mattwynne.net
http://www.songkick.com
This topic is locked and can not be replied to.