Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Janice's Bank Accounts. At long last. #48

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6c66f0f
Account#initialize test passed.
janicewilson Feb 21, 2017
d352739
Raises an ArgumentError when created with a negative balance test pas…
janicewilson Feb 21, 2017
5164162
Can be created with a balance of 0 test passed.
janicewilson Feb 21, 2017
aa0734e
Account#withdraw test passed.
janicewilson Feb 21, 2017
6c6aa1c
"Returns the modified balance" and "Outputs a warning if the account …
janicewilson Feb 21, 2017
8b63bb6
"Allows the balance to go to 0" and "Requires a positive withdrawal a…
janicewilson Feb 22, 2017
b80a9c3
"Requires a positive withdrawal amount" test passes.
janicewilson Feb 22, 2017
78f2f94
"Increases the balance", "Returns the modified balance" and "Requires…
janicewilson Feb 22, 2017
44535b0
Added the optional. Attempted to add a "before" statement, but too ti…
janicewilson Feb 22, 2017
75faf68
Reboot re Wave 1. Committing without regrets.
janicewilson Feb 23, 2017
e3ffbb8
YAR (Yet Another Reboot.)
janicewilson Feb 23, 2017
3cc028d
All tests but the last have passed.
janicewilson Feb 24, 2017
85e624e
All tests but the last have passed.
janicewilson Feb 24, 2017
f69fa40
A fully sanitized Wave 2.
janicewilson Feb 24, 2017
f530f7b
Minitests for Savings Account \'initialize\' and \'withdraw\' success…
janicewilson Feb 24, 2017
16d4639
Added RB files for savings and checking account..
janicewilson Feb 24, 2017
fe911d4
Minitest /'add_interest/' passed for Saving Account.
janicewilson Feb 24, 2017
396ed54
Minitests re \'initialize\' and \'withdraw'\ updated.
janicewilson Feb 25, 2017
502cc28
Minitests re \'initialize\' and \'withdraw'\ updated.
janicewilson Feb 25, 2017
c26a9ed
All systems go. All mini-tests passed.
janicewilson Feb 25, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Minitests for Savings Account \'initialize\' and \'withdraw\' success…
…fully completed.
janicewilson committed Feb 24, 2017
commit f530f7bd0c2157a49e3152306d109fdcbe437d62
7 changes: 0 additions & 7 deletions specs/account_spec.rb
Original file line number Diff line number Diff line change
@@ -5,13 +5,6 @@

Minitest::Reporters.use!

require 'minitest/autorun'
require 'minitest/reporters'
require 'minitest/skip_dsl'
require_relative '../lib/account'

Minitest::Reporters.use!

describe "Wave 1" do
describe "Account#initialize" do
it "Takes an ID and an initial balance" do
109 changes: 82 additions & 27 deletions specs/savings_account_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
require 'minitest/autorun'
require 'minitest/reporters'
require 'minitest/skip_dsl'
require_relative '../lib/savings_account'

Minitest::Reporters.use!

# TODO: uncomment the next line once you start wave 3 and add lib/savings_account.rb
# require_relative '../lib/savings_account'
@@ -11,38 +14,90 @@
# Here we'll only test things that are different.

# TODO: change 'xdescribe' to 'describe' to run these tests
xdescribe "SavingsAccount" do
describe "#initialize" do
it "Is a kind of Account" do
# Check that a SavingsAccount is in fact a kind of account
account = Bank::SavingsAccount.new(12345, 100.0)
account.must_be_kind_of Bank::Account
end
describe "SavingsAccount" do

it "Requires an initial balance of at least $10" do
# TODO: Your test code here!
end
end
describe "#initialize" do

describe "#withdraw" do
it "Applies a $2 fee each time" do
# TODO: Your test code here!
end
it "Is a kind of Account" do

it "Outputs a warning if the balance would go below $10" do
# TODO: Your test code here!
end
account = Bank::SavingsAccount.new(12345, 100.0)
account.must_be_kind_of Bank::Account

it "Doesn't modify the balance if it would go below $10" do
# TODO: Your test code here!
end
end

it "Doesn't modify the balance if the fee would put it below $10" do
# TODO: Your test code here!
end
end
it "Requires an initial balance of at least $10" do

proc {
Bank::SavingsAccount.new(1337, -100.0)
}.must_raise ArgumentError

proc {
Bank::SavingsAccount.new(1337, -0.0)
}.must_raise ArgumentError

proc {
Bank::SavingsAccount.new(1337, 9.0)
}.must_raise ArgumentError

end
end

describe "#withdraw" do

# it "Applies a $2 fee each time" do
# # TODO: Your test code here!
# end

describe "#add_interest" do
it "Outputs a warning if the balance would go below $10" do

start_balance = 50.0
withdrawal_amount = 48.0
account = Bank::SavingsAccount.new(1337, start_balance)

proc {
account.withdraw(withdrawal_amount)
}.must_output /.+/

end

it "Doesn't modify the balance if it would go below $10" do

start_balance = 50.0
withdrawal_amount = 41.0
account = Bank::SavingsAccount.new(1337, start_balance)

updated_balance = account.withdraw(withdrawal_amount)
updated_balance.must_equal start_balance
account.balance.must_equal start_balance
end

it "Doesn't modify the balance if it would go below $10" do

start_balance = 50.0
withdrawal_amount = 41.0
account = Bank::SavingsAccount.new(1337, start_balance)

updated_balance = account.withdraw(withdrawal_amount)
updated_balance.must_equal start_balance
account.balance.must_equal start_balance
end


it "Doesn't modify the balance if it would go below $10 due to the $2 fee" do

start_balance = 11
withdrawal_amount = 1
account = Bank::SavingsAccount.new(1337, start_balance)

updated_balance = account.withdraw(withdrawal_amount)
updated_balance.must_equal start_balance
account.balance.must_equal start_balance
end


end

#describe "#add_interest" do
it "Returns the interest calculated" do
# TODO: Your test code here!
end
@@ -54,5 +109,5 @@
it "Requires a positive rate" do
# TODO: Your test code here!
end
end

end