title: Angularjs ngMock inject before each test or on each test case?
body: <h1>Scenario</h1>
  
  <p>I'm currently writing tests for an Angular project, and almost on every article I find, I see them creating <em>"global"</em> variables in a <code>describe</code> block, where they store dependencies to be used in the tests, like this:</p>
  
  <pre><code>describe('Some tests', function() {
      var $controller, $rootScope
  
      beforeEach(angular.mock.module('myApp'))
      beforeEach(angular.mock.inject(function(_$controller_, _$rootScope_) {
          $controller = _$controller_
          $rootScope  = _$rootScope_
      }))
  
      it('uses $controller inside', function() {
          // ...
      })
      it('uses $rootScope inside', function() {
          // ...
      })
  })
  </code></pre>
  
  <p>I have found this to be ver DRY since it creates and shares a new instance of a service/factory/etc.. for tests to use. BUT when writing a lot of tests I've noticed that I create globals and then no longer use them, and forget to delete them in the <code>inject()</code> leaving this traces that may cause confusion down the line.</p>
  
  <h1>My Confusion</h1>
  
  <p>So I have been injecting the dependencies on each test case and then refactor in small <code>describe</code> blocks to globals that don't get out of hand, like this:</p>
  
  <pre><code>describe('Some tests', function() {
      beforeEach(angular.mock.module('myApp'))
  
      it('uses $controller inside', angular.mock.inject(function($controller) {
          // Test using the $controller
      }))
      it('uses $rootScope inside', angular.mock.inject(function($rootScope) {
          // Test using $rootScope
      }))
  })
  </code></pre>
  
  <p>And this has the added benefit of thing staying local and not having to use variables that have to be searched for where they are coming from, IMHO.</p>
  
  <h1>The Question</h1>
  
  <p>Is there any problem on injecting dependencies per test instead of inside a <code>beforeEach</code> block?</p>