-
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
Alison's Bank Accounts #47
base: master
Are you sure you want to change the base?
Conversation
…v works for everything but opendate
…draw in account class
…he big brother accounts class and tests are clean; using methods for minimum and fee
…les in savings account spec that need to be dealt with
Bank AccountWhat We're Looking For
SummaryOverall nicely done, the use of methods for fee, etc were a nice way to handle withdrawal using inheritance. You did have some things missing in your tests. Overall nicely done. |
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.
Nicely done overall, a few comments here and there.
|
||
|
||
#method which returns 1, so fee for any object in checking account is now 1 | ||
def fee |
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.
Interesting how you used this for the inheritance in Checking & Savings.
raise ArgumentError.new("You need some positive cash flow to open an account") if balance < 0 | ||
@id = id | ||
@balance = balance | ||
@opendate = opendate |
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.
a more standard name would be @open_date
|
||
# Because a CheckingAccount is a kind | ||
# of Account, and we've already tested a bunch of functionality | ||
# on Account, we effectively get all that testing for free! | ||
# Here we'll only test things that are different. | ||
|
||
# TODO: change 'xdescribe' to 'describe' to run these tests | ||
xdescribe "CheckingAccount" do | ||
describe "CheckingAccount" do | ||
describe "#initialize" do | ||
# Check that a CheckingAccount is in fact a kind of account | ||
it "Is a kind of Account" do |
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.
test for it being an Account?
|
||
account = Bank::CheckingAccount.new(id, balance) | ||
account.withdraw_using_check(amount) | ||
account.balance.must_be :<, balance |
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.
good use of must_be
end | ||
|
||
it "Requires a positive withdrawal amount" do | ||
# TODO: Your test code here! | ||
id = 116 |
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.
Where's the attempt to do a negative withdrawal?
amount = 10 | ||
|
||
account = Bank::CheckingAccount.new(id, balance) | ||
4.times do account.withdraw_using_check(amount) 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.
Good use of a loop!
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?