Skip to content

Instantly share code, notes, and snippets.

@thruflo
Created January 4, 2012 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thruflo/1561585 to your computer and use it in GitHub Desktop.
Save thruflo/1561585 to your computer and use it in GitHub Desktop.
# Jasmine specs for controllers go here
describe 'PhoneCat controllers', ->
describe 'PhoneListCtrl', ->
data = [name: 'Nexus S', name: 'Motorola DROID']
beforeEach =>
@scope = angular.scope()
@browser = @scope.$service '$browser'
request = @browser.xhr.expectGET 'phones/phones.json'
request.respond data
@ctrl = @scope.$new PhoneListCtrl
it 'should create "phones" model with 2 phones fetched from xhr', =>
expect(@ctrl.phones).toBeUndefined()
@browser.xhr.flush()
expect(@ctrl.phones).toEqual data
it 'should set the default value of orderProp model', =>
expect(@ctrl.orderProp).toBe 'age'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment