Created
February 24, 2011 17:35
-
-
Save bgswan/842515 to your computer and use it in GitHub Desktop.
The step definitions for the cart feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When /^(\d+) x \$(\d+)/ do |qty, price| | |
@basket ||= [] | |
@basket << (qty.to_i * price.to_i) | |
end | |
Then /^Total bill = \$(.+)$/ do |expected_total| | |
@basket.inject(0) {|memo, item| memo += item}.should eql(expected_total.to_i) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment