mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 09:57:25 +08:00
DEV: Improve flaky time-sensitive specs (#9141)
This commit is contained in:
@ -11,7 +11,6 @@ describe PostsController do
|
||||
end
|
||||
|
||||
describe "polls" do
|
||||
|
||||
it "works" do
|
||||
post :create, params: {
|
||||
title: title, raw: "[poll]\n- A\n- B\n[/poll]"
|
||||
@ -39,7 +38,7 @@ describe PostsController do
|
||||
it "schedules auto-close job" do
|
||||
freeze_time
|
||||
name = "auto_close"
|
||||
close_date = 1.month.from_now
|
||||
close_date = 1.month.from_now.round
|
||||
|
||||
expect do
|
||||
post :create, params: {
|
||||
@ -53,7 +52,7 @@ describe PostsController do
|
||||
json = ::JSON.parse(response.body)
|
||||
post_id = json["id"]
|
||||
|
||||
expect(Poll.find_by(post_id: post_id).close_at).to be_within_one_second_of(1.month.from_now)
|
||||
expect(Poll.find_by(post_id: post_id).close_at).to eq_time(close_date)
|
||||
|
||||
job = Jobs::ClosePoll.jobs.first
|
||||
job_args = job["args"].first
|
||||
|
Reference in New Issue
Block a user