Skip to content

Instantly share code, notes, and snippets.

@sdornan
Last active December 21, 2015 19:58
Show Gist options
  • Save sdornan/6357515 to your computer and use it in GitHub Desktop.
Save sdornan/6357515 to your computer and use it in GitHub Desktop.
# use require to load any .js file available to the asset pipeline
#= require jquery
#= require controllers
#= require angular-mocks
describe "App controllers", ->
$httpBackend
beforeEach inject ($injector) ->
$httpBackend = $injector.get('$httpBackend')
$rootScope = $injector.get('$rootScope')
$controller = $injector.get('$controller')
afterEach ->
$httpBackend.verifyNoOutstandingExpectation()
$httpBackend.verifyNoOutstandingRequest()
describe 'HomeCtrl', ->
beforeEach ->
$httpBackend.when('GET', 'api/2/queue').respond([{title: 'The Kitchen'},
{title: 'The Lady Iron Chef'}])
it "should fetch the user's queue", inject ->
$httpBackend.expectGET('api/2/queue')
controller = $controller('HomeCtrl', {'$scope': $rootScope})
$httpBackend.flush()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment