FIX: You shouldn't be able to add a parent to Uncategorized

This commit is contained in:
Robin Ward
2014-07-15 15:19:17 -04:00
parent 6d7531f690
commit c6df00a5cc
6 changed files with 45 additions and 15 deletions

View File

@@ -116,7 +116,7 @@ describe Category do
end
it "lists all secured categories correctly" do
uncategorized = Category.first
uncategorized = Category.find(SiteSetting.uncategorized_category_id)
group.add(user)
category.set_permissions(group.id => :full)
@@ -370,6 +370,19 @@ describe Category do
end
end
describe "uncategorized" do
let(:cat) { Category.where(id: SiteSetting.uncategorized_category_id).first }
it "reports as `uncategorized?`" do
cat.should be_uncategorized
end
it "cannot have a parent category" do
cat.parent_category_id = Fabricate(:category).id
cat.should_not be_valid
end
end
describe "parent categories" do
let(:user) { Fabricate(:user) }
let(:parent_category) { Fabricate(:category, user: user) }