@@ -2429,7 +2429,7 @@ describe('ngMock', function() {
2429
2429
2430
2430
describe ( 'ngMockE2E' , function ( ) {
2431
2431
describe ( '$httpBackend' , function ( ) {
2432
- var hb , realHttpBackend , realHttpBackendBrowser , callback ;
2432
+ var hb , realHttpBackend , realHttpBackendBrowser , $http , callback ;
2433
2433
2434
2434
beforeEach ( function ( ) {
2435
2435
callback = jasmine . createSpy ( 'callback' ) ;
@@ -2442,10 +2442,29 @@ describe('ngMockE2E', function() {
2442
2442
module ( 'ngMockE2E' ) ;
2443
2443
inject ( function ( $injector ) {
2444
2444
hb = $injector . get ( '$httpBackend' ) ;
2445
+ $http = $injector . get ( '$http' ) ;
2445
2446
} ) ;
2446
2447
} ) ;
2447
2448
2448
2449
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
+
2449
2468
describe ( 'passThrough()' , function ( ) {
2450
2469
it ( 'should delegate requests to the real backend when passThrough is invoked' , function ( ) {
2451
2470
var eventHandlers = { progress : angular . noop } ;
0 commit comments