mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 11:48:08 +08:00
add spec for auto-close polls
This commit is contained in:
@ -35,6 +35,21 @@ describe PostsController do
|
|||||||
expect(json["polls"]["poll"]).to be
|
expect(json["polls"]["poll"]).to be
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "schedules auto-close job" do
|
||||||
|
name = "auto_close"
|
||||||
|
close_date = 1.month.from_now
|
||||||
|
|
||||||
|
post :create, params: {
|
||||||
|
title: title, raw: "[poll name=#{name} close=#{close_date.iso8601}]\n- A\n- B\n[/poll]"
|
||||||
|
}, format: :json
|
||||||
|
|
||||||
|
expect(response).to be_success
|
||||||
|
json = ::JSON.parse(response.body)
|
||||||
|
expect(json["polls"][name]["close"]).to be
|
||||||
|
|
||||||
|
expect(Jobs.scheduled_for(:close_poll, post_id: Post.last.id, poll_name: name)).to be
|
||||||
|
end
|
||||||
|
|
||||||
it "should have different options" do
|
it "should have different options" do
|
||||||
post :create, params: {
|
post :create, params: {
|
||||||
title: title, raw: "[poll]\n- A\n- A\n[/poll]"
|
title: title, raw: "[poll]\n- A\n- A\n[/poll]"
|
||||||
|
Reference in New Issue
Block a user