-
Notifications
You must be signed in to change notification settings - Fork 39
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
Bank Account #32
base: master
Are you sure you want to change the base?
Bank Account #32
Conversation
Market account
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall well done, there are some methods that are too long and complicated (finding owners for example). You should have taken some advantage of inheritance (super
) and you're missing some things in your testing.
Despite this you did a very good job on testing and good work on the extras. Nice work!
@open_date = DateTime.parse(open_date) | ||
|
||
# Assumes that required csv file is accesible | ||
CSV.read("support/account_owners.csv").each do |line| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This loop is problematic. It's reading the file and each find is reading another file each time. The find
methods should probably be scanning through the Arrays provided by .all
so you don't have to repeat things over and over again.
describe "#initialize" do | ||
# Check that a CheckingAccount is in fact a kind of account | ||
it "Is a kind of Account" do | ||
account = Bank::CheckingAccount.new(12345, 100.0) | ||
account = Bank::CheckingAccount.new(12345, 10000, "1999-03-27 11:30:09 -0800") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This are some really good tests.
|
||
# Balance does not change, returns amount | ||
it "Doesn't modify the balance if the fee would put it below $0.00" do | ||
Bank::CheckingAccount.new(12345, 10000, "1999-03-27 11:30:09 -0800").withdraw(100000).must_equal 10000 | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above two tests should check to ensure the balance doesn't get modified like:
my_checking_acct = Bank::CheckingAccount.new(12345, 10000, "1999-03-27 11:30:09 -0800")
my_checking_acct.withdraw(100000)
my_checking_acct.balance.must_equal 10000
You're only checking the return value of withdraw.
end | ||
|
||
# Method that handles withdraw | ||
def withdraw(withdraw_amount) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you be able to use super
in this method to avoid replicating existing functionality.
end | ||
|
||
# Method that handles withdraw_using_check | ||
def withdraw_using_check(withdraw_amount) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to use withdraw
in this method to save code.
end | ||
|
||
# Resets the number of checks used to zero | ||
def reset_checks() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new month functionality wasn't in the requirements and it's making your reset_checks method more cumbersome than it needs to be.
Bank AccountWhat We're Looking For
SummaryOverall well done, there are some methods that are too long and complicated (finding owners for example). You should have taken some advantage of inheritance ( Despite this you did a very good job on testing and good work on the extras. Nice work! |
How to withdraw from bank account? |
Bank Account
Congratulations! You're submitting your assignment.
Comprehension Questions
raise ArgumentError
? What do you think it's doing?.all
&.find
methods class methods? Why not instance methods?