From a88a31a1b232a303ec273a5c60f4967f11b92bc5 Mon Sep 17 00:00:00 2001 From: Juanfran Date: Mon, 11 May 2015 10:38:17 +0200 Subject: [PATCH] userService in profileContact instead of rs --- .../profile-contacts.controller.coffee | 6 +++--- .../profile-contacts.controller.spec.coffee | 14 ++++++-------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/app/modules/profile/profile-contacts/profile-contacts.controller.coffee b/app/modules/profile/profile-contacts/profile-contacts.controller.coffee index d14882b5..e82d8d3f 100644 --- a/app/modules/profile/profile-contacts/profile-contacts.controller.coffee +++ b/app/modules/profile/profile-contacts/profile-contacts.controller.coffee @@ -1,15 +1,15 @@ class ProfileContactsController @.$inject = [ - "tgResources", + "tgUserService", "$tgAuth" ] - constructor: (@rs, @auth) -> + constructor: (@userService, @auth) -> loadContacts: () -> userId = @auth.getUser().id - @rs.users.getContacts(userId) + @userService.getContacts(userId) .then (contacts) => @.contacts = contacts diff --git a/app/modules/profile/profile-contacts/profile-contacts.controller.spec.coffee b/app/modules/profile/profile-contacts/profile-contacts.controller.spec.coffee index 44e0ea33..2e60f51e 100644 --- a/app/modules/profile/profile-contacts/profile-contacts.controller.spec.coffee +++ b/app/modules/profile/profile-contacts/profile-contacts.controller.spec.coffee @@ -5,14 +5,12 @@ describe "ProfileContacts", -> $rootScope = null mocks = {} - _mockResources = () -> - mocks.resources = { - users: { - getContacts: sinon.stub() - } + _mockUserService = () -> + mocks.userServices = { + getContacts: sinon.stub() } - provide.value "tgResources", mocks.resources + provide.value "tgUserService", mocks.userServices _mockAuthService = () -> stub = sinon.stub() @@ -26,7 +24,7 @@ describe "ProfileContacts", -> _mocks = () -> module ($provide) -> provide = $provide - _mockResources() + _mockUserService() _mockAuthService() return null @@ -50,7 +48,7 @@ describe "ProfileContacts", -> {id: 3} ] - mocks.resources.users.getContacts = (userId) -> + mocks.userServices.getContacts = (userId) -> expect(userId).to.be.equal(userId) return $q (resolve, reject) ->