From b911e303ecad8b7b54589e26f3c551395bf47405 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 28 Dec 2011 10:27:38 -0800 Subject: feat($httpBackend): add expect/when shortcut methods --- test/angular-mocksSpec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') diff --git a/test/angular-mocksSpec.js b/test/angular-mocksSpec.js index 88e6a590..32cfe933 100644 --- a/test/angular-mocksSpec.js +++ b/test/angular-mocksSpec.js @@ -750,6 +750,21 @@ describe('mocks', function() { }); + describe('expect/when shorcuts', function() { + angular.forEach(['expect', 'when'], function(prefix) { + angular.forEach(['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'JSONP'], function(method) { + var shortcut = prefix + method; + it('should provide ' + shortcut + ' shortcut method', function() { + hb[shortcut]('/foo').respond('bar'); + hb(method, '/foo', undefined, callback); + hb.flush(); + expect(callback).toHaveBeenCalledOnceWith(200, 'bar', ''); + }); + }); + }); + }); + + describe('MockHttpExpectation', function() { it('should accept url as regexp', function() { -- cgit v1.2.3