Hello I am writing my first angular test with Jasmine but I keep getting the error
------ Test started: File: C:\\Users\\Regan\\Documents\\Visual Studio 2013\\WebSit
You haven't defined scope anywhere to pass into the controller
describe("MainCtrl with inline mock", function () {
beforeEach(module("ChartApp"));
var ctrl, mockDataSrv;
beforeEach(module(function($provide) {
mockDataSrv = {
labels: ["Reading", "Coding", "Thinking About Coding", "Reddit", "StackOverflow"],
data: [500, 300, 300, 40, 220],
type: "PolarArea",
title: "Angular Chart Expriment"
};
$provide.value("DataSrv", mockDataSrv);
}));
var scope; //<--- define scope
beforeEach(inject(function ($controller, $rootScope) {
scope = $rootScope.$new(); //<--- initialize scope
ctrl = $controller("MainCtrl", {$scope: scope}); //<--- inject scope
}));
it("should have lables", function () {
expect(scope.labels).toBeDefined();
});
});