ES6: A bunch more controllers

This commit is contained in:
Robin Ward
2014-05-06 11:48:04 -04:00
parent a0221ce5e5
commit efcf99c21d
7 changed files with 44 additions and 42 deletions

View File

@ -13,10 +13,10 @@ var buildAdminUser = function(args) {
}, args || {}));
};
module("Discourse.FlagController canDeleteSpammer");
module("controller:flag canDeleteSpammer");
test("canDeleteSpammer not staff", function(){
var flagController = testController(Discourse.FlagController, buildPost());
var flagController = controllerFor('flag', buildPost());
this.stub(Discourse.User, 'currentProp').withArgs('staff').returns(false);
flagController.set('selected', Discourse.PostActionType.create({name_key: 'spam'}));
equal(flagController.get('canDeleteSpammer'), false, 'false if current user is not staff');
@ -29,7 +29,7 @@ var canDeleteSpammer = function(test, postActionType, expected, testName) {
test("canDeleteSpammer spam not selected", function(){
this.stub(Discourse.User, 'currentProp').withArgs('staff').returns(true);
this.flagController = testController(Discourse.FlagController, buildPost());
this.flagController = controllerFor('flag', buildPost());
this.flagController.set('userDetails', buildAdminUser({can_delete_all_posts: true, can_be_deleted: true}));
canDeleteSpammer(this, 'off_topic', false, 'false if current user is staff, but selected is off_topic');
canDeleteSpammer(this, 'inappropriate', false, 'false if current user is staff, but selected is inappropriate');
@ -39,7 +39,7 @@ test("canDeleteSpammer spam not selected", function(){
test("canDeleteSpammer spam selected", function(){
this.stub(Discourse.User, 'currentProp').withArgs('staff').returns(true);
this.flagController = testController(Discourse.FlagController, buildPost());
this.flagController = controllerFor('flag', buildPost());
this.flagController.set('userDetails', buildAdminUser({can_delete_all_posts: true, can_be_deleted: true}));
canDeleteSpammer(this, 'spam', true, 'true if current user is staff, selected is spam, posts and user can be deleted');