FEATURE: Category setting to make all topics wikis

FEATURE: Category setting to make all topics wikis
This commit is contained in:
Joe Buhlig
2016-12-18 07:38:55 -06:00
parent ddd299f4aa
commit 87251fded7
10 changed files with 29 additions and 1 deletions

View File

@ -34,6 +34,14 @@ describe PostCreator do
expect(TopicUser.where(user_id: p.user_id, topic_id: p.topic_id).count).to eq(0)
end
it "can be created with first post as wiki" do
cat = Fabricate(:category)
cat.all_topics_wiki = true
cat.save
post = PostCreator.create(user, basic_topic_params.merge(category: cat.id ))
expect(post.wiki).to eq(true)
end
it "ensures the user can create the topic" do
Guardian.any_instance.expects(:can_create?).with(Topic,nil).returns(false)
expect { creator.create }.to raise_error(Discourse::InvalidAccess)