-
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
Ashton's Bank Account #31
base: master
Are you sure you want to change the base?
Conversation
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 nicely done, I put a few comments into the code here and there, but you did well.
end | ||
|
||
it "Doesn't modify the balance if the account would go below -$10" do | ||
# TODO: Your test code here! | ||
@account.check_withdraw(200).must_equal 100 | ||
end | ||
|
||
it "Requires a positive withdrawal amount" 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.
This should instead be triggering an ArgumentError
end | ||
|
||
|
||
def 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 call the withdraw
method from within check_withdraw
.
Bank AccountWhat We're Looking For
SummaryOverall nicely done, I put a few comments into the code here and there, but you did well. |
Yay! Thanks Chris!
…On Tue, Feb 28, 2017 at 11:25 AM, Chris M ***@***.***> wrote:
***@***.**** commented on this pull request.
Overall nicely done, I put a few comments into the code here, but you did
well.
------------------------------
In specs/checking_account_spec.rb
<#31 (comment)>:
> end
it "Doesn't modify the balance if the account would go below -$10" do
- # TODO: Your test code here!
+ @account.check_withdraw(200).must_equal 100
end
it "Requires a positive withdrawal amount" do
This should instead be triggering an ArgumentError
------------------------------
In lib/checking.rb
<#31 (comment)>:
> + end
+
+
+ def withdraw(amount)
+
+ if @balance - (amount + 1) < 1
+ print "Insufficient Funds"
+ return @balnace = @balance
+ end
+ super
+ return @balance -= 1
+
+ end
+
+
+ def check_withdraw(amount)
You should be able to call the withdraw method from within check_withdraw.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#31 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ATT5oohC13qUVnqr3Yu1rwaVyKnfnGC8ks5rhHSfgaJpZM4MMzzo>
.
|
Bank Account
Congratulations! You're submitting your assignment.
Comprehension Questions
raise ArgumentError
? What do you think it's doing?raise ArgumentError
is some kind of conditional string method, that prints a message to the screen if specific criteria is or isn't met..all
&.find
methods class methods? Why not instance methods?