Skip to content

Instantly share code, notes, and snippets.

@mantisbayne
Created July 27, 2014 20:41
Show Gist options
  • Save mantisbayne/4ea4ecfd088c21a11835 to your computer and use it in GitHub Desktop.
Save mantisbayne/4ea4ecfd088c21a11835 to your computer and use it in GitHub Desktop.
cucumber
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
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