userService in profileContact instead of rs

stable
Juanfran 2015-05-11 10:38:17 +02:00
parent 5b0eb71fb1
commit a88a31a1b2
2 changed files with 9 additions and 11 deletions

View File

@ -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

View File

@ -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) ->