Last active
April 20, 2018 02:45
-
-
Save jonatas/bf9387bbc8ba2f0f6f9267cef5751802 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Account | |
def withdraw(value) | |
if @total >= value | |
@total -= value | |
:ok | |
else | |
:not_allowed | |
end | |
end | |
end | |
# bad | |
allow(Account).to receive(:withdraw).and_return(:ok) | |
# good | |
allow(Account).to receive(:withdraw).with(100).and_return(:ok) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment