Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## feature text file - gift.feature
- Feature: A User adds items to their Cart
- In order to checkout and purchase items
- As a User
- I want to add items to my cart
- Scenario: Adding a gift
- Given that I am on the new gift page
- When I fill in "20" for "Gift Amount"
- And I fill in "test1@example.com" for "gift_email"
- And I fill in "test1@example.com" for "gift_email_confirmation"
- And I fill in "test2@example.com" for "gift_to_email"
- And I fill in "test2@example.com" for "gift_to_email_confirmation"
- And I press "Add to Cart"
- Then the Gift should appear in the Cart
- And there should be a link to Preview the Gift
- And there should be a link to Edit the Gift
- And there should be a link to Remove the Gift
- And the Cart Total should be $20.00
- ## steps file (run the scenarios) - gift_steps.rb
- Given /I am on the new gift page/ do
- visits "/dt/gifts/new"
- end
- Then /the Gift should appear in the Cart/ do
- response.should have_tag("#cart td div.gift")
- end
- Then /there should be a link to Preview the Gift/ do
- response.should have_tag("#cart td div.gift input[type=button][value=Preview]")
- end
- Then /there should be a link to Edit the Gift/ do
- response.should have_tag("#cart td a[href=/dt/gifts/0/edit]")
- end
- Then /there should be a link to Remove the Gift/ do
- response.should have_tag("#cart td a[href=/dt/cart?id=0][onclick~=m.setAttribute('name', '_method'); m.setAttribute('value', 'delete');]", :count => 1) do |t|
- t.should have_tag("img[alt=Remove item from cart]")
- end
- end
- Then /the Cart Total should be \$(\d+\.\d+)/ do |n|
- response.should have_tag("#cart tr.footer td:last-child") do |td|
- td.inner_text.should == "$#{n}"
- end
- end
- ## output
- timg-2:1-3-development tim$ rake features
- (in /Users/tim/projects/donortrust/branches/1-3-development)
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I "/Users/tim/projects/donortrust/branches/1-3-development/vendor/plugins/cucumber/lib" "/Users/tim/projects/donortrust/branches/1-3-development/vendor/plugins/cucumber/bin/cucumber" --format pretty --require features/steps/cart_steps.rb --require features/steps/checkout_steps.rb --require features/steps/common_webrat.rb --require features/steps/env.rb features/cart.feature
- Feature: A User adds items to their Cart
- In order to checkout and purchase items
- As a User
- I want to add items to my cart
- Scenario: Adding a gift
- Given that I am on the new gift page
- When I fill in "20" for "Gift Amount"
- And I fill in "test1@example.com" for "gift_email"
- And I fill in "test1@example.com" for "gift_email_confirmation"
- And I fill in "test2@example.com" for "gift_to_email"
- And I fill in "test2@example.com" for "gift_to_email_confirmation"
- And I press "Add to Cart"
- Then the Gift should appear in the Cart
- And there should be a link to Preview the Gift
- And there should be a link to Edit the Gift
- And there should be a link to Remove the Gift
- And the Cart Total should be $20.00
- 12 steps passed
Add Comment
Please, Sign In to add comment