Skip to content

Instantly share code, notes, and snippets.

@searls
Created January 24, 2012 18:29
Show Gist options
  • Save searls/1671744 to your computer and use it in GitHub Desktop.
Save searls/1671744 to your computer and use it in GitHub Desktop.
describe "app.Agent", ->
Given -> @car = new Backbone.Model
Given -> spyOn(@car, "get")
Given -> @car.get.when('phone').thenReturn("123-456-789")
Given -> @car.get.when('name').thenReturn("juice")
Then -> expect(@car.get).toHaveBeenCalledWith('phone')
Then -> expect(@car.get).toHaveBeenCalledWith(jasmine.any(String))
Then -> expect(@car.get).toHaveBeenCalledWith jasmine.argThat (arg) ->
arg.length < 5
Then -> @car.get.mostRecentCall.arguments[0].length < 5
Given ->
When -> car.turn() #"YAY!"
Given -> @spy = jasmine.createSpy()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment