This program aims to mimick the functionality of a bank account that allows the user to make deposits, withdrawals and print bank statements.
You can interact with it via IRB within your terminal, please refer to the usage section for more instructions.
You will find three classes in this project:
- Transaction = Takes to arguments in its creation, a boolean for weather it is a deposit or not, and the ammount.
- Account = It keeps track of the balance based on the transactions inputed, and also creates statements with the
print_statement
method. - Statement = It prints out all of the transactions recorded in the account.
- Download the project and clone it into your computer.
git clone https://github.com/frodri13/Bank-Tech-Test.git
- Open IRB in your terminal:
irb
- Follow the instructions on the Usage section down below.
Locate yourself into the directory and run rspec
.
Please note that there are two methods to insert transactions:
- add_to_balance(transaction) => takes an object as an argument, used for testing with instance doubles of transactions.
- transaction(deposit, ammount) => takes in two arguments. This method will create an object of the transaction class.
Given a client makes a deposit of 1000 on 10-01-2012
And a deposit of 2000 on 13-01-2012
And a withdrawal of 500 on 14-01-2012
When she prints her bank statement
Then she would see
date || credit || debit || balance
14/01/2012 || || 500.00 || 2500.00
13/01/2012 || 2000.00 || || 3000.00
10/01/2012 || 1000.00 || || 1000.00
I also took the liberty of adding the following features to cover some expected edge cases:
- The current date will be added if no date is provided.
- Both the
deposit
andwithdraw
methods can take in dates such as "13-01-2012" or "13/01/2012 - It will raise an error if the date is inserted in another format such as "01-13-2012"
- It can take ammounts with decimals that will be printed out with two decimal places