|
@@ -29,6 +29,7 @@ describe "LimitationsManager", ->
|
|
|
'../../models/User' : User: @User
|
|
'../../models/User' : User: @User
|
|
|
'./SubscriptionLocator':@SubscriptionLocator
|
|
'./SubscriptionLocator':@SubscriptionLocator
|
|
|
'settings-sharelatex' : @Settings = {}
|
|
'settings-sharelatex' : @Settings = {}
|
|
|
|
|
+ "../Collaborators/CollaboratorsHandler": @CollaboratorsHandler = {}
|
|
|
'logger-sharelatex':log:->
|
|
'logger-sharelatex':log:->
|
|
|
|
|
|
|
|
describe "allowedNumberOfCollaboratorsInProject", ->
|
|
describe "allowedNumberOfCollaboratorsInProject", ->
|
|
@@ -51,22 +52,10 @@ describe "LimitationsManager", ->
|
|
|
|
|
|
|
|
it "should return the number of collaborators the user is allowed", ->
|
|
it "should return the number of collaborators the user is allowed", ->
|
|
|
@callback.calledWith(null, @user.features.collaborators).should.equal true
|
|
@callback.calledWith(null, @user.features.collaborators).should.equal true
|
|
|
-
|
|
|
|
|
- describe "currentNumberOfCollaboratorsInProject", ->
|
|
|
|
|
- beforeEach ->
|
|
|
|
|
- @project.collaberator_refs = ["one", "two"]
|
|
|
|
|
- @project.readOnly_refs = ["three"]
|
|
|
|
|
- @callback = sinon.stub()
|
|
|
|
|
- @LimitationsManager.currentNumberOfCollaboratorsInProject(@project_id, @callback)
|
|
|
|
|
-
|
|
|
|
|
- it "should return the total number of collaborators", ->
|
|
|
|
|
- @callback.calledWith(null, 3).should.equal true
|
|
|
|
|
|
|
|
|
|
describe "canAddXCollaborators", ->
|
|
describe "canAddXCollaborators", ->
|
|
|
beforeEach ->
|
|
beforeEach ->
|
|
|
- sinon.stub @LimitationsManager,
|
|
|
|
|
- "currentNumberOfCollaboratorsInProject",
|
|
|
|
|
- (project_id, callback) => callback(null, @current_number)
|
|
|
|
|
|
|
+ @CollaboratorsHandler.getCollaboratorCount = (project_id, callback) => callback(null, @current_number)
|
|
|
sinon.stub @LimitationsManager,
|
|
sinon.stub @LimitationsManager,
|
|
|
"allowedNumberOfCollaboratorsInProject",
|
|
"allowedNumberOfCollaboratorsInProject",
|
|
|
(project_id, callback) => callback(null, @allowed_number)
|
|
(project_id, callback) => callback(null, @allowed_number)
|