Skip to content

A platform for community discussion. Free, open, simple.

DEV: clarify the slow mode specs names (#13962)

Andrei Prigorshnev2ec0a17bef8f
diff --git a/spec/components/post_revisor_spec.rb b/spec/components/post_revisor_spec.rb
index 59bd2ad2a6b..48fc17e0f6e 100644
--- a/spec/components/post_revisor_spec.rb
+++ b/spec/components/post_revisor_spec.rb
@@ -171,9 +171,14 @@ describe PostRevisor do
topic.update!(slow_mode_seconds: 1000)
end
- it 'regular edit' do
- subject.revise!(post.user, { raw: 'updated body' }, revised_at: post.updated_at + 10.minutes)
+ it 'regular edits are not allowed by default' do
+ subject.revise!(
+ post.user,
+ { raw: 'updated body' },
+ revised_at: post.updated_at + 1000.minutes
+ )
+ post.reload
expect(post.errors.present?).to eq(true)
expect(post.errors.messages[:base].first).to be I18n.t("cannot_edit_on_slow_mode")
end
@@ -181,29 +186,38 @@ describe PostRevisor do
it 'grace period editing is allowed' do
SiteSetting.editing_grace_period = 1.minute
- subject.revise!(post.user, { raw: 'updated body' }, revised_at: post.updated_at + 10.seconds)
+ subject.revise!(
+ post.user,
+ { raw: 'updated body' },
+ revised_at: post.updated_at + 10.seconds
+ )
post.reload
-
expect(post.errors).to be_empty
end
- it 'edits are generally allowed' do
+ it 'regular edits are allowed if it was turned on in settings' do
SiteSetting.slow_mode_prevents_editing = false
- subject.revise!(post.user, { raw: 'updated body' }, revised_at: post.updated_at + 10.minutes)
+ subject.revise!(
+ post.user,
+ { raw: 'updated body' },
+ revised_at: post.updated_at + 10.minutes
+ )
post.reload
-
expect(post.errors).to be_empty
end
it 'staff is allowed to edit posts even if the topic is in slow mode' do
admin = Fabricate(:admin)
- subject.revise!(admin, { raw: 'updated body' }, revised_at: post.updated_at + 10.minutes)
+ subject.revise!(
+ admin,
+ { raw: 'updated body' },
+ revised_at: post.updated_at + 10.minutes
+ )
post.reload
-
expect(post.errors).to be_empty
end
end