Просмотр исходного кода

Restore user features to default after acceptance test.

Fixes an issue that could come up when running the tests
several times.
Shane Kilkelly 9 лет назад
Родитель
Сommit
7bb4638186

+ 4 - 0
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) ->

+ 4 - 0
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",