Prevent deleting 'uncategorized' category

This commit is contained in:
verg
2013-12-17 15:36:15 -05:00
parent 65014a03ca
commit 8a830fb8e3
5 changed files with 16 additions and 3 deletions

View File

@ -800,6 +800,12 @@ describe Guardian do
Guardian.new(moderator).can_delete?(category).should be_false
end
it "can't be deleted if it is the Uncategorizied Category" do
uncategorized_cat_id = SiteSetting.uncategorized_category_id
uncategorized_category = Category.find(uncategorized_cat_id)
Guardian.new(admin).can_delete?(uncategorized_category).should be_false
end
end
context 'can_suspend?' do