     beforeEach module cfg.ngApp
 
     beforeEach inject ($injector) ->
+      $location = $injector.get '$location'
       $q = $injector.get '$q'
       $rootScope = $injector.get '$rootScope'
       factory = $injector.get 'menuFactory'

  'factory/menu-factory'
], (cfg, A) ->
  describe 'Menu factory', () ->
    $q = null
    $rootScope = null
    factory = null


      factory.set dfd, data

      $rootScope.$digest()

    it 'should update the selected item if the location changes', () ->
      dfd = $q.defer()

      dfd.promise.then () ->
        items = factory.get()
        item = items[2]

        $location.path item.href

        $rootScope.$emit '$locationChangeSuccess'

        expect(factory.selectedItem.href).toBe item.href

      factory.set dfd, data

      $rootScope.$digest()