title: How do I represent my controller in a Jasmine/Karma test
body: <p>I am trying to test my AngularJS controller using Jasmine with Karma.
  When I try the <a href="https://docs.angularjs.org/guide/controller" rel="nofollow">documented procedure</a> for configuring a controller test, the $scope is not being created. Actually it looks like the before is not executing at all.</p>
  
  <p>Here is my controller declaration:</p>
  
  <pre><code>angular.module("myApp", ["ngCookies"])
         .controller("myCtrl", function($scope, $window, $location, MyService, 
                     $timeout, $log, $cookies, $q) {
  </code></pre>
  
  <p>My test looks like this:</p>
  
  <pre><code>describe("MyController test", function() {
  var $scope;
  
  beforeEach(
      module("myApp", ["ngCookies"]));
  beforeEach(inject(function($rootScope, $controller) {
      $scope = $rootScope.$new(); // It looks like this is never called
      scope =$scope;
      $controller("myCtrl", {$scope: $scope});
  }));
  it("Checks the state of various units", function() {
  
      ...
  });
  </code></pre>
  
  <p>It looks like the beforeEach stuff is never called. I presume I need to inject the rest of my properties into the controller, but if so, I am not sure how.</p>
  
  <p>This is the error in the Test Run log</p>
  
  <pre><code>FAILED MyController test Checks myFunction starting from blank state
  Error: [$injector:modulerr] Failed to instantiate module ngCookies due to:
  Error: [ng:areq] Argument 'fn' is not a function, got string
  http://errors.angularjs.org/1.3.14/ng/areqp0=fn&amp;p1=not%20a%20function%2C%20got%20string
  </code></pre>