Skip to content

Instantly share code, notes, and snippets.

@jbpros
Created November 7, 2014 15:23
Show Gist options
  • Save jbpros/b489d9fb7c34abd2fbd7 to your computer and use it in GitHub Desktop.
Save jbpros/b489d9fb7c34abd2fbd7 to your computer and use it in GitHub Desktop.
Feature: deposit check
Why are we doing this?
Free text area.
Business rules:
* don't do evil
* be smart
Scenario Outline: successful deposits
Given I am a customer
And I have <initial_balance> on my account
When I deposit a <check_amount> check to my account
Then I should get <final_balance> on my account
Examples:
| initial_balance | check_amount | final_balance |
| 0 | 120 | 120 |
| 1000 | 34 | 1034 |
| 65 | 2 | 67 |
| 65 | 2 | 167 |
Given(/^I am a customer$/) do
end
Given(/^I have (\d+) on my account$/) do |initial_balance|
@balance = initial_balance.to_i
end
When(/^I deposit a (\d+) check to my account$/) do |check_amount|
@balance = @balance + check_amount.to_i
end
Then(/^I should get (\d+) on my account$/) do |expected_balance|
if expected_balance.to_i != @balance
raise "Current balance is #{@balance}, expected #{expected_balance}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment