Created
February 5, 2012 21:26
-
-
Save yashke/1748016 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ServerSideStub | |
createToken: (callback) => | |
callback("token") | |
describe "SomeUsecase", -> | |
beforeEach -> | |
@serverSide = new ServerSideStub() | |
@usecase = new SomeUsecase(@serverSide) | |
describe "#execute", -> | |
it "should call ServerSide#createToken", -> | |
spyOn(@serverSide, 'createToken') | |
@usecase.execute("kaka") | |
expect(@serverSide.createToken).toHaveBeenCalled() | |
it "should run #doSmthWith as callback with name and returned token", -> | |
spyOn(@usecase, 'doSmthWith').andFakeCall(=> null) | |
@usecase.execute("kaka") | |
expect(@usecase.doSmthWith).toHaveBeenCalledWith("token", "name") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment