-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbank_test.rb
33 lines (26 loc) · 882 Bytes
/
bank_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require 'minitest/autorun'
require 'minitest/pride'
require './bank'
class BankTest < Minitest::Test
def setup
@bank = Transactions.new
@balance = 1000
end
def test_balance_in_account
assert_equal @balance, @bank.account(@balance, 0)
end
def test_calculate_balance_in_account_after_deposit
deposit_amount = @bank.deposit(50)
assert_equal 1050, @bank.account(@balance, deposit_amount)
end
def test_calculate_balance_in_account_after_withdrawal
withrawal_amount = @bank.withdraw(50)
assert_equal 950, @bank.account(@balance, withrawal_amount)
end
def test_calculate_balance_in_account_after_withdrawal_and_deposit
withrawal_amount = @bank.withdraw(50)
new_balance = @bank.account(@balance, withrawal_amount)
deposit_amount = @bank.deposit(75)
assert_equal 1025, @bank.account(new_balance, deposit_amount)
end
end