FEATURE: new 'poll_maximum_options' site setting to limit the number of options in a poll

This commit is contained in:
Régis Hanol
2015-05-01 16:44:51 +02:00
parent f83638c154
commit 2954c99a1e
4 changed files with 27 additions and 1 deletions

View File

@ -37,6 +37,18 @@ describe PostsController do
expect(json["errors"][0]).to eq(I18n.t("poll.default_poll_must_have_at_least_2_options"))
end
it "should have at most 'SiteSetting.poll_maximum_options' options" do
raw = "[poll]"
(SiteSetting.poll_maximum_options + 1).times { |n| raw << "\n- #{n}" }
raw << "[/poll]"
xhr :post, :create, { title: title, raw: raw }
expect(response).not_to be_success
json = ::JSON.parse(response.body)
expect(json["errors"][0]).to eq(I18n.t("poll.default_poll_must_have_less_options", max: SiteSetting.poll_maximum_options))
end
describe "edit window" do
describe "within the first 5 minutes" do