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

Commit 76b213e

Browse files
committed
fix(app): create new $scope for controller tests
Fix also the CoffeeScript controller template.
1 parent 1067645 commit 76b213e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

templates/coffeescript/spec/controller.coffee

+3
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
}

templates/javascript/spec/controller.js

+2-2
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) {

0 commit comments

Comments
 (0)