Permalink
Browse files

added a day in the life scenarios

  • Loading branch information...
1 parent 876129f commit d119e776e928f600217d71228e63b6e8ca38077d @cheezy committed Dec 27, 2010
Showing with 63 additions and 0 deletions.
  1. +36 −0 features/checkout.feature
  2. +27 −0 features/step_definitions/checkout_steps.rb
@@ -0,0 +1,36 @@
+Feature: Checking out after you complete your order
+ As an online book buyer
+ I need to provide my personal information
+ so that the website can process my order
+
+ Background:
+ Given I am on the depot site
+
+ Scenario: Filling in all fields
+ When I purchase a book
+ And I complete the order with:
+ | name | address | email | pay_type |
+ | Sam Smith | 1213 Main Street | sam@example.com | Credit card |
+ Then I should see "Thank you for your order"
+
+ Scenario: Name is required
+ When I purchase a book
+ And I complete the order leaving the "Name" field blank
+ Then I should see an error message with "Name can't be blank"
+
+ Scenario: Address is required
+ When I purchase a book
+ And I complete the order leaving the "Address" field blank
+ Then I should see an error message with "Address can't be blank"
+
+ Scenario: Email is required
+ When I purchase a book
+ And I complete the order leaving the "Email" field blank
+ Then I should see an error message with "Email can't be blank"
+
+ Scenario: Options for Pay with
+ When I purchase a book
+ And go to the checkout page
+ Then the Pay with dropdown should contain "Check"
+ And the Pay with dropdown should contain "Credit card"
+ And the Pay with dropdown should contain "Purchase order"
@@ -0,0 +1,27 @@
+
+Given /^I am on the depot site$/ do
+ @catalog = CatalogPage.new(@browser)
+ @catalog.visit
+end
+
+When /^I complete the order with:$/ do |table|
+ @checkout_page = @shopping_cart.goto_checkout_page
+ @checkout_page.complete_order(table.hashes.first)
+end
+
+When /^I complete the order leaving the "([^\"]*)" field blank$/ do |field|
+ @checkout_page = @shopping_cart.goto_checkout_page
+ @checkout_page.complete_order(field.downcase => "")
+end
+
+Then /^I should see an error message with "([^\"]*)"$/ do |message|
+ @checkout_page.content.should include message
+end
+
+When /^go to the checkout page$/ do
+ @checkout_page = @shopping_cart.goto_checkout_page
+end
+
+Then /^the Pay with dropdown should contain "([^\"]*)"$/ do |value|
+ @checkout_page.pay_type_select_list.options.should include value
+end

0 comments on commit d119e77

Please sign in to comment.