I am unable to use inject in my tests.
Both angular and angular-mocks are version 1.3.14
I am completely lost here. Any ideas will be greatly appreciated!
This causes an error:
describe("factory: Account", function () {
var $httpBackend;
var $rootScope;
var Account;
beforeEach(module('app'));
beforeEach(inject(function() {
// $httpBackend = _$httpBackend_;
}));
it("Should fetch account", function() {
});
});
But if I remove inject it will pass:
describe("factory: Account", function () {
var $httpBackend;
var $rootScope;
var Account;
beforeEach(module('app'));
beforeEach(function() {
// $httpBackend = _$httpBackend_;
});
it("Should fetch account", function() {
});
});
In Gruntfile.js:
karma: {
unit: {
options: {
frameworks: ['jasmine'],
singleRun: true,
browsers: ['Safari'],
files: [
'bower_components/angular/angular.js',
'bower_components/angular-mocks/angular-mocks.js',
'bower_components/moment/moment.js',
'bower_components/ckeditor/ckeditor.js',
'bower_components/ng-ckeditor/ng-ckeditor.min.js',
'app/app.js',
'app/**/*.js',
]
}
}
}
Here is the output of the test:
Safari 8.0.5 (Mac OS X 10.10.3) factory: Account Should fetch account FAILED
/.../bower_components/angular/angular.js:63:32
/.../bower_components/angular/angular.js:4120:30
forEach@/.../bower_components/angular/angular.js:323:24
loadModules@/.../bower_components/angular/angular.js:4081:12
createInjector@/.../bower_components/angular/angular.js:4007:22
workFn@/.../bower_components/angular-mocks/angular-mocks.js:2353:60