Restore user features to default after acceptance test.

Fixes an issue that could come up when running the tests
several times.
This commit is contained in:
Shane Kilkelly 2017-09-01 14:45:54 +01:00
parent f7073c4a3c
commit 7bb4638186
2 changed files with 8 additions and 0 deletions

View file

@ -35,6 +35,8 @@ describe "ProjectFeatures", ->
describe "with an upgraded account", ->
before (done) ->
@owner.upgradeFeatures done
after (done) ->
@owner.defaultFeatures done
it "should have premium features", (done) ->
joinProject @owner._id, @project_id, (error, response, body) ->
@ -47,6 +49,8 @@ describe "ProjectFeatures", ->
describe "with an basic account", ->
before (done) ->
@owner.downgradeFeatures done
after (done) ->
@owner.defaultFeatures done
it "should have basic features", (done) ->
joinProject @owner._id, @project_id, (error, response, body) ->

View file

@ -79,6 +79,10 @@ class User
}
db.users.update {_id: ObjectId(@id)}, { $set: { features: features }}, callback
defaultFeatures: (callback = (error) -> ) ->
features = settings.defaultFeatures
db.users.update {_id: ObjectId(@id)}, { $set: { features: features }}, callback
createProject: (name, callback = (error, project_id) ->) ->
@request.post {
url: "/project/new",