mardi 30 juin 2015

spec is undefined in file:///E:/jasmine-standalone-2.3.4/lib/angularjs/angular-mocks.js

I am new to Jasmine and have started testing my angular applications.I am persistently getting the error spec is undefined in file:///E:/jasmine-standalone-2.3.4/lib/angularjs/angular-mocks.js

and have been unable to identify the problem.

here are the parts of my SpecRunner.html file

<script src="lib/jasmine-2.3.4/jasmine.js"></script>
<script src="lib/jasmine-2.3.4/jasmine-html.js"></script>
<script src="lib/jasmine-2.3.4/boot.js"></script>

<script src="lib/angularjs/angular.min.js"></script>
<script src="lib/angularjs/angular-mocks.js"></script>



<!-- include source files here... -->
<script src="src/scribePanelController.js"></script>


<!-- include spec files here... -->
<script src="spec/scribePanelControllerSpec.js"></script>

and here is the code from spec file

'use strict';

 describe("scribePanelController", function() {

var $rootScope, $scope,$compile;
var $controller, service;

// Load the module
beforeEach(module('scribeModule'));

    beforeEach(inject(function(_$compile_,_$rootScope_,_$controller_,_scribePanelSharedService_){
// The injector unwraps the underscores (_) from around the parameter names when matching
    $compile = _$compile_;
    $rootScope = _$rootScope_;
    $scope = $rootScope.$new();
    $controller = _$controller_;
    service = _scribePanelSharedService_;

    $controller('scribePanelController', { '$scope': $scope,'myScribePanelSharedService': service});
    $rootScope.$apply(); // promises are resolved/dispatched only on next $digest cycle
}));

it('should check whether controller exists', function() {
    expect($controller).not.toBeNull();
});

it('it should make isMoreAsmtPresent false', function() {
    expect($scope.service.isMoreAsmtPresent == 'active');
  });

});

Aucun commentaire:

Enregistrer un commentaire