mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 09:26:54 -06:00
DEV: clarify the slow mode specs names (#13962)
This commit is contained in:
parent
38199424bc
commit
2ec0a17bef
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user