A newbie Jasmine/Angular question.
I have a named function within a controller like so:
.controller( 'DummyCtrl', function DummyCtrl($scope){
var doSomething = function() {
return "blah";
};
})
I need to test this function, and am trying to by calling the following Jasmine spec:
describe ('myApp', function(){
var $scope, $controller;
var DummyCtrl;
beforeEach(module('myApp'));
describe('controllers', function(){
beforeEach(inject(function ($controller, $rootScope){
$scope = $rootScope.$new();
DummyCtrl = $controller('DummyCtrl', {$scope: $scope});
}));
describe( 'DummyCtrl', function(){
var blah;
beforeEach(function(){
blah = DummyCtrl.doSomething();
});
it('should do something', function(){
expect(blah).toContain("blah");
});
});
});
});
Instead of things working out, I result in the following error: TypeError: Object #<DummyCtrl> has no method 'doSomething'. I'm assuming this is something super simple that I'm not understanding.