title: TypeError: Attempted to assign to readonly property
body: <p>I'm facing this error when writing a test for a directive (using <code>generator-angular-module</code>):</p>
  
  <p><strong>src/capitalize.js:</strong></p>
  
  <pre><code>'use strict';
  
  angular.module('jviotti.string', []).filter('capitalize', function() {
  
    return function(input) {
      return input.replace(/\w\S*/g, function(txt) {
        return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
      });
    };
  
  });
  </code></pre>
  
  <p><strong>test/spec/capitalize.js:</strong></p>
  
  <pre><code>'use strict';
  
  describe('Filter: capitalize', function () {
  
    // load the controller's module
    beforeEach(module('jviotti.string'));
  
    var capitalize;
    beforeEach(inject(function($filter) {
      capitalize = $filter('capitalize');
    }));
  
    it('should capitalize a string', function () {
      expect(capitalize('hello')).toBe('Hello');
    });
  
  });
  </code></pre>
  
  <p>However, when running Karma with PhantomJS I get:</p>
  
  <pre><code>PhantomJS 1.9.2 (Mac OS X) Filter: capitalize should capitalize a string FAILED
      TypeError: Attempted to assign to readonly property.
          at workFn (/Users/jviotti/Projects/angular-string/bower_components/angular-mocks/angular-mocks.js:2107)
      TypeError: 'undefined' is not a function (evaluating 'capitalize('hello')')
          at /Users/jviotti/Projects/angular-string/test/spec/capitalize.js:14
  PhantomJS 1.9.2 (Mac OS X): Executed 2 of 2 (1 FAILED) (0.1 secs / 0.017 secs)
  </code></pre>
  
  <p>What am I missing?</p>