I want to make an integration test with real calls to my server, so, I
don't want to use the $httpBackend service from angular-mocks, So I try
this:
beforeEach(inject(function($rootScope,_MembersDataSvc_){
service = _MembersDataSvc_;}));
it('test',function(done){
service.me().then(function(){done();});});
And the service is:
function me() {
return $http
.get('urlBase/me')
.then(meSuccess);
function meSuccess(response) {
return response.data.members[0];
}
}
This never call the $http, it seems that angular-mocks override the $http
service an never made the call.
And make something like this:
var $httpBackend, $http;
beforeEach(inject(function($rootScope,_MembersDataSvc_, _$httpBackend_, $http){
service = _MembersDataSvc_;
$httpBackend = _$httpBackend_;}));
it('test',function(done){
service.me().then(function(){done();});
$http.whenPOST('urlBase/me').respond(200, { members: [{}] });
$httpBackend.flush();});
Never call my server, so, I don't want to use $httpBackend services from
angular-mock.
Some ideas?
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.