Skip to content

Instantly share code, notes, and snippets.

@jackinf
Created September 5, 2014 15:04
Show Gist options
  • Save jackinf/7b3df45e1eb030f9584a to your computer and use it in GitHub Desktop.
Save jackinf/7b3df45e1eb030f9584a to your computer and use it in GitHub Desktop.
[JASMINE, ANGULAR] My Angular spec template
describe("jsTests:", function () {
var $scope, $controller, $httpBackend, $injector;
var myService;
beforeEach(function () {
module("kn");
});
beforeEach(function () {
this.addMatchers({
toEqualData: function (expect) {
return angular.equals(expect, this.actual);
}
});
});
// ReSharper disable InconsistentNaming
beforeEach(inject(function ($rootScope, _$controller_, _$httpBackend_, _$injector_) {
// ReSharper restore InconsistentNaming
$scope = $rootScope.$new();
$controller = _$controller_;
$httpBackend = _$httpBackend_;
$injector = _$injector_;
myService = $injector.get("MyService");
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment