DEV: fix chat message grace edit period flaky (#28095)
The message grace edit window (10 seconds) was too short after freezing time, possibly causing the test to fail occasionally if the record is not updated within 5 seconds.
This commit is contained in:
parent
56ecbcb8c9
commit
6f2f34f786
|
@ -871,7 +871,7 @@ RSpec.describe Chat::UpdateMessage do
|
||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
SiteSetting.chat_editing_grace_period = 10
|
SiteSetting.chat_editing_grace_period = 30
|
||||||
SiteSetting.chat_editing_grace_period_max_diff_low_trust = 10
|
SiteSetting.chat_editing_grace_period_max_diff_low_trust = 10
|
||||||
SiteSetting.chat_editing_grace_period_max_diff_high_trust = 40
|
SiteSetting.chat_editing_grace_period_max_diff_high_trust = 40
|
||||||
|
|
||||||
|
@ -949,7 +949,7 @@ RSpec.describe Chat::UpdateMessage do
|
||||||
let(:low_trust_char_limit) { SiteSetting.chat_editing_grace_period_max_diff_low_trust }
|
let(:low_trust_char_limit) { SiteSetting.chat_editing_grace_period_max_diff_low_trust }
|
||||||
let(:high_trust_char_limit) { SiteSetting.chat_editing_grace_period_max_diff_high_trust }
|
let(:high_trust_char_limit) { SiteSetting.chat_editing_grace_period_max_diff_high_trust }
|
||||||
|
|
||||||
xit "does not create a revision when under (n) seconds" do
|
it "does not create a revision when under (n) seconds" do
|
||||||
freeze_time 5.seconds.from_now
|
freeze_time 5.seconds.from_now
|
||||||
message_1.update!(message: "hello")
|
message_1.update!(message: "hello")
|
||||||
|
|
||||||
|
@ -963,7 +963,7 @@ RSpec.describe Chat::UpdateMessage do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "creates a revision when over (n) seconds" do
|
it "creates a revision when over (n) seconds" do
|
||||||
freeze_time 30.seconds.from_now
|
freeze_time 40.seconds.from_now
|
||||||
message_1.update!(message: "welcome")
|
message_1.update!(message: "welcome")
|
||||||
|
|
||||||
expect { result }.to change { Chat::MessageRevision.count }.by(1)
|
expect { result }.to change { Chat::MessageRevision.count }.by(1)
|
||||||
|
|
Loading…
Reference in New Issue