{"action":"closed","issue":{"url":"https://api.github.com/repos/evangalen/ng-improved-testing/issues/15","labels_url":"https://api.github.com/repos/evangalen/ng-improved-testing/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/evangalen/ng-improved-testing/issues/15/comments","events_url":"https://api.github.com/repos/evangalen/ng-improved-testing/issues/15/events","html_url":"https://github.com/evangalen/ng-improved-testing/issues/15","id":53572226,"number":15,"title":"$httpBackend doesn't work with mocks enabled","user":{"login":"harjup","id":2883150,"avatar_url":"https://avatars.githubusercontent.com/u/2883150?v=3","gravatar_id":"","url":"https://api.github.com/users/harjup","html_url":"https://github.com/harjup","followers_url":"https://api.github.com/users/harjup/followers","following_url":"https://api.github.com/users/harjup/following{/other_user}","gists_url":"https://api.github.com/users/harjup/gists{/gist_id}","starred_url":"https://api.github.com/users/harjup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harjup/subscriptions","organizations_url":"https://api.github.com/users/harjup/orgs","repos_url":"https://api.github.com/users/harjup/repos","events_url":"https://api.github.com/users/harjup/events{/privacy}","received_events_url":"https://api.github.com/users/harjup/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/evangalen/ng-improved-testing/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"evangalen","id":1895520,"avatar_url":"https://avatars.githubusercontent.com/u/1895520?v=3","gravatar_id":"","url":"https://api.github.com/users/evangalen","html_url":"https://github.com/evangalen","followers_url":"https://api.github.com/users/evangalen/followers","following_url":"https://api.github.com/users/evangalen/following{/other_user}","gists_url":"https://api.github.com/users/evangalen/gists{/gist_id}","starred_url":"https://api.github.com/users/evangalen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evangalen/subscriptions","organizations_url":"https://api.github.com/users/evangalen/orgs","repos_url":"https://api.github.com/users/evangalen/repos","events_url":"https://api.github.com/users/evangalen/events{/privacy}","received_events_url":"https://api.github.com/users/evangalen/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/evangalen/ng-improved-testing/milestones/9","labels_url":"https://api.github.com/repos/evangalen/ng-improved-testing/milestones/9/labels","id":932548,"number":9,"title":"0.3.0-beta.4","description":null,"creator":{"login":"evangalen","id":1895520,"avatar_url":"https://avatars.githubusercontent.com/u/1895520?v=3","gravatar_id":"","url":"https://api.github.com/users/evangalen","html_url":"https://github.com/evangalen","followers_url":"https://api.github.com/users/evangalen/followers","following_url":"https://api.github.com/users/evangalen/following{/other_user}","gists_url":"https://api.github.com/users/evangalen/gists{/gist_id}","starred_url":"https://api.github.com/users/evangalen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evangalen/subscriptions","organizations_url":"https://api.github.com/users/evangalen/orgs","repos_url":"https://api.github.com/users/evangalen/repos","events_url":"https://api.github.com/users/evangalen/events{/privacy}","received_events_url":"https://api.github.com/users/evangalen/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":4,"state":"open","created_at":"2015-01-12T23:29:53Z","updated_at":"2015-01-12T23:35:24Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-01-06T22:31:35Z","updated_at":"2015-01-12T23:35:24Z","closed_at":"2015-01-12T23:35:24Z","body":"I'm trying to test a service that has dependencies on external services as well as $http. When I test http requests through $httpBackend, it doesn't work. \r\n\r\nIf I don't exclude $http, a mock object is generated. If I do, it's not wired up to $httpBackend correctly and requests are not properly flushed.\r\n\r\nHere are two tests illustrating the issue, the first one does not work, while the second one does:\r\n\r\n    describe('$httpBackend', function() {\r\n        describe('with mocked services', function(){\r\n    \r\n            beforeEach(ModuleBuilder.forModule('myApp')\r\n                .serviceWithMocksExcept('userService', '$http')\r\n                .build());\r\n    \r\n            it('should work', inject(function(userService, $httpBackend) {\r\n                //userService automatically does an $http call on startup\r\n                $httpBackend.expectGET('/users').respond(200);\r\n                $httpBackend.flush();\r\n            }));\r\n        });\r\n\r\n        describe('withoutMocks', function(){\r\n            beforeEach(module('myApp'));\r\n\r\n            it('should work', inject(function($httpBackend, userService) {\r\n                //userService automatically does an $http call on startup\r\n                $httpBackend.expectGET('/users').respond(200);\r\n                $httpBackend.flush();\r\n            }));\r\n        });\r\n    });\r\n\r\n\r\nResult: \r\n\r\n    $httpBackend with mocked services should work FAILED\r\n            Error: No pending request to flush !\r\n            at Function.$httpBackend.flush (.../angular-mocks.js:1452:34)\r\n            remaining stack trace...."}}