fix(app): create new $scope for controller tests · yeoman/generator-angular@1067645

This repository was archived by the owner on Mar 26, 2018. It is now read-only.

File tree

1 file changed

lines changed

  • templates/javascript/spec

1 file changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -1,6 +1,7 @@

11

'use strict';

22
33

describe('Controller: <%= classedName %>Ctrl', function () {

4+

var scope;

45
56

// load the controller's module

67

beforeEach(module('<%= scriptAppName %>'));

@@ -9,7 +10,9 @@ describe('Controller: <%= classedName %>Ctrl', function () {

910
1011

// Initialize the controller and a mock scope

1112

beforeEach(inject(function ($controller, $rootScope) {

13+

scope = $rootScope.$new();

1214

<%= classedName %>Ctrl = $controller('<%= classedName %>Ctrl', {

15+

$scope: scope

1316

// place here mocked dependencies

1417

});

1518

}));