Created
May 10, 2014 17:53
-
-
Save themoxman/683edb07a3f42a982549 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
# example from: https://relishapp.com/rspec/rspec-mocks/v/2-14/docs/ | |
# wrote the code to make their example spec pass | |
class Account | |
attr_accessor :logger | |
def close | |
logger.account_closed(self) | |
end | |
def account_closed(something) | |
end | |
end | |
describe Account do | |
context "when closed" do | |
it "logs an 'account closed' message" do | |
logger = double() | |
account = Account.new | |
account.logger = logger | |
logger.should_receive(:account_closed).with(account) | |
account.close | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment