Created
July 27, 2014 20:41
-
-
Save mantisbayne/4ea4ecfd088c21a11835 to your computer and use it in GitHub Desktop.
cucumber
This file contains hidden or 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
require File.join(File.dirname(__FILE__), '../../lib/account') | |
Given(/^I have \$(\d+) in my account$/) do |starting_balance| | |
@account = Account.new(starting_balance) | |
end | |
When(/^I request my account balance$/) do | |
@retrieved_balance = @account.balance | |
end | |
When(/^I deposit \$(\d+)$/) do |deposit_amount| | |
@account.deposit(deposit_amount) | |
end | |
Then(/^a balance of \$(\d+) is reported$/) do |expected_balance| | |
assert_equal expected_balance.to_f, @retrieved_balance | |
end | |
When(/^I withdraw \$(\d+)$/) do |withdrawal_amount| | |
@withdrawal_result = @account.withdraw(withdrawal_amount) | |
end | |
Then(/^an error message appears$/) do | |
assert_equal "OVERDRAWN", @withdrawal_result | |
end |
This file contains hidden or 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
require File.join(File.dirname(__FILE__), '../../lib/account') | |
Given(/^I have \$(\d+) in my account$/) do |starting_balance| | |
@account = Account.new(starting_balance) | |
end | |
When(/^I request my account balance$/) do | |
@retrieved_balance = @account.balance | |
end | |
When(/^I deposit \$(\d+)$/) do |deposit_amount| | |
@account.deposit(deposit_amount) | |
end | |
Then(/^a balance of \$(\d+) is reported$/) do |expected_balance| | |
assert_equal expected_balance.to_f, @retrieved_balance | |
end | |
When(/^I withdraw \$(\d+)$/) do |withdrawal_amount| | |
@withdrawal_result = @account.withdraw(withdrawal_amount) | |
end | |
Then(/^an error message appears$/) do | |
assert_equal "OVERDRAWN", @withdrawal_result | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment