mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 09:48:06 +08:00
DEV: Use proper wording for contexts in specs
This commit is contained in:

committed by
Loïc Guitaut

parent
02987e05d5
commit
3eaac56797
@ -4,10 +4,10 @@
|
||||
RSpec.describe Topic do
|
||||
let(:job_klass) { Jobs::CloseTopic }
|
||||
|
||||
context 'creating a topic without auto-close' do
|
||||
context 'when creating a topic without auto-close' do
|
||||
let(:topic) { Fabricate(:topic, category: category) }
|
||||
|
||||
context 'uncategorized' do
|
||||
context 'when uncategorized' do
|
||||
let(:category) { nil }
|
||||
|
||||
it 'should not schedule the topic to auto-close' do
|
||||
@ -16,7 +16,7 @@ RSpec.describe Topic do
|
||||
end
|
||||
end
|
||||
|
||||
context 'category without default auto-close' do
|
||||
context 'with category without default auto-close' do
|
||||
let(:category) { Fabricate(:category, auto_close_hours: nil) }
|
||||
|
||||
it 'should not schedule the topic to auto-close' do
|
||||
@ -25,12 +25,12 @@ RSpec.describe Topic do
|
||||
end
|
||||
end
|
||||
|
||||
context 'jobs may be queued' do
|
||||
context 'when jobs may be queued' do
|
||||
before do
|
||||
freeze_time
|
||||
end
|
||||
|
||||
context 'category has a default auto-close' do
|
||||
context 'when category has a default auto-close' do
|
||||
let(:category) { Fabricate(:category, auto_close_hours: 2.0) }
|
||||
|
||||
it 'should schedule the topic to auto-close' do
|
||||
@ -42,7 +42,7 @@ RSpec.describe Topic do
|
||||
expect(topic.public_topic_timer.execute_at).to be_within_one_second_of(2.hours.from_now)
|
||||
end
|
||||
|
||||
context 'topic was created by staff user' do
|
||||
context 'when topic was created by staff user' do
|
||||
let(:admin) { Fabricate(:admin) }
|
||||
let(:staff_topic) { Fabricate(:topic, user: admin, category: category) }
|
||||
|
||||
@ -56,7 +56,7 @@ RSpec.describe Topic do
|
||||
expect(topic_status_update.user).to eq(Discourse.system_user)
|
||||
end
|
||||
|
||||
context 'topic is closed manually' do
|
||||
context 'when topic is closed manually' do
|
||||
it 'should remove the schedule to auto-close the topic' do
|
||||
topic_timer_id = staff_topic.public_topic_timer.id
|
||||
|
||||
@ -68,7 +68,7 @@ RSpec.describe Topic do
|
||||
end
|
||||
end
|
||||
|
||||
context 'topic was created by a non-staff user' do
|
||||
context 'when topic was created by a non-staff user' do
|
||||
let(:regular_user) { Fabricate(:user) }
|
||||
let(:regular_user_topic) { Fabricate(:topic, user: regular_user, category: category) }
|
||||
|
||||
|
Reference in New Issue
Block a user