@@ -2429,7 +2429,7 @@ describe('ngMock', function() {
24292429
24302430describe ( 'ngMockE2E' , function ( ) {
24312431 describe ( '$httpBackend' , function ( ) {
2432- var hb , realHttpBackend , realHttpBackendBrowser , callback ;
2432+ var hb , realHttpBackend , realHttpBackendBrowser , $http , callback ;
24332433
24342434 beforeEach ( function ( ) {
24352435 callback = jasmine . createSpy ( 'callback' ) ;
@@ -2442,10 +2442,29 @@ describe('ngMockE2E', function() {
24422442 module ( 'ngMockE2E' ) ;
24432443 inject ( function ( $injector ) {
24442444 hb = $injector . get ( '$httpBackend' ) ;
2445+ $http = $injector . get ( '$http' ) ;
24452446 } ) ;
24462447 } ) ;
24472448
24482449
2450+ it ( 'should throw error when unexpected request - without error callback' , function ( ) {
2451+ expect ( function ( ) {
2452+ $http . get ( '/some' ) . then ( noop ) ;
2453+
2454+ hb . verifyNoOutstandingRequest ( ) ;
2455+ } ) . toThrowError ( 'Unexpected request: GET /some\nNo more request expected' ) ;
2456+ } ) ;
2457+
2458+
2459+ it ( 'should throw error when unexpected request - with error callback' , function ( ) {
2460+ expect ( function ( ) {
2461+ $http . get ( '/some' ) . then ( noop , noop ) ;
2462+
2463+ hb . verifyNoOutstandingRequest ( ) ;
2464+ } ) . toThrowError ( 'Unexpected request: GET /some\nNo more request expected' ) ;
2465+ } ) ;
2466+
2467+
24492468 describe ( 'passThrough()' , function ( ) {
24502469 it ( 'should delegate requests to the real backend when passThrough is invoked' , function ( ) {
24512470 var eventHandlers = { progress : angular . noop } ;
0 commit comments