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

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

File tree

2 files changed

lines changed

2 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -7,8 +7,11 @@ describe 'Controller: <%= classedName %>Ctrl', ->

77
88

<%= classedName %>Ctrl = {}

99
10+

scope = {}

11+
1012

# Initialize the controller and a mock scope

1113

beforeEach inject ($controller, $rootScope) ->

14+

scope = $rootScope.$new()

1215

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

1316

# place here mocked dependencies

1417

}

Original file line numberDiff line numberDiff line change

@@ -1,12 +1,12 @@

11

'use strict';

22
33

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

4-

var scope;

54
65

// load the controller's module

76

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

87
9-

var <%= classedName %>Ctrl;

8+

var <%= classedName %>Ctrl,

9+

scope;

1010
1111

// Initialize the controller and a mock scope

1212

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