I\'m testing service A, but service A depends on service B (i.e. service B is injected into service A).
I\'ve seen this question but my case is a bit different becau
This is what worked for me. The key is defining a real module to be mocked. Calling angular.mock.module makes the real module mockable and allows things to be connected.
beforeEach( ->
@weather_service_url = '/weather_service_url'
@weather_provider_url = '/weather_provider_url'
@weather_provider_image = "test.jpeg"
@http_ret = 'http_works'
module = angular.module('mockModule',[])
module.value('weather_service_url', @weather_service_url)
module.value('weather_provider_url', @weather_provider_url)
module.value('weather_provider_image', @weather_provider_image)
module.service('weather_bug_service', services.WeatherBugService)
angular.mock.module('mockModule')
inject( ($httpBackend,weather_bug_service) =>
@$httpBackend = $httpBackend
@$httpBackend.when('GET', @weather_service_url).respond(@http_ret)
@subject = weather_bug_service
)
)