Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 349742b

Browse files
test($http): remove unused inject() calls
Closes #10611
1 parent 2ff7edf commit 349742b

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed

test/ng/httpSpec.js

+21-25
Original file line numberDiff line numberDiff line change
@@ -274,63 +274,59 @@ describe('$http', function() {
274274
describe('the instance', function() {
275275
var $httpBackend, $http, $rootScope;
276276

277-
beforeEach(inject(['$rootScope', function($rs) {
278-
$rootScope = $rs;
279-
280-
spyOn($rootScope, '$apply').andCallThrough();
281-
}]));
282-
283-
beforeEach(inject(['$httpBackend', '$http', function($hb, $h) {
277+
beforeEach(inject(['$httpBackend', '$http', '$rootScope', function($hb, $h, $rs) {
284278
$httpBackend = $hb;
285279
$http = $h;
280+
$rootScope = $rs;
281+
spyOn($rootScope, '$apply').andCallThrough();
286282
}]));
287283

288-
it('should throw error if the request configuration is not an object', inject(function($httpBackend, $http) {
284+
it('should throw error if the request configuration is not an object', function() {
289285
expect(function() {
290286
$http('/url');
291287
}).toThrowMinErr('$http','badreq', 'Http request configuration must be an object. Received: /url');
292-
}));
288+
});
293289

294-
it('should send GET requests if no method specified', inject(function($httpBackend, $http) {
290+
it('should send GET requests if no method specified', function() {
295291
$httpBackend.expect('GET', '/url').respond('');
296292
$http({url: '/url'});
297-
}));
293+
});
298294

299-
it('should do basic request', inject(function($httpBackend, $http) {
295+
it('should do basic request', function() {
300296
$httpBackend.expect('GET', '/url').respond('');
301297
$http({url: '/url', method: 'GET'});
302-
}));
298+
});
303299

304300

305-
it('should pass data if specified', inject(function($httpBackend, $http) {
301+
it('should pass data if specified', function() {
306302
$httpBackend.expect('POST', '/url', 'some-data').respond('');
307303
$http({url: '/url', method: 'POST', data: 'some-data'});
308-
}));
304+
});
309305

310306

311307
describe('params', function() {
312-
it('should do basic request with params and encode', inject(function($httpBackend, $http) {
308+
it('should do basic request with params and encode', function() {
313309
$httpBackend.expect('GET', '/url?a%3D=%3F%26&b=2').respond('');
314310
$http({url: '/url', params: {'a=':'?&', b:2}, method: 'GET'});
315-
}));
311+
});
316312

317313

318-
it('should merge params if url contains some already', inject(function($httpBackend, $http) {
314+
it('should merge params if url contains some already', function() {
319315
$httpBackend.expect('GET', '/url?c=3&a=1&b=2').respond('');
320316
$http({url: '/url?c=3', params: {a:1, b:2}, method: 'GET'});
321-
}));
317+
});
322318

323319

324-
it('should jsonify objects in params map', inject(function($httpBackend, $http) {
320+
it('should jsonify objects in params map', function() {
325321
$httpBackend.expect('GET', '/url?a=1&b=%7B%22c%22:3%7D').respond('');
326322
$http({url: '/url', params: {a:1, b:{c:3}}, method: 'GET'});
327-
}));
323+
});
328324

329325

330-
it('should expand arrays in params map', inject(function($httpBackend, $http) {
326+
it('should expand arrays in params map', function() {
331327
$httpBackend.expect('GET', '/url?a=1&a=2&a=3').respond('');
332328
$http({url: '/url', params: {a: [1,2,3]}, method: 'GET'});
333-
}));
329+
});
334330

335331

336332
it('should not encode @ in url params', function() {
@@ -763,7 +759,7 @@ describe('$http', function() {
763759
$httpBackend.flush();
764760
}));
765761

766-
it('should send execute result if header value is function', inject(function() {
762+
it('should send execute result if header value is function', function() {
767763
var headerConfig = {'Accept': function() { return 'Rewritten'; }};
768764

769765
function checkHeaders(headers) {
@@ -783,7 +779,7 @@ describe('$http', function() {
783779
$http({url: '/url', method: 'DELETE', headers: headerConfig});
784780

785781
$httpBackend.flush();
786-
}));
782+
});
787783

788784
it('should check the cache before checking the XSRF cookie', inject(function($browser, $cacheFactory) {
789785
var testCache = $cacheFactory('testCache'),

0 commit comments

Comments
 (0)