 
 describe 'loadingBarInterceptor Service', ->
 
-  $http = $httpBackend = $document = $timeout = result = loadingBar = null
+  $http = $httpBackend = $document = $timeout = result = loadingBar = $animate = null
   response = {message:'OK'}
   endpoint = '/service'
 
   beforeEach ->
-    module 'chieffancypants.loadingBar', (cfpLoadingBarProvider) ->
+    module 'ngAnimateMock', 'chieffancypants.loadingBar', (cfpLoadingBarProvider) ->
       loadingBar = cfpLoadingBarProvider
       return
 
     result = null
-    inject (_$http_, _$httpBackend_, _$document_, _$timeout_) ->
+    inject (_$http_, _$httpBackend_, _$document_, _$timeout_, _$animate_) ->
       $http = _$http_
       $httpBackend = _$httpBackend_
       $document = _$document_
       $timeout = _$timeout_
+      $animate = _$animate_
 
   beforeEach ->
     this.addMatchers

    $httpBackend.flush(1)
    expect(cfpLoadingBar.status()).toBe 1
    $timeout.flush()


    $httpBackend.expectPOST(endpoint).respond response

    cfpLoadingBar.start()
    $timeout.flush()
    $animate.triggerCallbacks()

    expect(isLoadingBarInjected($document.find(cfpLoadingBar.parentSelector))).toBe true

    cfpLoadingBar.complete()
    $timeout.flush()
    $animate.triggerCallbacks()

    expect(isLoadingBarInjected($document.find(cfpLoadingBar.parentSelector))).toBe false

