From 7bb463818644d897cff950e958040eb1f9314d04 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 1 Sep 2017 14:45:54 +0100 Subject: [PATCH] Restore user features to default after acceptance test. Fixes an issue that could come up when running the tests several times. --- .../web/test/acceptance/coffee/ProjectFeaturesTests.coffee | 4 ++++ services/web/test/acceptance/coffee/helpers/User.coffee | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/services/web/test/acceptance/coffee/ProjectFeaturesTests.coffee b/services/web/test/acceptance/coffee/ProjectFeaturesTests.coffee index 78bc349c60..7caa48c0b7 100644 --- a/services/web/test/acceptance/coffee/ProjectFeaturesTests.coffee +++ b/services/web/test/acceptance/coffee/ProjectFeaturesTests.coffee @@ -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) -> diff --git a/services/web/test/acceptance/coffee/helpers/User.coffee b/services/web/test/acceptance/coffee/helpers/User.coffee index 6177837bea..b65dbecbed 100644 --- a/services/web/test/acceptance/coffee/helpers/User.coffee +++ b/services/web/test/acceptance/coffee/helpers/User.coffee @@ -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",