diff --git a/Gemfile.lock b/Gemfile.lock
index a6881fc67b..4d73ec747f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -7,7 +7,7 @@ GIT
GIT
remote: https://github.com/discourse/rubocop-discourse.git
- revision: 5afeae107d3c003bf5bcf75457501ee7c1248fd2
+ revision: 9642e65f3767e5fd1d4e1aec4b617179f4128909
specs:
rubocop-discourse (2.5.0)
rubocop (>= 1.1.0)
diff --git a/plugins/discourse-local-dates/spec/integration/local_dates_spec.rb b/plugins/discourse-local-dates/spec/integration/local_dates_spec.rb
index 651a12ea89..6d4425660e 100644
--- a/plugins/discourse-local-dates/spec/integration/local_dates_spec.rb
+++ b/plugins/discourse-local-dates/spec/integration/local_dates_spec.rb
@@ -85,7 +85,7 @@ RSpec.describe "Local Dates" do
expect(cooked).to include("data-countdown=")
end
- context 'ranges' do
+ describe 'ranges' do
it 'generates ranges without time' do
raw = "[date-range from=2022-01-06 to=2022-01-08]"
cooked = Fabricate(:post, raw: raw).cooked
diff --git a/plugins/discourse-local-dates/spec/lib/pretty_text_spec.rb b/plugins/discourse-local-dates/spec/lib/pretty_text_spec.rb
index 326c9dabb3..0f4af09ae6 100644
--- a/plugins/discourse-local-dates/spec/lib/pretty_text_spec.rb
+++ b/plugins/discourse-local-dates/spec/lib/pretty_text_spec.rb
@@ -19,7 +19,7 @@ RSpec.describe PrettyText do
freeze_time
end
- context 'emails simplified rendering' do
+ describe 'emails simplified rendering' do
it 'works with default markup' do
cooked = PrettyText.cook("[date=2018-05-08]")
cooked_mail = generate_html("2018-05-08T00:00:00Z UTC",
@@ -70,7 +70,7 @@ RSpec.describe PrettyText do
end
end
- context 'excerpt simplified rendering' do
+ describe 'excerpt simplified rendering' do
let(:post) { Fabricate(:post, raw: '[date=2019-10-16 time=14:00:00 format="LLLL" timezone="America/New_York"]') }
it 'adds UTC' do
@@ -79,7 +79,7 @@ RSpec.describe PrettyText do
end
end
- context 'special quotes' do
+ describe 'special quotes' do
it 'converts special quotes to regular quotes' do
# german
post = Fabricate(:post, raw: '[date=2019-10-16 time=14:00:00 format="LLLL" timezone=„America/New_York“]')
@@ -97,7 +97,7 @@ RSpec.describe PrettyText do
end
end
- context 'french quotes' do
+ describe 'french quotes' do
let(:post) { Fabricate(:post, raw: '[date=2019-10-16 time=14:00:00 format="LLLL" timezone=«America/New_York»]') }
it 'converts french quotes to regular quotes' do
diff --git a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb
index c04ef0008c..cd89d1b5a9 100644
--- a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb
+++ b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb
@@ -133,12 +133,11 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
expect(Topic.last.title).to eq(I18n.t('discourse_narrative_bot.advanced_user_narrative.title'))
end
-
end
end
describe "#input" do
- context 'edit tutorial' do
+ context 'when editing tutorial' do
before do
narrative.set_data(user,
state: :tutorial_edit,
@@ -150,7 +149,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
)
end
- describe 'when post is not in the right topic' do
+ context 'when post is not in the right topic' do
it 'should not do anything' do
other_post
narrative.expects(:enqueue_timeout_job).with(user).never
@@ -160,7 +159,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- describe 'when user replies to the post' do
+ context 'when user replies to the post' do
it 'should create the right reply' do
post
narrative.expects(:enqueue_timeout_job).with(user).once
@@ -174,7 +173,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
))
end
- describe 'when reply contains the skip trigger' do
+ context 'when reply contains the skip trigger' do
it 'should create the right reply' do
post.update!(raw: "@#{discobot_username} #{skip_trigger.upcase}")
described_class.any_instance.expects(:enqueue_timeout_job).with(user)
@@ -192,7 +191,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- describe 'when user edits the right post' do
+ context 'when user edits the right post' do
let(:post_2) { Fabricate(:post, user: post.user, topic: post.topic) }
it 'should create the right reply' do
@@ -214,7 +213,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- context 'delete tutorial' do
+ context 'when deleting tutorial' do
before do
narrative.set_data(user,
state: :tutorial_delete,
@@ -223,7 +222,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
)
end
- describe 'when user replies to the topic' do
+ context 'when user replies to the topic' do
it 'should create the right reply' do
narrative.expects(:enqueue_timeout_job).with(user).once
@@ -237,7 +236,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_delete)
end
- describe 'when reply contains the skip trigger' do
+ context 'when reply contains the skip trigger' do
it 'should create the right reply' do
post.update!(raw: skip_trigger.upcase)
described_class.any_instance.expects(:enqueue_timeout_job).with(user)
@@ -255,7 +254,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- describe 'when user destroys a post in a different topic' do
+ context 'when user destroys a post in a different topic' do
it 'should not do anything' do
other_post
narrative.expects(:enqueue_timeout_job).with(user).never
@@ -266,7 +265,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- describe 'when user deletes a post in the right topic' do
+ context 'when user deletes a post in the right topic' do
it 'should create the right reply' do
post
@@ -304,7 +303,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- context 'undelete post tutorial' do
+ context 'when undeleting post tutorial' do
before do
narrative.set_data(user,
state: :tutorial_recover,
@@ -313,7 +312,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
)
end
- describe 'when posts are configured to be deleted immediately' do
+ context 'when posts are configured to be deleted immediately' do
before do
SiteSetting.delete_removed_posts_after = 0
end
@@ -337,7 +336,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- describe 'when user replies to the topic' do
+ context 'when user replies to the topic' do
it 'should create the right reply' do
narrative.set_data(user, narrative.get_data(user).merge(
tutorial_recover: { post_id: '1' }
@@ -355,7 +354,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_recover)
end
- describe 'when reply contains the skip trigger' do
+ context 'when reply contains the skip trigger' do
it 'should create the right reply' do
parent_category = Fabricate(:category, name: 'a')
_category = Fabricate(:category, parent_category: parent_category, name: 'b')
@@ -377,7 +376,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- describe 'when user recovers a post in a different topic' do
+ context 'when user recovers a post in a different topic' do
it 'should not do anything' do
other_post
narrative.expects(:enqueue_timeout_job).with(user).never
@@ -389,7 +388,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- describe 'when user recovers a post in the right topic' do
+ context 'when user recovers a post in the right topic' do
it 'should create the right reply' do
parent_category = Fabricate(:category, name: 'a')
_category = Fabricate(:category, parent_category: parent_category, name: 'b')
@@ -412,7 +411,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- context 'category hashtag tutorial' do
+ context 'with category hashtag tutorial' do
before do
narrative.set_data(user,
state: :tutorial_category_hashtag,
@@ -421,7 +420,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
)
end
- describe 'when post is not in the right topic' do
+ context 'when post is not in the right topic' do
it 'should not do anything' do
other_post
narrative.expects(:enqueue_timeout_job).with(user).never
@@ -434,7 +433,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- describe 'when user replies to the topic' do
+ context 'when user replies to the topic' do
it 'should create the right reply' do
narrative.input(:reply, user, post: post)
new_post = Post.last
@@ -446,7 +445,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_category_hashtag)
end
- describe 'when reply contains the skip trigger' do
+ context 'when reply contains the skip trigger' do
it 'should create the right reply' do
post.update!(raw: skip_trigger)
described_class.any_instance.expects(:enqueue_timeout_job).with(user)
@@ -481,7 +480,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- context 'topic notification level tutorial' do
+ context 'with topic notification level tutorial' do
before do
narrative.set_data(user,
state: :tutorial_change_topic_notification_level,
@@ -490,7 +489,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
)
end
- describe 'when notification level is changed for another topic' do
+ context 'when notification level is changed for another topic' do
it 'should not do anything' do
other_topic
user
@@ -508,7 +507,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- describe 'when user replies to the topic' do
+ context 'when user replies to the topic' do
it 'should create the right reply' do
narrative.input(:reply, user, post: post)
new_post = Post.last
@@ -520,7 +519,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_change_topic_notification_level)
end
- describe 'when reply contains the skip trigger' do
+ context 'when reply contains the skip trigger' do
it 'should create the right reply' do
post.update!(raw: skip_trigger)
described_class.any_instance.expects(:enqueue_timeout_job).with(user)
@@ -538,7 +537,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- describe 'when user changed the topic notification level' do
+ context 'when user changed the topic notification level' do
it 'should create the right reply' do
TopicUser.change(
user.id,
@@ -557,7 +556,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- describe 'when user cannot create polls' do
+ context 'when user cannot create polls' do
it 'should create the right reply (polls disabled)' do
SiteSetting.poll_enabled = false
@@ -598,7 +597,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- context 'poll tutorial' do
+ context 'with poll tutorial' do
before do
narrative.set_data(user,
state: :tutorial_poll,
@@ -620,7 +619,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
expect(post.errors[:base].size).to eq(0)
end
- describe 'when post is not in the right topic' do
+ context 'when post is not in the right topic' do
it 'should not do anything' do
other_post
narrative.expects(:enqueue_timeout_job).with(user).never
@@ -630,7 +629,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- describe 'when user replies to the topic' do
+ context 'when user replies to the topic' do
it 'should create the right reply' do
narrative.input(:reply, user, post: post)
new_post = Post.last
@@ -639,7 +638,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_poll)
end
- describe 'when reply contains the skip trigger' do
+ context 'when reply contains the skip trigger' do
it 'should create the right reply' do
post.update!(raw: skip_trigger)
described_class.any_instance.expects(:enqueue_timeout_job).with(user)
@@ -672,7 +671,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- context "details tutorial" do
+ context "with details tutorial" do
before do
narrative.set_data(user,
state: :tutorial_details,
@@ -681,7 +680,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
)
end
- describe 'when post is not in the right topic' do
+ context 'when post is not in the right topic' do
it 'should not do anything' do
other_post
narrative.expects(:enqueue_timeout_job).with(user).never
@@ -691,7 +690,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
end
end
- describe 'when user replies to the topic' do
+ context 'when user replies to the topic' do
it 'should create the right reply' do
narrative.input(:reply, user, post: post)
@@ -699,7 +698,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do
expect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_details)
end
- describe 'when reply contains the skip trigger' do
+ context 'when reply contains the skip trigger' do
it 'should create the right reply' do
post.update!(raw: skip_trigger)
diff --git a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rb b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rb
index f1b68d154d..543192f6cf 100644
--- a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rb
+++ b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rb
@@ -49,7 +49,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
describe '#select' do
- context 'in a PM with discobot' do
+ context 'when in a PM with discobot' do
let(:first_post) { Fabricate(:post, user: discobot_user) }
let(:topic) do
@@ -63,7 +63,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
let(:post) { Fabricate(:post, topic: topic, user: user) }
- context 'during a tutorial track' do
+ context 'while in a tutorial track' do
before do
narrative.set_data(user,
state: :tutorial_formatting,
@@ -146,7 +146,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when user thank the bot' do
+ context 'when user thank the bot' do
it 'should like the post' do
post.update!(raw: 'thanks!')
@@ -176,7 +176,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
.to eq("tutorial_bookmark")
end
- describe 'reset trigger in surrounded by quotes' do
+ context 'when reset trigger in surrounded by quotes' do
it 'should reset the track' do
post.update!(
raw: "'#{described_class.reset_trigger} #{DiscourseNarrativeBot::NewUserNarrative.reset_trigger}'"
@@ -189,8 +189,8 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'reset trigger in a middle of a sentence' do
- describe 'when post is less than reset trigger exact match limit' do
+ context 'when reset trigger in a middle of a sentence' do
+ context 'when post is less than reset trigger exact match limit' do
it 'should reset the track' do
post.update!(
raw: "I would like to #{described_class.reset_trigger} #{DiscourseNarrativeBot::NewUserNarrative.reset_trigger} now"
@@ -203,7 +203,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when post exceeds reset trigger exact match limit' do
+ context 'when post exceeds reset trigger exact match limit' do
it 'should not reset the track' do
post.update!(
raw: "I would like to #{described_class.reset_trigger} #{DiscourseNarrativeBot::NewUserNarrative.reset_trigger} now #{'a' * described_class::RESET_TRIGGER_EXACT_MATCH_LENGTH}"
@@ -233,7 +233,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- context 'at the end of a tutorial track' do
+ context 'when at the end of a tutorial track' do
before do
narrative.set_data(user,
state: :end,
@@ -242,7 +242,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
)
end
- context 'generic replies' do
+ context 'with generic replies' do
after do
Discourse.redis.del("#{described_class::GENERIC_REPLIES_COUNT_PREFIX}#{user.id}")
end
@@ -290,7 +290,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
expect(new_post.raw).to eq(random_mention_reply)
end
- describe 'when asking discobot for help' do
+ context 'when asking discobot for help' do
it 'should create the right reply' do
post.update!(raw: 'show me what you can do @discobot display help')
described_class.new(:reply, user, post_id: post.id).select
@@ -298,7 +298,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
expect(Post.last.raw).to include(help_message)
end
- describe 'as an admin or moderator' do
+ context 'as an admin or moderator' do
it 'should include the commands to start the advanced user track' do
user.update!(moderator: true)
post.update!(raw: 'Show me what you can do @discobot display help')
@@ -311,7 +311,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'as a user that has completed the new user track' do
+ context 'as a user that has completed the new user track' do
it 'should include the commands to start the advanced user track' do
narrative.set_data(user,
state: :end,
@@ -335,7 +335,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when discobot is asked to roll dice' do
+ context 'when discobot is asked to roll dice' do
before do
narrative.set_data(user,
state: :end,
@@ -353,7 +353,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
))
end
- describe 'when range of dice request is too high' do
+ context 'when range of dice request is too high' do
before do
srand(1)
end
@@ -376,7 +376,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when number of dice to roll is too high' do
+ context 'when number of dice to roll is too high' do
it 'should create the right reply' do
post.update!(raw: "roll #{DiscourseNarrativeBot::Dice::MAXIMUM_NUM_OF_DICE + 1}d1")
described_class.new(:reply, user, post_id: post.id).select
@@ -392,7 +392,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when dice combination is invalid' do
+ context 'when dice combination is invalid' do
it 'should create the right reply' do
post.update!(raw: "roll 0d1")
described_class.new(:reply, user, post_id: post.id).select
@@ -407,7 +407,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
context 'when in a normal PM with discobot' do
- describe 'when discobot is replied to' do
+ context 'when discobot is replied to' do
it 'should create the right reply' do
SiteSetting.discourse_narrative_bot_disable_public_replies = true
post.update!(raw: 'Show me what you can do @discobot')
@@ -439,16 +439,16 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- context 'random discobot mentions' do
+ context 'with random discobot mentions' do
let(:topic) { Fabricate(:topic) }
let(:post) { Fabricate(:post, topic: topic, user: user) }
- describe 'when discobot public replies are disabled' do
+ context 'when discobot public replies are disabled' do
before do
SiteSetting.discourse_narrative_bot_disable_public_replies = true
end
- describe 'when discobot is mentioned' do
+ context 'when discobot is mentioned' do
it 'should not reply' do
post.update!(raw: 'Show me what you can do @discobot')
@@ -459,7 +459,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when discobot is mentioned' do
+ context 'when discobot is mentioned' do
it 'should create the right reply' do
post.update!(raw: 'Show me what you can do @discobot')
described_class.new(:reply, user, post_id: post.id).select
@@ -496,7 +496,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
expect(new_post.raw).to eq(random_mention_reply)
end
- describe 'rate limiting random reply message in public topic' do
+ context 'with rate limiting random reply message in public topic' do
let(:topic) { Fabricate(:topic) }
let(:other_post) { Fabricate(:post, raw: '@discobot show me something', topic: topic) }
let(:post) { Fabricate(:post, topic: topic) }
@@ -505,7 +505,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
Discourse.redis.flushdb
end
- describe 'when random reply massage has been displayed in the last 6 hours' do
+ context 'when random reply massage has been displayed in the last 6 hours' do
it 'should not do anything' do
Discourse.redis.set(
"#{described_class::PUBLIC_DISPLAY_BOT_HELP_KEY}:#{other_post.topic_id}",
@@ -522,7 +522,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when random reply message has not been displayed in the last 6 hours' do
+ context 'when random reply message has not been displayed in the last 6 hours' do
it 'should create the right reply' do
Discourse.redis.set(
"#{described_class::PUBLIC_DISPLAY_BOT_HELP_KEY}:#{other_post.topic_id}",
@@ -540,7 +540,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when random reply message has been displayed in the last 10 replies' do
+ context 'when random reply message has been displayed in the last 10 replies' do
it 'should not do anything' do
described_class.new(:reply, user, post_id: other_post.id).select
expect(Post.last.raw).to eq(random_mention_reply)
@@ -559,7 +559,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when asking discobot for help' do
+ context 'when asking discobot for help' do
it 'should create the right reply' do
post.update!(raw: '@discobot display help')
described_class.new(:reply, user, post_id: post.id).select
@@ -568,8 +568,8 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when asking discobot to start new user track' do
- describe 'invalid text' do
+ context 'when asking discobot to start new user track' do
+ context 'with invalid text' do
it 'should not trigger the bot' do
post.update!(raw: "`@discobot #{I18n.t('discourse_narrative_bot.track_selector.reset_trigger')} #{I18n.t(DiscourseNarrativeBot::NewUserNarrative.reset_trigger)}`")
@@ -579,7 +579,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when discobot is asked to roll dice' do
+ context 'when discobot is asked to roll dice' do
it 'should create the right reply' do
post.update!(raw: '@discobot roll 2d1')
described_class.new(:reply, user, post_id: post.id).select
@@ -591,7 +591,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
))
end
- describe 'when dice roll is requested incorrectly' do
+ context 'when dice roll is requested incorrectly' do
it 'should create the right reply' do
post.update!(raw: 'roll 2d1 @discobot')
described_class.new(:reply, user, post_id: post.id).select
@@ -600,7 +600,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when roll dice command is present inside a quote' do
+ context 'when roll dice command is present inside a quote' do
it 'should ignore the command' do
user
post.update!(raw: "[quote=\"Donkey, post:6, topic:1\"]\n@discobot roll 2d1\n[/quote]")
@@ -611,7 +611,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when a quote is requested' do
+ context 'when a quote is requested' do
it 'should create the right reply' do
post.update!(raw: "@discobot quote")
@@ -624,7 +624,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
))
end
- describe 'when quote is requested incorrectly' do
+ context 'when quote is requested incorrectly' do
it 'should create the right reply' do
post.update!(raw: 'quote @discobot')
described_class.new(:reply, user, post_id: post.id).select
@@ -633,7 +633,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when quote command is present inside a onebox or quote' do
+ context 'when quote command is present inside a onebox or quote' do
it 'should ignore the command' do
user
post.update!(raw: "[quote=\"Donkey, post:6, topic:1\"]\n@discobot quote\n[/quote]")
@@ -643,7 +643,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when user requesting quote has a preferred locale' do
+ context 'when user requesting quote has a preferred locale' do
before do
SiteSetting.allow_user_locale = true
user.update!(locale: 'it')
@@ -662,7 +662,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when magic 8 ball is requested' do
+ context 'when magic 8 ball is requested' do
before do
srand(1)
end
@@ -677,8 +677,8 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when bot is asked to reset/start a track' do
- describe 'when user likes a post containing a reset trigger' do
+ context 'when bot is asked to reset/start a track' do
+ context 'when user likes a post containing a reset trigger' do
it 'should not start the track' do
another_post = Fabricate(:post,
user: Fabricate(:user),
@@ -694,7 +694,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe "when new and advanced user triggers overlap" do
+ context "when new and advanced user triggers overlap" do
before do
@overrides = []
@@ -723,7 +723,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- context 'pm to self' do
+ context 'when sending pm to self' do
let(:other_topic) do
topic_allowed_user = Fabricate.build(:topic_allowed_user, user: user)
Fabricate(:private_message_topic, topic_allowed_users: [topic_allowed_user])
@@ -731,7 +731,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
let(:other_post) { Fabricate(:post, topic: other_topic) }
- describe 'when a new message is made' do
+ context 'when a new message is made' do
it 'should not do anything' do
other_post
@@ -741,7 +741,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- context 'pms to bot' do
+ context 'when sending pms to bot' do
let(:other_topic) do
topic_allowed_user = Fabricate.build(:topic_allowed_user, user: user)
bot = Fabricate.build(:topic_allowed_user, user: discobot_user)
@@ -750,7 +750,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
let(:other_post) { Fabricate(:post, topic: other_topic) }
- describe 'when a new like is made' do
+ context 'when a new like is made' do
it 'should not do anything' do
other_post
expect { described_class.new(:like, user, post_id: other_post.id).select }
@@ -758,7 +758,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when a new message is made' do
+ context 'when a new message is made' do
it 'should create the right reply' do
described_class.new(:reply, user, post_id: other_post.id).select
@@ -766,7 +766,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do
end
end
- describe 'when user thanks the bot' do
+ context 'when user thanks the bot' do
it 'should like the post' do
other_post.update!(raw: 'thanks!')
diff --git a/plugins/discourse-narrative-bot/spec/jobs/onceoff/remap_old_bot_images_spec.rb b/plugins/discourse-narrative-bot/spec/jobs/onceoff/remap_old_bot_images_spec.rb
index 6b0326b7f5..61d9455b0b 100644
--- a/plugins/discourse-narrative-bot/spec/jobs/onceoff/remap_old_bot_images_spec.rb
+++ b/plugins/discourse-narrative-bot/spec/jobs/onceoff/remap_old_bot_images_spec.rb
@@ -19,7 +19,7 @@ RSpec.describe Jobs::DiscourseNarrativeBot::RemapOldBotImages do
end
end
- context 'subfolder' do
+ context 'with subfolder' do
let!(:post) do
Fabricate(:post,
user: ::DiscourseNarrativeBot::Base.new.discobot_user,
diff --git a/plugins/discourse-narrative-bot/spec/requests/discobot_welcome_post_spec.rb b/plugins/discourse-narrative-bot/spec/requests/discobot_welcome_post_spec.rb
index 6fa4be2b9d..e57c9ed457 100644
--- a/plugins/discourse-narrative-bot/spec/requests/discobot_welcome_post_spec.rb
+++ b/plugins/discourse-narrative-bot/spec/requests/discobot_welcome_post_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe "Discobot welcome post" do
end
end
- context 'When discourse_narrative_bot_welcome_post_delay is greater than 0' do
+ context 'when discourse_narrative_bot_welcome_post_delay is greater than 0' do
before do
SiteSetting.discourse_narrative_bot_welcome_post_delay = 5
end
diff --git a/plugins/discourse-narrative-bot/spec/user_spec.rb b/plugins/discourse-narrative-bot/spec/user_spec.rb
index 7b3d51b6f0..d7036373f6 100644
--- a/plugins/discourse-narrative-bot/spec/user_spec.rb
+++ b/plugins/discourse-narrative-bot/spec/user_spec.rb
@@ -32,7 +32,7 @@ RSpec.describe User do
end
describe 'welcome post' do
- context 'disabled' do
+ context 'when disabled' do
before do
SiteSetting.disable_discourse_narrative_bot_welcome_post = true
end
@@ -57,7 +57,7 @@ RSpec.describe User do
end
end
- context 'enabled' do
+ context 'when enabled' do
before do
SiteSetting.disable_discourse_narrative_bot_welcome_post = false
end
diff --git a/plugins/poll/spec/integration/poll_endpoints_spec.rb b/plugins/poll/spec/integration/poll_endpoints_spec.rb
index 0fd3723646..9fff1972a8 100644
--- a/plugins/poll/spec/integration/poll_endpoints_spec.rb
+++ b/plugins/poll/spec/integration/poll_endpoints_spec.rb
@@ -103,7 +103,7 @@ RSpec.describe "DiscoursePoll endpoints" do
end
end
- context "number poll" do
+ context "with number poll" do
let(:post) { Fabricate(:post, raw: "[poll type=number min=1 max=20 step=1 public=true]\n[/poll]") }
it 'should return the right response' do
diff --git a/plugins/poll/spec/requests/users_controller_spec.rb b/plugins/poll/spec/requests/users_controller_spec.rb
index 87b354ea48..78e387de6e 100644
--- a/plugins/poll/spec/requests/users_controller_spec.rb
+++ b/plugins/poll/spec/requests/users_controller_spec.rb
@@ -3,7 +3,6 @@
require "rails_helper"
RSpec.describe Admin::UsersController do
-
let(:admin) { Fabricate(:admin) }
before { sign_in(admin) }
@@ -11,7 +10,7 @@ RSpec.describe Admin::UsersController do
describe '#destroy' do
let(:delete_me) { Fabricate(:user) }
- context "user has voted" do
+ context "when user has voted" do
let!(:topic) { Fabricate(:topic, user: admin) }
let!(:post) { Fabricate(:post, topic: topic, user: admin, raw: "[poll]\n- a\n- b\n[/poll]") }
@@ -26,5 +25,4 @@ RSpec.describe Admin::UsersController do
end
end
end
-
end
diff --git a/plugins/poll/spec/serializers/poll_option_serializer_spec.rb b/plugins/poll/spec/serializers/poll_option_serializer_spec.rb
index 1a31df9838..ad46e77961 100644
--- a/plugins/poll/spec/serializers/poll_option_serializer_spec.rb
+++ b/plugins/poll/spec/serializers/poll_option_serializer_spec.rb
@@ -16,10 +16,10 @@ RSpec.describe PollOptionSerializer do
poll.poll_votes.create!(poll_option_id: poll.poll_options.first.id, user_id: voter.id)
end
- context 'poll results are public' do
+ context 'when poll results are public' do
let(:post) { Fabricate(:post, raw: "[poll]\n- A\n- B\n[/poll]") }
- context 'user is not staff' do
+ context 'when user is not staff' do
let(:user) { Fabricate(:user) }
it 'include votes' do
@@ -30,10 +30,10 @@ RSpec.describe PollOptionSerializer do
end
end
- context 'poll results are staff only' do
+ context 'when poll results are staff only' do
let(:post) { Fabricate(:post, raw: "[poll results=staff_only]\n- A\n- B\n[/poll]") }
- context 'user is not staff' do
+ context 'when user is not staff' do
let(:user) { Fabricate(:user) }
it 'doesn’t include votes' do
@@ -43,7 +43,7 @@ RSpec.describe PollOptionSerializer do
end
end
- context 'user staff' do
+ context 'when user is staff' do
let(:admin) { Fabricate(:admin) }
it 'includes votes' do
diff --git a/plugins/styleguide/spec/integration/access_spec.rb b/plugins/styleguide/spec/integration/access_spec.rb
index cf5081f299..568d35eafa 100644
--- a/plugins/styleguide/spec/integration/access_spec.rb
+++ b/plugins/styleguide/spec/integration/access_spec.rb
@@ -5,12 +5,12 @@ RSpec.describe 'SiteSetting.styleguide_admin_only' do
SiteSetting.styleguide_enabled = true
end
- context 'styleguide is admin only' do
+ context 'when styleguide is admin only' do
before do
SiteSetting.styleguide_admin_only = true
end
- context 'user is admin' do
+ context 'when user is admin' do
before do
sign_in(Fabricate(:admin))
end
@@ -21,7 +21,7 @@ RSpec.describe 'SiteSetting.styleguide_admin_only' do
end
end
- context 'user is not admin' do
+ context 'when user is not admin' do
before do
sign_in(Fabricate(:user))
end
@@ -39,7 +39,7 @@ RSpec.describe 'SiteSetting.styleguide_enabled' do
sign_in(Fabricate(:admin))
end
- context 'style is enabled' do
+ context 'when style is enabled' do
before do
SiteSetting.styleguide_enabled = true
end
@@ -50,7 +50,7 @@ RSpec.describe 'SiteSetting.styleguide_enabled' do
end
end
- context 'styleguide is disabled' do
+ context 'when styleguide is disabled' do
before do
SiteSetting.styleguide_enabled = false
end
diff --git a/plugins/styleguide/spec/integration/assets_spec.rb b/plugins/styleguide/spec/integration/assets_spec.rb
index ad555711a6..e4d6f2cfa0 100644
--- a/plugins/styleguide/spec/integration/assets_spec.rb
+++ b/plugins/styleguide/spec/integration/assets_spec.rb
@@ -6,14 +6,14 @@ RSpec.describe 'Styleguide assets' do
sign_in(Fabricate(:admin))
end
- context 'visits homepage' do
+ context 'when visiting homepage' do
it 'doesn’t load styleguide assets' do
get '/'
expect(response.body).to_not include('styleguide')
end
end
- context 'visits styleguide' do
+ context 'when visiting styleguide' do
it 'loads styleguide assets' do
get '/styleguide'
expect(response.body).to include('styleguide')
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 1dac777d6e..f4c25c979a 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -2,7 +2,6 @@
# frozen_string_literal: true
RSpec.describe ApplicationHelper do
-
describe "preload_script" do
def preload_link(url)
<<~HTML
@@ -111,37 +110,45 @@ RSpec.describe ApplicationHelper do
)
helper.request.env[:resolved_theme_id] = dark_theme.id
end
- context "on desktop" do
+
+ context "when on desktop" do
before do
session[:mobile_view] = '0'
end
+
context "when logo_dark is not set" do
it "will return site_logo_url instead" do
expect(helper.application_logo_url).to eq(SiteSetting.site_logo_url)
end
end
+
context "when logo_dark is set" do
before do
SiteSetting.logo_dark = Fabricate(:upload, url: '/images/logo-dark.png')
end
+
it "will return site_logo_dark_url" do
expect(helper.application_logo_url).to eq(SiteSetting.site_logo_dark_url)
end
end
end
- context "on mobile" do
+
+ context "when on mobile" do
before do
session[:mobile_view] = '1'
end
+
context "when mobile_logo_dark is not set" do
it "will return site_mobile_logo_url instead" do
expect(helper.application_logo_url).to eq(SiteSetting.site_mobile_logo_url)
end
end
+
context "when mobile_logo_dark is set" do
before do
SiteSetting.mobile_logo_dark = Fabricate(:upload, url: '/images/mobile-logo-dark.png')
end
+
it "will return site_mobile_logo_dark_url" do
expect(helper.application_logo_url).to eq(SiteSetting.site_mobile_logo_dark_url)
end
@@ -203,8 +210,8 @@ RSpec.describe ApplicationHelper do
end
end
- describe "mobile_view?" do
- context "enable_mobile_theme is true" do
+ describe "#mobile_view?" do
+ context "when enable_mobile_theme is true" do
before do
SiteSetting.enable_mobile_theme = true
end
@@ -219,7 +226,7 @@ RSpec.describe ApplicationHelper do
expect(helper.mobile_view?).to eq(false)
end
- context "mobile_view session is cleared" do
+ context "when mobile_view session is cleared" do
before do
params[:mobile_view] = 'auto'
end
@@ -237,7 +244,7 @@ RSpec.describe ApplicationHelper do
end
end
- context "mobile_view is not set" do
+ context "when mobile_view is not set" do
it "is false if user agent is not mobile" do
controller.request.stubs(:user_agent).returns('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36')
expect(helper.mobile_view?).to be_falsey
@@ -275,7 +282,7 @@ RSpec.describe ApplicationHelper do
end
end
- context "enable_mobile_theme is false" do
+ context "when enable_mobile_theme is false" do
before do
SiteSetting.enable_mobile_theme = false
end
@@ -290,7 +297,7 @@ RSpec.describe ApplicationHelper do
expect(helper.mobile_view?).to eq(false)
end
- context "mobile_view is not set" do
+ context "when mobile_view is not set" do
it "is false if user agent is not mobile" do
controller.request.stubs(:user_agent).returns('Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.17 Safari/537.36')
expect(helper.mobile_view?).to eq(false)
@@ -418,7 +425,6 @@ RSpec.describe ApplicationHelper do
end
describe 'crawlable_meta_data' do
-
it 'Supports ASCII URLs with odd chars' do
result = helper.crawlable_meta_data(
url: (+"http://localhost/ión").force_encoding("ASCII-8BIT").freeze
@@ -427,7 +433,7 @@ RSpec.describe ApplicationHelper do
expect(result).to include("ión")
end
- context "opengraph image" do
+ context "with opengraph image" do
it 'returns the correct image' do
SiteSetting.opengraph_image = Fabricate(:upload,
url: '/images/og-image.png'
@@ -544,7 +550,7 @@ RSpec.describe ApplicationHelper do
expect(cs_stylesheets).not_to include("(prefers-color-scheme: dark)")
end
- context "custom light scheme" do
+ context "with custom light scheme" do
before do
@new_cs = Fabricate(:color_scheme, name: 'Flamboyant')
user.user_option.color_scheme_id = @new_cs.id
@@ -576,7 +582,7 @@ RSpec.describe ApplicationHelper do
end
end
- context "dark scheme with user option and/or cookies" do
+ context "with dark scheme with user option and/or cookies" do
before do
user.user_option.dark_scheme_id = -1
user.user_option.save!
@@ -615,7 +621,6 @@ RSpec.describe ApplicationHelper do
color_stylesheets = helper.discourse_color_scheme_stylesheets
expect(color_stylesheets).not_to include("(prefers-color-scheme: dark)")
end
-
end
end
diff --git a/spec/import_export/importer_spec.rb b/spec/import_export/importer_spec.rb
index ad75f2ade7..b9f6581aad 100644
--- a/spec/import_export/importer_spec.rb
+++ b/spec/import_export/importer_spec.rb
@@ -3,7 +3,6 @@
require "import_export"
RSpec.describe ImportExport::Importer do
-
before do
STDOUT.stubs(:write)
end
@@ -18,7 +17,6 @@ RSpec.describe ImportExport::Importer do
end
describe '.perform' do
-
it 'topics and users' do
data = import_data.dup
data[:categories] = nil
@@ -32,7 +30,7 @@ RSpec.describe ImportExport::Importer do
.and change { User.count }.by(2)
end
- context 'categories and groups' do
+ context 'with categories and groups' do
it 'works' do
data = import_data.dup
data[:topics] = nil
@@ -105,7 +103,5 @@ RSpec.describe ImportExport::Importer do
.and change { Topic.count }.by(8)
.and change { User.count }.by(2)
end
-
end
-
end
diff --git a/spec/integration/auto_reject_reviewable_users_spec.rb b/spec/integration/auto_reject_reviewable_users_spec.rb
index f51d41705c..f993f097c2 100644
--- a/spec/integration/auto_reject_reviewable_users_spec.rb
+++ b/spec/integration/auto_reject_reviewable_users_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
RSpec.describe "auto reject reviewable users" do
- context "reviewable users" do
+ describe "reviewable users" do
fab!(:old_user) { Fabricate(:reviewable, created_at: 80.days.ago) }
it "does not send email to rejected user" do
diff --git a/spec/integration/category_tag_spec.rb b/spec/integration/category_tag_spec.rb
index 4650f02cd3..59bee8e897 100644
--- a/spec/integration/category_tag_spec.rb
+++ b/spec/integration/category_tag_spec.rb
@@ -2,7 +2,6 @@
# frozen_string_literal: true
RSpec.describe "category tag restrictions" do
-
def filter_allowed_tags(opts = {})
DiscourseTagging.filter_allowed_tags(Guardian.new(user), opts)
end
@@ -22,7 +21,7 @@ RSpec.describe "category tag restrictions" do
SiteSetting.min_trust_level_to_tag_topics = 0
end
- context "tags restricted to one category" do
+ context "with tags restricted to one category" do
fab!(:category_with_tags) { Fabricate(:category) }
fab!(:other_category) { Fabricate(:category) }
@@ -94,7 +93,7 @@ RSpec.describe "category tag restrictions" do
expect { other_category.update(allowed_tags: [tag1.name, 'tag-stuff', tag2.name, 'another-tag']) }.to change { Tag.count }.by(2)
end
- context 'required tags from tag group' do
+ context 'with required tags from tag group' do
fab!(:tag_group) { Fabricate(:tag_group, tags: [tag1, tag3]) }
before { category_with_tags.update!(category_required_tag_groups: [CategoryRequiredTagGroup.new(tag_group: tag_group, min_count: 1)]) }
@@ -105,7 +104,7 @@ RSpec.describe "category tag restrictions" do
end
end
- context 'category allows other tags to be used' do
+ context 'when category allows other tags to be used' do
before do
category_with_tags.update!(allow_global_tags: true)
end
@@ -128,7 +127,7 @@ RSpec.describe "category tag restrictions" do
expect_same_tag_names(filter_allowed_tags(for_input: true, category: other_category, selected_tags: [tag3.name], term: 'tag'), [tag4])
end
- context 'required tags from tag group' do
+ context 'with required tags from tag group' do
fab!(:tag_group) { Fabricate(:tag_group, tags: [tag1, tag3]) }
before { category_with_tags.update!(category_required_tag_groups: [CategoryRequiredTagGroup.new(tag_group: tag_group, min_count: 1)]) }
@@ -141,7 +140,7 @@ RSpec.describe "category tag restrictions" do
end
end
- context "tag groups restricted to a category" do
+ context "with tag groups restricted to a category" do
fab!(:tag_group1) { Fabricate(:tag_group) }
fab!(:category) { Fabricate(:category) }
fab!(:other_category) { Fabricate(:category) }
@@ -188,7 +187,7 @@ RSpec.describe "category tag restrictions" do
expect_same_tag_names(filter_allowed_tags(for_input: true, term: 'with:c'), [tag_with_colon])
end
- context 'required tags from tag group' do
+ context 'with required tags from tag group' do
fab!(:tag_group) { Fabricate(:tag_group, tags: [tag1, tag3]) }
before { category.update!(category_required_tag_groups: [CategoryRequiredTagGroup.new(tag_group: tag_group, min_count: 1)]) }
@@ -199,7 +198,7 @@ RSpec.describe "category tag restrictions" do
end
end
- context 'category allows other tags to be used' do
+ context 'when category allows other tags to be used' do
before do
category.update!(allow_global_tags: true)
end
@@ -222,7 +221,7 @@ RSpec.describe "category tag restrictions" do
expect_same_tag_names(filter_allowed_tags(for_input: true, category: other_category), [tag1])
end
- context 'required tags from tag group' do
+ context 'with required tags from tag group' do
fab!(:tag_group) { Fabricate(:tag_group, tags: [tag1, tag3]) }
before { category.update!(category_required_tag_groups: [CategoryRequiredTagGroup.new(tag_group: tag_group, min_count: 1)]) }
@@ -233,7 +232,7 @@ RSpec.describe "category tag restrictions" do
end
end
- context 'another category has restricted tags using groups' do
+ context 'when another category has restricted tags using groups' do
fab!(:category2) { Fabricate(:category) }
fab!(:tag_group2) { Fabricate(:tag_group) }
@@ -260,7 +259,7 @@ RSpec.describe "category tag restrictions" do
end
end
- context 'another category has restricted tags' do
+ context 'when another category has restricted tags' do
fab!(:category2) { Fabricate(:category) }
it "doesn't filter tags that are also restricted in another category" do
@@ -274,7 +273,7 @@ RSpec.describe "category tag restrictions" do
end
end
- context "tag groups with parent tag" do
+ context "with tag groups with parent tag" do
it "for input field, filter_allowed_tags returns results based on whether parent tag is present or not" do
tag_group = Fabricate(:tag_group, parent_tag_id: tag1.id)
tag_group.tags = [tag3, tag4]
@@ -318,7 +317,7 @@ RSpec.describe "category tag restrictions" do
expect_same_tag_names(filter_allowed_tags(for_input: true, selected_tags: [tag3.name]), [tag4, common])
end
- context 'required tags from tag group' do
+ context 'with required tags from tag group' do
fab!(:tag_group) { Fabricate(:tag_group, tags: [tag1, tag2]) }
fab!(:category) { Fabricate(:category, category_required_tag_groups: [CategoryRequiredTagGroup.new(tag_group: tag_group, min_count: 1)]) }
@@ -331,7 +330,7 @@ RSpec.describe "category tag restrictions" do
end
end
- context "and category restrictions" do
+ context "with category restrictions" do
fab!(:car_category) { Fabricate(:category) }
fab!(:other_category) { Fabricate(:category) }
fab!(:makes) { Fabricate(:tag_group, name: "Makes") }
@@ -395,7 +394,7 @@ RSpec.describe "category tag restrictions" do
expect(post.topic.tags.map(&:name).sort).to eq(['ford', 'mustang'])
end
- context "limit one tag from each group" do
+ context "with limit one tag from each group" do
before do
makes.update(one_per_topic: true)
honda_group.update(one_per_topic: true)
@@ -460,7 +459,7 @@ RSpec.describe "tag topic counts per category" do
expect(CategoryTagStat.where(category: category, tag: tag2).sum(:topic_count)).to eq(1)
end
- context "topic with 2 tags" do
+ context "with topic with 2 tags" do
fab!(:topic) { Fabricate(:topic, category: category, tags: [tag1, tag2]) }
fab!(:post) { Fabricate(:post, user: topic.user, topic: topic) }
@@ -492,7 +491,7 @@ RSpec.describe "tag topic counts per category" do
end
end
- context "topic with one tag" do
+ context "with topic with one tag" do
fab!(:topic) { Fabricate(:topic, tags: [tag1], category: category) }
fab!(:post) { Fabricate(:post, user: topic.user, topic: topic) }
diff --git a/spec/integration/email_outbound_spec.rb b/spec/integration/email_outbound_spec.rb
index eaeebbe3ea..fea69ea7c4 100644
--- a/spec/integration/email_outbound_spec.rb
+++ b/spec/integration/email_outbound_spec.rb
@@ -11,7 +11,7 @@ RSpec.describe "Outbound Email" do
[message, result]
end
- context "email custom headers" do
+ describe "email custom headers" do
it "discards the custom header if it is one that has already been set based on arguments" do
SiteSetting.email_custom_headers = "Precedence: bulk"
post = Fabricate(:post)
diff --git a/spec/integration/email_style_spec.rb b/spec/integration/email_style_spec.rb
index b23cbe35e5..a53cff48e2 100644
--- a/spec/integration/email_style_spec.rb
+++ b/spec/integration/email_style_spec.rb
@@ -1,8 +1,7 @@
# frozen_string_literal: true
RSpec.describe EmailStyle do
-
- context "ERB evaluation" do
+ describe "ERB evaluation" do
it "does not evaluate ERB outside of the email itself" do
SiteSetting.email_custom_template = "%{email_content}<%= (111 * 333) %>"
html = Email::Renderer.new(UserNotifications.signup(Fabricate(:user))).html
@@ -23,7 +22,7 @@ RSpec.describe EmailStyle do
SiteSetting.remove_override!(:email_custom_css)
end
- context 'invite' do
+ context 'with invite' do
fab!(:invite) { Fabricate(:invite) }
let(:invite_mail) { InviteMailer.send_invite(invite) }
@@ -48,7 +47,7 @@ RSpec.describe EmailStyle do
end
end
- context 'user_replied' do
+ context 'when user_replied' do
let(:response_by_user) { Fabricate(:user, name: "John Doe") }
let(:category) { Fabricate(:category, name: 'India') }
let(:topic) { Fabricate(:topic, category: category, title: "Super cool topic") }
@@ -80,7 +79,7 @@ RSpec.describe EmailStyle do
# TODO: translation override
end
- context 'signup' do
+ context 'with signup' do
let(:signup_mail) { UserNotifications.signup(Fabricate(:user)) }
subject(:mail_html) { Email::Renderer.new(signup_mail).html }
@@ -89,7 +88,7 @@ RSpec.describe EmailStyle do
expect(mail_html).to include('activate-account')
end
- context 'translation override' do
+ context 'with translation override' do
before do
TranslationOverride.upsert!(
SiteSetting.default_locale,
@@ -121,7 +120,7 @@ RSpec.describe EmailStyle do
end
end
- context 'digest' do
+ context 'with digest' do
fab!(:popular_topic) { Fabricate(:topic, user: Fabricate(:coding_horror), created_at: 1.hour.ago) }
let(:summary_email) { UserNotifications.digest(Fabricate(:user)) }
subject(:mail_html) { Email::Renderer.new(summary_email).html }
diff --git a/spec/integration/same_ip_spammers_spec.rb b/spec/integration/same_ip_spammers_spec.rb
index b7cde6e3f6..a586891cf4 100644
--- a/spec/integration/same_ip_spammers_spec.rb
+++ b/spec/integration/same_ip_spammers_spec.rb
@@ -2,13 +2,12 @@
# frozen_string_literal: true
RSpec.describe "spammers on same IP" do
-
let(:ip_address) { '182.189.119.174' }
let!(:spammer1) { Fabricate(:user, ip_address: ip_address) }
let!(:spammer2) { Fabricate(:user, ip_address: ip_address) }
let(:spammer3) { Fabricate(:user, ip_address: ip_address) }
- context 'flag_sockpuppets is disabled' do
+ context 'when flag_sockpuppets is disabled' do
let!(:first_post) { create_post(user: spammer1) }
let!(:second_post) { create_post(user: spammer2, topic: first_post.topic) }
@@ -18,7 +17,7 @@ RSpec.describe "spammers on same IP" do
end
end
- context 'flag_sockpuppets is enabled' do
+ context 'when flag_sockpuppets is enabled' do
before do
SiteSetting.flag_sockpuppets = true
end
@@ -27,10 +26,10 @@ RSpec.describe "spammers on same IP" do
SiteSetting.flag_sockpuppets = false
end
- context 'first spammer starts a topic' do
+ context 'when first spammer starts a topic' do
let!(:first_post) { create_post(user: spammer1) }
- context 'second spammer replies' do
+ context 'when second spammer replies' do
let!(:second_post) { create_post(user: spammer2, topic: first_post.topic) }
it 'should increase spam count' do
@@ -38,7 +37,7 @@ RSpec.describe "spammers on same IP" do
expect(second_post.reload.spam_count).to eq(1)
end
- context 'third spam post' do
+ context 'with third spam post' do
let!(:third_post) { create_post(user: spammer3, topic: first_post.topic) }
it 'should increase spam count' do
@@ -50,13 +49,13 @@ RSpec.describe "spammers on same IP" do
end
end
- context 'first user is not new' do
+ context 'when first user is not new' do
let!(:old_user) { Fabricate(:user, ip_address: ip_address, created_at: 2.days.ago, trust_level: TrustLevel[1]) }
- context 'first user starts a topic' do
+ context 'when first user starts a topic' do
let!(:first_post) { create_post(user: old_user) }
- context 'a reply by a new user at the same IP address' do
+ context 'with a reply by a new user at the same IP address' do
let!(:second_post) { create_post(user: spammer2, topic: first_post.topic) }
it 'should increase the spam count correctly' do
@@ -67,5 +66,4 @@ RSpec.describe "spammers on same IP" do
end
end
end
-
end
diff --git a/spec/integration/spam_rules_spec.rb b/spec/integration/spam_rules_spec.rb
index cfc22442d8..bf89f47868 100644
--- a/spec/integration/spam_rules_spec.rb
+++ b/spec/integration/spam_rules_spec.rb
@@ -2,7 +2,6 @@
# frozen_string_literal: true
RSpec.describe "spam rules for users" do
-
describe 'auto-silence users based on flagging' do
fab!(:admin) { Fabricate(:admin) } # needed to send a system message
fab!(:moderator) { Fabricate(:moderator) }
@@ -16,10 +15,10 @@ RSpec.describe "spam rules for users" do
SiteSetting.num_users_to_silence_new_user = 2
end
- context 'spammer is a new user' do
+ context 'when spammer is a new user' do
fab!(:spammer) { Fabricate(:user, trust_level: TrustLevel[0]) }
- context 'spammer post is not flagged enough times' do
+ context 'when spammer post is not flagged enough times' do
let!(:spam_post) { create_post(user: spammer) }
let!(:spam_post2) { create_post(user: spammer) }
@@ -31,7 +30,7 @@ RSpec.describe "spam rules for users" do
expect(spam_post.reload).to_not be_hidden
end
- context 'spam posts are flagged enough times, but not by enough users' do
+ context 'when spam posts are flagged enough times, but not by enough users' do
it 'should not hide the post' do
PostActionCreator.create(user1, spam_post2, :spam)
@@ -41,7 +40,7 @@ RSpec.describe "spam rules for users" do
end
end
- context 'one spam post is flagged enough times by enough users' do
+ context 'when one spam post is flagged enough times by enough users' do
fab!(:another_topic) { Fabricate(:topic) }
let!(:private_messages_count) { spammer.private_topics_count }
let!(:mod_pm_count) { moderator.private_topics_count }
@@ -57,14 +56,14 @@ RSpec.describe "spam rules for users" do
expect(spammer.reload.private_topics_count).to eq(private_messages_count + 1)
end
- context "a post is deleted" do
+ context "when a post is deleted" do
it 'should silence the spammer' do
spam_post.trash!(moderator); spammer.reload
expect(spammer.reload).to be_silenced
end
end
- context "spammer becomes trust level 1" do
+ context "when spammer becomes trust level 1" do
it 'should silence the spammer' do
spammer.change_trust_level!(TrustLevel[1]); spammer.reload
expect(spammer.reload).to be_silenced
@@ -72,7 +71,7 @@ RSpec.describe "spam rules for users" do
end
end
- context 'hide_post_sensitivity' do
+ context 'with hide_post_sensitivity' do
it 'should silence the spammer' do
Reviewable.set_priorities(high: 2.0)
SiteSetting.hide_post_sensitivity = Reviewable.sensitivity[:low]
@@ -84,10 +83,10 @@ RSpec.describe "spam rules for users" do
end
end
- context "spammer has trust level basic" do
+ context "when spammer has trust level basic" do
let(:spammer) { Fabricate(:user, trust_level: TrustLevel[1]) }
- context 'one spam post is flagged enough times by enough users' do
+ context 'when one spam post is flagged enough times by enough users' do
let!(:spam_post) { Fabricate(:post, user: spammer) }
let!(:private_messages_count) { spammer.private_topics_count }
diff --git a/spec/integration/topic_auto_close_spec.rb b/spec/integration/topic_auto_close_spec.rb
index 11d851678e..95821bc30e 100644
--- a/spec/integration/topic_auto_close_spec.rb
+++ b/spec/integration/topic_auto_close_spec.rb
@@ -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) }
diff --git a/spec/integration/topic_thumbnail_spec.rb b/spec/integration/topic_thumbnail_spec.rb
index 9245716b14..9a51836c5a 100644
--- a/spec/integration/topic_thumbnail_spec.rb
+++ b/spec/integration/topic_thumbnail_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe "Topic Thumbnails" do
fab!(:topic) { Fabricate(:topic, image_upload_id: image.id) }
fab!(:user) { Fabricate(:user) }
- context 'latest' do
+ describe 'latest' do
def get_topic
Discourse.redis.del(topic.thumbnail_job_redis_key(Topic.thumbnail_sizes))
Discourse.redis.del(topic.thumbnail_job_redis_key([]))
diff --git a/spec/integration/watched_words_spec.rb b/spec/integration/watched_words_spec.rb
index 0aec8298d1..f776bafe99 100644
--- a/spec/integration/watched_words_spec.rb
+++ b/spec/integration/watched_words_spec.rb
@@ -21,7 +21,7 @@ RSpec.describe WatchedWord do
WordWatcher.clear_cache!
end
- context "block" do
+ context "with block" do
def should_block_post(manager)
expect {
result = manager.perform
@@ -88,7 +88,7 @@ RSpec.describe WatchedWord do
end
end
- context "require_approval" do
+ context "with require_approval" do
it "should queue the post for approval" do
manager = NewPostManager.new(tl2_user, raw: "My dog's name is #{require_approval_word.word}.", topic_id: topic.id)
result = manager.perform
@@ -130,7 +130,7 @@ RSpec.describe WatchedWord do
end
end
- context "flag" do
+ context "with flag" do
def should_flag_post(author, raw, topic)
post = Fabricate(:post, raw: raw, topic: topic, user: author)
expect {
diff --git a/spec/integrity/i18n_spec.rb b/spec/integrity/i18n_spec.rb
index 0205584c24..b175e8a459 100644
--- a/spec/integrity/i18n_spec.rb
+++ b/spec/integrity/i18n_spec.rb
@@ -113,7 +113,7 @@ RSpec.describe "fallbacks" do
end
end
- context "in a multi-threaded environment" do
+ context "when in a multi-threaded environment" do
it "finds the fallback translation" do
I18n.backend.store_translations(:en, test: "en test")
diff --git a/spec/jobs/auto_queue_handler_spec.rb b/spec/jobs/auto_queue_handler_spec.rb
index ece2af8473..6fb6c2a900 100644
--- a/spec/jobs/auto_queue_handler_spec.rb
+++ b/spec/jobs/auto_queue_handler_spec.rb
@@ -1,10 +1,9 @@
# frozen_string_literal: true
RSpec.describe Jobs::AutoQueueHandler do
-
subject { Jobs::AutoQueueHandler.new.execute({}) }
- context "old flagged post" do
+ describe "old flagged post" do
fab!(:spam_result) do
PostActionCreator.new(
Fabricate(:user),
@@ -38,7 +37,7 @@ RSpec.describe Jobs::AutoQueueHandler do
end
end
- context "reviewables" do
+ describe "reviewables" do
fab!(:new_post) { Fabricate(:reviewable_queued_post, created_at: 59.days.ago) }
fab!(:old_post) { Fabricate(:reviewable_queued_post, created_at: 61.days.ago) }
fab!(:new_user) { Fabricate(:reviewable, created_at: 10.days.ago) }
@@ -62,5 +61,4 @@ RSpec.describe Jobs::AutoQueueHandler do
expect(old_user.reload.pending?).to eq(true)
end
end
-
end
diff --git a/spec/jobs/bulk_invite_spec.rb b/spec/jobs/bulk_invite_spec.rb
index 0bbddc17b4..9d0984551d 100644
--- a/spec/jobs/bulk_invite_spec.rb
+++ b/spec/jobs/bulk_invite_spec.rb
@@ -106,7 +106,7 @@ RSpec.describe Jobs::BulkInvite do
expect(new_staged_user.user_fields[user_field.id.to_s]).to eq('value 3')
end
- context 'invites are more than 200' do
+ context 'when there are more than 200 invites' do
let(:bulk_invites) { [] }
before do
diff --git a/spec/jobs/clean_up_unused_staged_users_spec.rb b/spec/jobs/clean_up_unused_staged_users_spec.rb
index c083887115..daaad64912 100644
--- a/spec/jobs/clean_up_unused_staged_users_spec.rb
+++ b/spec/jobs/clean_up_unused_staged_users_spec.rb
@@ -14,19 +14,19 @@ RSpec.describe Jobs::CleanUpUnusedStagedUsers do
context "when staged user is old enough" do
before { staged_user.update!(created_at: 2.years.ago) }
- context "regular staged user" do
+ context "with regular staged user" do
it "deletes the staged user" do
expect { described_class.new.execute({}) }.to change { User.count }.by(-1)
expect(User.exists?(staged_user.id)).to eq(false)
end
end
- context "staged admin" do
+ context "with staged admin" do
before { staged_user.update!(admin: true) }
include_examples "does not delete"
end
- context "staged moderator" do
+ context "with staged moderator" do
before { staged_user.update!(moderator: true) }
include_examples "does not delete"
end
diff --git a/spec/jobs/enqueue_digest_emails_spec.rb b/spec/jobs/enqueue_digest_emails_spec.rb
index 958c7a5064..82b18c8c64 100644
--- a/spec/jobs/enqueue_digest_emails_spec.rb
+++ b/spec/jobs/enqueue_digest_emails_spec.rb
@@ -3,8 +3,7 @@
RSpec.describe Jobs::EnqueueDigestEmails do
describe '#target_users' do
-
- context 'disabled digests' do
+ context 'with disabled digests' do
before { SiteSetting.default_email_digest_frequency = 0 }
let!(:user_no_digests) { Fabricate(:active_user, last_emailed_at: 8.days.ago, last_seen_at: 10.days.ago) }
@@ -13,8 +12,7 @@ RSpec.describe Jobs::EnqueueDigestEmails do
end
end
- context 'unapproved users' do
-
+ context 'with unapproved users' do
before do
SiteSetting.must_approve_users = true
end
@@ -38,7 +36,7 @@ RSpec.describe Jobs::EnqueueDigestEmails do
end
end
- context 'staged users' do
+ context 'with staged users' do
let!(:staged_user) { Fabricate(:active_user, staged: true, last_emailed_at: 1.year.ago, last_seen_at: 1.year.ago) }
it "doesn't return staged users" do
@@ -46,16 +44,15 @@ RSpec.describe Jobs::EnqueueDigestEmails do
end
end
- context 'recently emailed' do
+ context 'when recently emailed' do
let!(:user_emailed_recently) { Fabricate(:active_user, last_emailed_at: 6.days.ago) }
it "doesn't return users who have been emailed recently" do
expect(Jobs::EnqueueDigestEmails.new.target_user_ids.include?(user_emailed_recently.id)).to eq(false)
end
-
end
- context "inactive user" do
+ context "with inactive user" do
let!(:inactive_user) { Fabricate(:user, active: false) }
it "doesn't return users who have been emailed recently" do
@@ -63,7 +60,7 @@ RSpec.describe Jobs::EnqueueDigestEmails do
end
end
- context "suspended user" do
+ context "with suspended user" do
let!(:suspended_user) { Fabricate(:user, suspended_till: 1.week.from_now, suspended_at: 1.day.ago) }
it "doesn't return users who are suspended" do
@@ -71,7 +68,7 @@ RSpec.describe Jobs::EnqueueDigestEmails do
end
end
- context 'visited the site this week' do
+ context 'when visited the site this week' do
let(:user_visited_this_week) { Fabricate(:active_user, last_seen_at: 6.days.ago) }
it "doesn't return users who have been emailed recently" do
@@ -80,7 +77,7 @@ RSpec.describe Jobs::EnqueueDigestEmails do
end
end
- context 'visited the site a year ago' do
+ context 'when visited the site a year ago' do
let!(:user_visited_a_year_ago) { Fabricate(:active_user, last_seen_at: 370.days.ago) }
it "doesn't return the user who have not visited the site for more than 365 days" do
@@ -88,7 +85,7 @@ RSpec.describe Jobs::EnqueueDigestEmails do
end
end
- context 'regular users' do
+ context 'with regular users' do
let!(:user) { Fabricate(:active_user, last_seen_at: (SiteSetting.suppress_digest_email_after_days - 1).days.ago) }
it "returns the user" do
@@ -96,7 +93,7 @@ RSpec.describe Jobs::EnqueueDigestEmails do
end
end
- context 'too many bounces' do
+ context 'with too many bounces' do
let!(:bounce_user) { Fabricate(:active_user, last_seen_at: 6.month.ago) }
it "doesn't return users with too many bounces" do
@@ -105,7 +102,7 @@ RSpec.describe Jobs::EnqueueDigestEmails do
end
end
- context "no primary email" do
+ context "with no primary email" do
let!(:user) { Fabricate(:active_user, last_seen_at: 2.months.ago) }
it "doesn't return users with no primary emails" do
@@ -116,7 +113,6 @@ RSpec.describe Jobs::EnqueueDigestEmails do
end
describe '#execute' do
-
let(:user) { Fabricate(:user) }
it "limits jobs enqueued per max_digests_enqueued_per_30_mins_per_site" do
@@ -146,7 +142,7 @@ RSpec.describe Jobs::EnqueueDigestEmails do
end
end
- context "digest emails are enabled" do
+ context "when digest emails are enabled" do
before do
Jobs::EnqueueDigestEmails.any_instance.expects(:target_user_ids).returns([user.id])
end
@@ -160,7 +156,7 @@ RSpec.describe Jobs::EnqueueDigestEmails do
end
end
- context "private email" do
+ context "with private email" do
before do
Jobs::EnqueueDigestEmails.any_instance.expects(:target_user_ids).never
SiteSetting.private_email = true
@@ -173,7 +169,7 @@ RSpec.describe Jobs::EnqueueDigestEmails do
end
end
- context "digest emails are disabled" do
+ context "when digest emails are disabled" do
before do
Jobs::EnqueueDigestEmails.any_instance.expects(:target_user_ids).never
SiteSetting.disable_digest_emails = true
@@ -185,7 +181,5 @@ RSpec.describe Jobs::EnqueueDigestEmails do
end
end
end
-
end
-
end
diff --git a/spec/jobs/ensure_s3_uploads_existence_spec.rb b/spec/jobs/ensure_s3_uploads_existence_spec.rb
index aef97c2258..84d6e6c812 100644
--- a/spec/jobs/ensure_s3_uploads_existence_spec.rb
+++ b/spec/jobs/ensure_s3_uploads_existence_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
RSpec.describe Jobs::EnsureS3UploadsExistence do
- context "S3 inventory enabled" do
+ context "with S3 inventory enabled" do
before do
setup_s3
SiteSetting.enable_s3_inventory = true
@@ -27,7 +27,7 @@ RSpec.describe Jobs::EnsureS3UploadsExistence do
end
end
- context "S3 inventory disabled" do
+ context "with S3 inventory disabled" do
before { SiteSetting.enable_s3_inventory = false }
it "doesn't execute" do
diff --git a/spec/jobs/export_user_archive_spec.rb b/spec/jobs/export_user_archive_spec.rb
index 15eb36313a..09f86a331f 100644
--- a/spec/jobs/export_user_archive_spec.rb
+++ b/spec/jobs/export_user_archive_spec.rb
@@ -109,7 +109,7 @@ RSpec.describe Jobs::ExportUserArchive do
end
end
- context 'user_archive posts' do
+ describe 'user_archive posts' do
let(:component) { 'user_archive' }
let(:subsubcategory) { Fabricate(:category_with_definition, parent_category_id: subcategory.id) }
let(:subsubtopic) { Fabricate(:topic, category: subsubcategory) }
@@ -181,7 +181,7 @@ RSpec.describe Jobs::ExportUserArchive do
end
end
- context 'preferences' do
+ describe 'preferences' do
let(:component) { 'preferences' }
before do
@@ -206,7 +206,7 @@ RSpec.describe Jobs::ExportUserArchive do
end
end
- context 'auth tokens' do
+ describe 'auth tokens' do
let(:component) { 'auth_tokens' }
before do
@@ -225,7 +225,7 @@ RSpec.describe Jobs::ExportUserArchive do
expect(data[0]['user_agent']).to eq('MyWebBrowser')
end
- context 'auth token logs' do
+ context 'with auth token logs' do
let(:component) { 'auth_token_logs' }
it 'includes details such as the path' do
data, _csv_out = make_component_csv
@@ -237,7 +237,7 @@ RSpec.describe Jobs::ExportUserArchive do
end
end
- context 'badges' do
+ describe 'badges' do
let(:component) { 'badges' }
let(:badge1) { Fabricate(:badge) }
@@ -264,10 +264,9 @@ RSpec.describe Jobs::ExportUserArchive do
expect(data[2]['granted_manually']).to eq('true')
expect(Post.find(data[3]['post_id'])).to_not be_nil
end
-
end
- context 'bookmarks' do
+ describe 'bookmarks' do
let(:component) { 'bookmarks' }
let(:name) { 'Collect my thoughts on this' }
@@ -321,7 +320,7 @@ RSpec.describe Jobs::ExportUserArchive do
end
end
- context 'category_preferences' do
+ describe 'category_preferences' do
let(:component) { 'category_preferences' }
let(:subsubcategory) { Fabricate(:category_with_definition, parent_category_id: subcategory.id, name: "User Archive Subcategory") }
@@ -394,7 +393,7 @@ RSpec.describe Jobs::ExportUserArchive do
end
end
- context 'flags' do
+ describe 'flags' do
let(:component) { 'flags' }
let(:other_post) { Fabricate(:post, user: admin) }
let(:post3) { Fabricate(:post) }
@@ -429,7 +428,7 @@ RSpec.describe Jobs::ExportUserArchive do
end
end
- context 'likes' do
+ describe 'likes' do
let(:component) { 'likes' }
let(:other_post) { Fabricate(:post, user: admin) }
let(:post3) { Fabricate(:post) }
@@ -452,7 +451,7 @@ RSpec.describe Jobs::ExportUserArchive do
end
end
- context 'queued posts' do
+ describe 'queued posts' do
let(:component) { 'queued_posts' }
let(:reviewable_post) { Fabricate(:reviewable_queued_post, topic: topic, created_by: user) }
let(:reviewable_topic) { Fabricate(:reviewable_queued_post_topic, category: category, created_by: user) }
@@ -478,7 +477,7 @@ RSpec.describe Jobs::ExportUserArchive do
end
end
- context 'visits' do
+ describe 'visits' do
let(:component) { 'visits' }
it 'correctly exports the UserVisit table' do
diff --git a/spec/jobs/feature_topic_users_spec.rb b/spec/jobs/feature_topic_users_spec.rb
index bae3f19a6d..3fa7eba092 100644
--- a/spec/jobs/feature_topic_users_spec.rb
+++ b/spec/jobs/feature_topic_users_spec.rb
@@ -33,7 +33,7 @@ RSpec.describe Jobs::FeatureTopicUsers do
end
end
- context "participant count" do
+ context "with participant count" do
let!(:post) { create_post }
let(:topic) { post.topic }
diff --git a/spec/jobs/grant_anniversary_badges_spec.rb b/spec/jobs/grant_anniversary_badges_spec.rb
index e2e2b70c84..ae5cad056c 100644
--- a/spec/jobs/grant_anniversary_badges_spec.rb
+++ b/spec/jobs/grant_anniversary_badges_spec.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true
RSpec.describe Jobs::GrantAnniversaryBadges do
-
let(:granter) { described_class.new }
it "doesn't award to a user who is less than a year old" do
@@ -86,7 +85,7 @@ RSpec.describe Jobs::GrantAnniversaryBadges do
expect(badge.count).to eq(1)
end
- context "repeated grants" do
+ context "with repeated grants" do
it "won't award twice in the same year" do
user = Fabricate(:user, created_at: 400.days.ago)
Fabricate(:post, user: user, created_at: 1.week.ago)
@@ -132,5 +131,4 @@ RSpec.describe Jobs::GrantAnniversaryBadges do
expect(badge.count).to eq(2)
end
end
-
end
diff --git a/spec/jobs/invalidate_inactive_admins_spec.rb b/spec/jobs/invalidate_inactive_admins_spec.rb
index ca84c2e857..8994e9f730 100644
--- a/spec/jobs/invalidate_inactive_admins_spec.rb
+++ b/spec/jobs/invalidate_inactive_admins_spec.rb
@@ -17,7 +17,7 @@ RSpec.describe Jobs::InvalidateInactiveAdmins do
fab!(:not_seen_admin) { Fabricate(:admin, last_seen_at: 370.days.ago) }
before { not_seen_admin.email_tokens.update_all(confirmed: true) }
- context 'invalidate_inactive_admin_email_after_days = 365' do
+ context 'when invalidate_inactive_admin_email_after_days = 365' do
before do
SiteSetting.invalidate_inactive_admin_email_after_days = 365
end
@@ -65,7 +65,7 @@ RSpec.describe Jobs::InvalidateInactiveAdmins do
end
end
- context 'invalidate_inactive_admin_email_after_days = 0 to disable this feature' do
+ context 'when invalidate_inactive_admin_email_after_days = 0 to disable this feature' do
before do
SiteSetting.invalidate_inactive_admin_email_after_days = 0
end
diff --git a/spec/jobs/jobs_spec.rb b/spec/jobs/jobs_spec.rb
index f5ce9e2ccd..09c4252dec 100644
--- a/spec/jobs/jobs_spec.rb
+++ b/spec/jobs/jobs_spec.rb
@@ -110,7 +110,7 @@ RSpec.describe Jobs do
Jobs.enqueue(:process_post, post_id: 1)
end
- context 'and current_site_id option is given and does not match the current connection' do
+ context 'when current_site_id option is given and does not match the current connection' do
before do
Sidekiq::Client.stubs(:enqueue)
Jobs::ProcessPost.any_instance.stubs(:execute).returns(true)
diff --git a/spec/jobs/notify_mailing_list_subscribers_spec.rb b/spec/jobs/notify_mailing_list_subscribers_spec.rb
index ceed63d598..ace5161f91 100644
--- a/spec/jobs/notify_mailing_list_subscribers_spec.rb
+++ b/spec/jobs/notify_mailing_list_subscribers_spec.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true
RSpec.describe Jobs::NotifyMailingListSubscribers do
-
fab!(:mailing_list_user) { Fabricate(:user) }
before { mailing_list_user.user_option.update(mailing_list_mode: true, mailing_list_mode_frequency: 1) }
@@ -88,68 +87,67 @@ RSpec.describe Jobs::NotifyMailingListSubscribers do
end
context "with a valid post from another user" do
-
- context "to an inactive user" do
+ context "when to an inactive user" do
before { mailing_list_user.update(active: false) }
include_examples "no emails"
end
- context "to a silenced user" do
+ context "when to a silenced user" do
before { mailing_list_user.update(silenced_till: 1.year.from_now) }
include_examples "no emails"
end
- context "to a suspended user" do
+ context "when to a suspended user" do
before { mailing_list_user.update(suspended_till: 1.day.from_now) }
include_examples "no emails"
end
- context "to an anonymous user" do
+ context "when to an anonymous user" do
fab!(:mailing_list_user) { Fabricate(:anonymous) }
include_examples "no emails"
end
- context "to an user who has disabled mailing list mode" do
+ context "when to an user who has disabled mailing list mode" do
before { mailing_list_user.user_option.update(mailing_list_mode: false) }
include_examples "no emails"
end
- context "to an user who has frequency set to 'always'" do
+ context "when to an user who has frequency set to 'always'" do
before { mailing_list_user.user_option.update(mailing_list_mode_frequency: 1) }
include_examples "one email"
end
- context "to an user who has frequency set to 'no echo'" do
+ context "when to an user who has frequency set to 'no echo'" do
before { mailing_list_user.user_option.update(mailing_list_mode_frequency: 2) }
include_examples "one email"
end
- context "from a muted user" do
+ context "when from a muted user" do
before { MutedUser.create(user: mailing_list_user, muted_user: user) }
include_examples "no emails"
end
- context "from an ignored user" do
+ context "when from an ignored user" do
before { Fabricate(:ignored_user, user: mailing_list_user, ignored_user: user) }
include_examples "no emails"
end
- context "from a muted topic" do
+ context "when from a muted topic" do
before { TopicUser.create(user: mailing_list_user, topic: post.topic, notification_level: TopicUser.notification_levels[:muted]) }
include_examples "no emails"
end
- context "from a muted category" do
+ context "when from a muted category" do
before { CategoryUser.create(user: mailing_list_user, category: post.topic.category, notification_level: CategoryUser.notification_levels[:muted]) }
include_examples "no emails"
end
- context "mute all categories by default setting" do
+ context "with mute all categories by default setting" do
before { SiteSetting.mute_all_categories_by_default = true }
include_examples "no emails"
end
- context "mute all categories by default setting but user is watching category" do
+ context "with mute all categories by default setting but user is watching category" do
before do
SiteSetting.mute_all_categories_by_default = true
CategoryUser.create(user: mailing_list_user, category: post.topic.category, notification_level: CategoryUser.notification_levels[:watching])
@@ -157,7 +155,7 @@ RSpec.describe Jobs::NotifyMailingListSubscribers do
include_examples "one email"
end
- context "mute all categories by default setting but user is watching tag" do
+ context "with mute all categories by default setting but user is watching tag" do
before do
SiteSetting.mute_all_categories_by_default = true
TagUser.create(user: mailing_list_user, tag: tag, notification_level: TagUser.notification_levels[:watching])
@@ -165,7 +163,7 @@ RSpec.describe Jobs::NotifyMailingListSubscribers do
include_examples "one email"
end
- context "mute all categories by default setting but user is watching topic" do
+ context "with mute all categories by default setting but user is watching topic" do
before do
SiteSetting.mute_all_categories_by_default = true
TopicUser.create(user: mailing_list_user, topic: post.topic, notification_level: TopicUser.notification_levels[:watching])
@@ -173,12 +171,12 @@ RSpec.describe Jobs::NotifyMailingListSubscribers do
include_examples "one email"
end
- context "from a muted tag" do
+ context "when from a muted tag" do
before { TagUser.create(user: mailing_list_user, tag: tag, notification_level: TagUser.notification_levels[:muted]) }
include_examples "no emails"
end
- context "max emails per day was reached" do
+ context "when max emails per day was reached" do
before { SiteSetting.max_emails_per_day_per_user = 2 }
it "doesn't send any emails" do
@@ -224,8 +222,7 @@ RSpec.describe Jobs::NotifyMailingListSubscribers do
end
end
- context "bounce score was reached" do
-
+ context "when bounce score was reached" do
it "doesn't send any emails" do
mailing_list_user.user_stat.update(bounce_score: SiteSetting.bounce_score_threshold + 1)
@@ -240,30 +237,26 @@ RSpec.describe Jobs::NotifyMailingListSubscribers do
reason_type: SkippedEmailLog.reason_types[:exceeded_bounces_limit]
)).to eq(true)
end
-
end
-
end
context "with a valid post from same user" do
fab!(:post) { Fabricate(:post, user: mailing_list_user) }
- context "to an user who has frequency set to 'daily'" do
+ context "when to an user who has frequency set to 'daily'" do
before { mailing_list_user.user_option.update(mailing_list_mode_frequency: 0) }
include_examples "no emails"
end
- context "to an user who has frequency set to 'always'" do
+ context "when to an user who has frequency set to 'always'" do
before { mailing_list_user.user_option.update(mailing_list_mode_frequency: 1) }
include_examples "one email"
end
- context "to an user who has frequency set to 'no echo'" do
+ context "when to an user who has frequency set to 'no echo'" do
before { mailing_list_user.user_option.update(mailing_list_mode_frequency: 2) }
include_examples "no emails"
end
end
-
end
-
end
diff --git a/spec/jobs/notify_tag_change_spec.rb b/spec/jobs/notify_tag_change_spec.rb
index efe15c959f..f0fab3d519 100644
--- a/spec/jobs/notify_tag_change_spec.rb
+++ b/spec/jobs/notify_tag_change_spec.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true
RSpec.describe ::Jobs::NotifyTagChange do
-
fab!(:user) { Fabricate(:user) }
fab!(:regular_user) { Fabricate(:trust_level_4) }
fab!(:post) { Fabricate(:post, user: regular_user) }
@@ -50,7 +49,7 @@ RSpec.describe ::Jobs::NotifyTagChange do
expect { described_class.new.execute(post_id: post.id, notified_user_ids: [regular_user.id]) }.not_to change { Notification.count }
end
- context 'hidden tag' do
+ describe 'hidden tag' do
let!(:hidden_group) { Fabricate(:group, name: 'hidden_group') }
let!(:hidden_tag_group) { Fabricate(:tag_group, name: 'hidden', permissions: [[hidden_group.id, :full]]) }
let!(:topic_user) { Fabricate(:topic_user, user: user, topic: post.topic, notification_level: TopicUser.notification_levels[:watching]) }
diff --git a/spec/jobs/pending_queued_posts_reminder_spec.rb b/spec/jobs/pending_queued_posts_reminder_spec.rb
index fde2b66e0b..7611556dd5 100644
--- a/spec/jobs/pending_queued_posts_reminder_spec.rb
+++ b/spec/jobs/pending_queued_posts_reminder_spec.rb
@@ -3,7 +3,7 @@
RSpec.describe Jobs::PendingQueuedPostsReminder do
let(:job) { described_class.new }
- context "notify_about_queued_posts_after is 0" do
+ context "when notify_about_queued_posts_after is 0" do
before { SiteSetting.notify_about_queued_posts_after = 0 }
it "never emails" do
@@ -14,7 +14,7 @@ RSpec.describe Jobs::PendingQueuedPostsReminder do
end
end
- context "notify_about_queued_posts_after accepts a float" do
+ context "when notify_about_queued_posts_after accepts a float" do
before do
SiteSetting.notify_about_queued_posts_after = 0.25
job.last_notified_id = nil
@@ -32,13 +32,12 @@ RSpec.describe Jobs::PendingQueuedPostsReminder do
end
end
- context "notify_about_queued_posts_after is 24" do
+ context "when notify_about_queued_posts_after is 24" do
before do
SiteSetting.notify_about_queued_posts_after = 24
end
context "when we haven't been notified in a while" do
-
before do
job.last_notified_id = nil
end
diff --git a/spec/jobs/pending_reviewables_reminder_spec.rb b/spec/jobs/pending_reviewables_reminder_spec.rb
index c93928c35d..2b6d4deafd 100644
--- a/spec/jobs/pending_reviewables_reminder_spec.rb
+++ b/spec/jobs/pending_reviewables_reminder_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe Jobs::PendingReviewablesReminder do
expect(execute.sent_reminder).to eq(false)
end
- context "notify_about_flags_after is 0" do
+ context "when notify_about_flags_after is 0" do
before { SiteSetting.notify_about_flags_after = 0 }
it "never notifies" do
@@ -24,7 +24,7 @@ RSpec.describe Jobs::PendingReviewablesReminder do
end
end
- context "notify_about_flags_after accepts a float" do
+ context "when notify_about_flags_after accepts a float" do
before { SiteSetting.notify_about_flags_after = 0.25 }
it "doesn't send message when flags are less than 15 minutes old" do
@@ -38,7 +38,7 @@ RSpec.describe Jobs::PendingReviewablesReminder do
end
end
- context "notify_about_flags_after is 48" do
+ context "when notify_about_flags_after is 48" do
before do
SiteSetting.notify_about_flags_after = 48
described_class.clear_key
@@ -68,7 +68,7 @@ RSpec.describe Jobs::PendingReviewablesReminder do
expect(execute.sent_reminder).to eq(true)
end
- context "reviewable_default_visibility" do
+ context "with reviewable_default_visibility" do
before do
create_flag(49.hours.ago)
create_flag(51.hours.ago)
diff --git a/spec/jobs/pending_users_reminder_spec.rb b/spec/jobs/pending_users_reminder_spec.rb
index d3a9c4d011..c482231d6e 100644
--- a/spec/jobs/pending_users_reminder_spec.rb
+++ b/spec/jobs/pending_users_reminder_spec.rb
@@ -1,8 +1,7 @@
# frozen_string_literal: true
RSpec.describe Jobs::PendingUsersReminder do
-
- context 'must_approve_users is true' do
+ context 'when must_approve_users is true' do
before do
SiteSetting.must_approve_users = true
Jobs::PendingUsersReminder.any_instance.stubs(:previous_newest_username).returns(nil)
@@ -13,7 +12,7 @@ RSpec.describe Jobs::PendingUsersReminder do
Jobs::PendingUsersReminder.new.execute({})
end
- context "there are pending users" do
+ context "when there are pending users" do
before do
Fabricate(:moderator, approved: true, approved_by_id: -1, approved_at: 1.week.ago)
Group.refresh_automatic_group!(:moderators)
@@ -49,7 +48,7 @@ RSpec.describe Jobs::PendingUsersReminder do
end
end
- context 'must_approve_users is false' do
+ context 'when must_approve_users is false' do
before do
SiteSetting.must_approve_users = false
end
diff --git a/spec/jobs/poll_mailbox_spec.rb b/spec/jobs/poll_mailbox_spec.rb
index 1f5e59e764..3ba8fe72fe 100644
--- a/spec/jobs/poll_mailbox_spec.rb
+++ b/spec/jobs/poll_mailbox_spec.rb
@@ -1,11 +1,9 @@
# frozen_string_literal: true
RSpec.describe Jobs::PollMailbox do
-
let(:poller) { Jobs::PollMailbox.new }
describe ".execute" do
-
it "does no polling if pop3_polling_enabled is false" do
SiteSetting.expects(:pop3_polling_enabled).returns(false)
poller.expects(:poll_pop3).never
@@ -17,7 +15,6 @@ RSpec.describe Jobs::PollMailbox do
poller.expects(:poll_pop3).once
poller.execute({})
end
-
end
describe ".poll_pop3" do
@@ -39,7 +36,7 @@ RSpec.describe Jobs::PollMailbox do
EMAIL
end
- context "pop errors" do
+ context "with pop errors" do
before do
Discourse.expects(:handle_job_exception).at_least_once
end
@@ -114,7 +111,7 @@ RSpec.describe Jobs::PollMailbox do
poller.poll_pop3
end
- context "has emails" do
+ context "when has emails" do
let(:oldmail) { file_from_fixtures("old_destination.eml", "emails").read }
before do
@@ -173,7 +170,5 @@ RSpec.describe Jobs::PollMailbox do
I18n.t("emails.incoming.errors.bounced_email_error")
)
end
-
end
-
end
diff --git a/spec/jobs/regular/group_smtp_email_spec.rb b/spec/jobs/regular/group_smtp_email_spec.rb
index b85ef6d3ca..01bc1ec1de 100644
--- a/spec/jobs/regular/group_smtp_email_spec.rb
+++ b/spec/jobs/regular/group_smtp_email_spec.rb
@@ -253,7 +253,7 @@ RSpec.describe Jobs::GroupSmtpEmail do
end
end
- context "group is deleted" do
+ context "when group is deleted" do
it "returns without sending email" do
group.destroy
subject.execute(args)
diff --git a/spec/jobs/remove_banner_spec.rb b/spec/jobs/remove_banner_spec.rb
index f218d801fc..6456568eb1 100644
--- a/spec/jobs/remove_banner_spec.rb
+++ b/spec/jobs/remove_banner_spec.rb
@@ -4,7 +4,7 @@ RSpec.describe Jobs::RemoveBanner do
fab!(:topic) { Fabricate(:topic) }
fab!(:user) { topic.user }
- context 'topic is not bannered until' do
+ context 'when topic is not bannered until' do
it 'doesn’t enqueue a future job to remove it' do
expect do
topic.make_banner!(user)
@@ -12,8 +12,8 @@ RSpec.describe Jobs::RemoveBanner do
end
end
- context 'topic is bannered until' do
- context 'bannered_until is a valid date' do
+ context 'when topic is bannered until' do
+ context 'when bannered_until is a valid date' do
it 'enqueues a future job to remove it' do
bannered_until = 5.days.from_now
@@ -36,7 +36,7 @@ RSpec.describe Jobs::RemoveBanner do
end
end
- context 'bannered_until is an invalid date' do
+ context 'when bannered_until is an invalid date' do
it 'doesn’t enqueue a future job to remove it' do
expect do
expect do
diff --git a/spec/jobs/sync_acls_for_uploads_spec.rb b/spec/jobs/sync_acls_for_uploads_spec.rb
index 87d5e42d26..a7b43162ca 100644
--- a/spec/jobs/sync_acls_for_uploads_spec.rb
+++ b/spec/jobs/sync_acls_for_uploads_spec.rb
@@ -17,7 +17,7 @@ RSpec.describe Jobs::SyncAclsForUploads do
run_job
end
- context "external storage enabled" do
+ context "with external storage enabled" do
before do
setup_s3
stub_s3_store
diff --git a/spec/jobs/tl3_promotions_spec.rb b/spec/jobs/tl3_promotions_spec.rb
index 5c43b378e9..770bb39c16 100644
--- a/spec/jobs/tl3_promotions_spec.rb
+++ b/spec/jobs/tl3_promotions_spec.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true
RSpec.describe Jobs::Tl3Promotions do
-
def create_qualifying_stats(user)
user.create_user_stat if user.user_stat.nil?
user.user_stat.update!(
@@ -44,7 +43,7 @@ RSpec.describe Jobs::Tl3Promotions do
run_job
end
- context "tl3 user who doesn't qualify for tl3 anymore" do
+ context "with tl3 user who doesn't qualify for tl3 anymore" do
def create_leader_user
user = Fabricate(:user, trust_level: TrustLevel[2])
TrustLevel3Requirements.any_instance.stubs(:requirements_met?).returns(true)
diff --git a/spec/jobs/user_email_spec.rb b/spec/jobs/user_email_spec.rb
index 3025fbe474..efda1132b6 100644
--- a/spec/jobs/user_email_spec.rb
+++ b/spec/jobs/user_email_spec.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true
RSpec.describe Jobs::UserEmail do
-
before do
SiteSetting.email_time_window_mins = 10
end
@@ -23,7 +22,7 @@ RSpec.describe Jobs::UserEmail do
expect { Jobs::UserEmail.new.execute(type: :no_method, user_id: user.id) }.to raise_error(Discourse::InvalidParameters)
end
- context 'digest can be generated' do
+ context 'when digest can be generated' do
fab!(:user) { Fabricate(:user, last_seen_at: 8.days.ago, last_emailed_at: 8.days.ago) }
fab!(:popular_topic) { Fabricate(:topic, user: Fabricate(:admin), created_at: 1.hour.ago) }
@@ -38,7 +37,7 @@ RSpec.describe Jobs::UserEmail do
expect(ActionMailer::Base.deliveries).to eq([])
end
- context 'not emailed recently' do
+ context 'when not emailed recently' do
before do
freeze_time
user.update!(last_emailed_at: 8.days.ago)
@@ -51,7 +50,7 @@ RSpec.describe Jobs::UserEmail do
end
end
- context 'recently emailed' do
+ context 'when recently emailed' do
before do
freeze_time
user.update!(last_emailed_at: 2.hours.ago)
@@ -66,8 +65,7 @@ RSpec.describe Jobs::UserEmail do
end
end
- context "bounce score" do
-
+ context "with bounce score" do
it "always sends critical emails when bounce score threshold has been reached" do
email_token = Fabricate(:email_token)
user.user_stat.update(bounce_score: SiteSetting.bounce_score_threshold + 1)
@@ -81,10 +79,9 @@ RSpec.describe Jobs::UserEmail do
user.email
)
end
-
end
- context 'to_address' do
+ context 'with to_address' do
it 'overwrites a to_address when present' do
Jobs::UserEmail.new.execute(type: :confirm_new_email, user_id: user.id, to_address: 'jake@adventuretime.ooo')
@@ -94,7 +91,7 @@ RSpec.describe Jobs::UserEmail do
end
end
- context "disable_emails setting" do
+ context "with disable_emails setting" do
it "sends when no" do
SiteSetting.disable_emails = 'no'
Jobs::UserEmail.new.execute(type: :confirm_new_email, user_id: user.id)
@@ -112,7 +109,7 @@ RSpec.describe Jobs::UserEmail do
end
end
- context "recently seen" do
+ context "when recently seen" do
fab!(:post) { Fabricate(:post, user: user) }
fab!(:notification) { Fabricate(
:notification,
@@ -246,7 +243,7 @@ RSpec.describe Jobs::UserEmail do
end
end
- context "email_log" do
+ context "with email_log" do
fab!(:post) { Fabricate(:post, created_at: 30.seconds.ago) }
before do
@@ -317,8 +314,7 @@ RSpec.describe Jobs::UserEmail do
end
end
- context 'args' do
-
+ context 'with args' do
it 'passes a token as an argument when a token is present' do
Jobs::UserEmail.new.execute(type: :forgot_password, user_id: user.id, email_token: 'asdfasdf')
@@ -328,7 +324,7 @@ RSpec.describe Jobs::UserEmail do
expect(mail.body).to include("asdfasdf")
end
- context "confirm_new_email" do
+ context "with confirm_new_email" do
let(:email_token) { Fabricate(:email_token, user: user) }
before do
EmailChangeRequest.create!(
@@ -368,7 +364,7 @@ RSpec.describe Jobs::UserEmail do
end
end
- context "post" do
+ context "with post" do
fab!(:post) { Fabricate(:post, user: user) }
it "doesn't send the email if you've seen the post" do
@@ -392,7 +388,7 @@ RSpec.describe Jobs::UserEmail do
expect(ActionMailer::Base.deliveries).to eq([])
end
- context 'user is suspended' do
+ context 'when user is suspended' do
it "doesn't send email for a pm from a regular user" do
Jobs::UserEmail.new.execute(type: :user_private_message, user_id: suspended.id, post_id: post.id)
@@ -443,7 +439,7 @@ RSpec.describe Jobs::UserEmail do
end
end
- context 'user is anonymous' do
+ context 'when user is anonymous' do
before { SiteSetting.allow_anonymous_posting = true }
it "doesn't send email for a pm from a regular user" do
@@ -462,7 +458,7 @@ RSpec.describe Jobs::UserEmail do
end
end
- context 'notification' do
+ context 'with notification' do
fab!(:post) { Fabricate(:post, user: user) }
fab!(:notification) {
Fabricate(:notification,
@@ -541,7 +537,7 @@ RSpec.describe Jobs::UserEmail do
expect(ActionMailer::Base.deliveries.first.to).to contain_exactly(user.email)
end
- context "recently seen" do
+ context "when recently seen" do
it "doesn't send an email to a user that's been recently seen" do
user.update!(last_seen_at: 9.minutes.ago)
@@ -572,7 +568,7 @@ RSpec.describe Jobs::UserEmail do
end
end
- context 'max_emails_per_day_per_user limit is reached' do
+ context 'when max_emails_per_day_per_user limit is reached' do
before do
SiteSetting.max_emails_per_day_per_user = 2
2.times { Fabricate(:email_log, user: user, email_type: 'blah', to_address: user.email) }
@@ -718,7 +714,7 @@ RSpec.describe Jobs::UserEmail do
expect(ActionMailer::Base.deliveries).to eq([])
end
- context 'user is suspended' do
+ context 'when user is suspended' do
it "doesn't send email for a pm from a regular user" do
msg, err = Jobs::UserEmail.new.message_for_email(
suspended,
@@ -731,7 +727,7 @@ RSpec.describe Jobs::UserEmail do
expect(err).not_to eq(nil)
end
- context 'pm from staff' do
+ context 'with pm from staff' do
before do
@pm_from_staff = Fabricate(:post, user: Fabricate(:moderator))
@pm_from_staff.topic.topic_allowed_users.create!(user_id: suspended.id)
@@ -768,7 +764,7 @@ RSpec.describe Jobs::UserEmail do
end
end
- context 'user is anonymous' do
+ context 'when user is anonymous' do
before { SiteSetting.allow_anonymous_posting = true }
it "doesn't send email for a pm from a regular user" do
@@ -802,6 +798,5 @@ RSpec.describe Jobs::UserEmail do
end
end
end
-
end
end
diff --git a/spec/lib/admin_user_index_query_spec.rb b/spec/lib/admin_user_index_query_spec.rb
index d9519d33ea..4bce40f83e 100644
--- a/spec/lib/admin_user_index_query_spec.rb
+++ b/spec/lib/admin_user_index_query_spec.rb
@@ -100,7 +100,7 @@ RSpec.describe AdminUserIndexQuery do
expect(query.find_users).not_to include(inactive_user)
end
- context 'and a suspended pending user' do
+ context 'with a suspended pending user' do
fab!(:suspended_user) { Fabricate(:user, approved: false, suspended_at: 1.hour.ago, suspended_till: 20.years.from_now) }
it "doesn't return the suspended user" do
query = ::AdminUserIndexQuery.new(query: 'pending')
@@ -182,7 +182,7 @@ RSpec.describe AdminUserIndexQuery do
describe "filtering" do
- context "exact email bypass" do
+ context "with exact email bypass" do
it "can correctly bypass expensive ilike query" do
user = Fabricate(:user, email: 'sam@Sam.com')
@@ -208,7 +208,7 @@ RSpec.describe AdminUserIndexQuery do
end
end
- context "by email fragment" do
+ context "with email fragment" do
before(:each) { Fabricate(:user, email: "test1@example.com") }
@@ -224,7 +224,7 @@ RSpec.describe AdminUserIndexQuery do
end
- context "by username fragment" do
+ context "with username fragment" do
before(:each) { Fabricate(:user, username: "test_user_1") }
@@ -239,7 +239,7 @@ RSpec.describe AdminUserIndexQuery do
end
end
- context "by ip address fragment" do
+ context "with ip address fragment" do
fab!(:user) { Fabricate(:user, ip_address: "117.207.94.9") }
diff --git a/spec/lib/archetype_spec.rb b/spec/lib/archetype_spec.rb
index 1f662c7b89..9b5a6b6945 100644
--- a/spec/lib/archetype_spec.rb
+++ b/spec/lib/archetype_spec.rb
@@ -4,9 +4,7 @@
require 'archetype'
RSpec.describe Archetype do
-
- context 'default archetype' do
-
+ describe 'default archetype' do
it 'has an Archetype by default' do
expect(Archetype.list).to be_present
end
@@ -15,8 +13,7 @@ RSpec.describe Archetype do
expect(Archetype.list.first.id).to eq(Archetype.default)
end
- context 'duplicate' do
-
+ context 'with duplicate' do
before do
@old_size = Archetype.list.size
Archetype.register(Archetype.default)
@@ -25,20 +22,15 @@ RSpec.describe Archetype do
it 'does not add the same archetype twice' do
expect(Archetype.list.size).to eq(@old_size)
end
-
end
-
end
- context 'register an archetype' do
-
+ describe 'register an archetype' do
it 'has one more element' do
@list = Archetype.list.dup
Archetype.register('glados')
expect(Archetype.list.size).to eq(@list.size + 1)
expect(Archetype.list.find { |a| a.id == 'glados' }).to be_present
end
-
end
-
end
diff --git a/spec/lib/auth/default_current_user_provider_spec.rb b/spec/lib/auth/default_current_user_provider_spec.rb
index b26d91afa9..bd470e547e 100644
--- a/spec/lib/auth/default_current_user_provider_spec.rb
+++ b/spec/lib/auth/default_current_user_provider_spec.rb
@@ -50,7 +50,7 @@ RSpec.describe Auth::DefaultCurrentUserProvider do
expect(provider.current_user).to eq(nil)
end
- context "server header api" do
+ describe "server header api" do
it "raises for a revoked key" do
api_key = ApiKey.create!
params = { "HTTP_API_USERNAME" => user.username.downcase, "HTTP_API_KEY" => api_key.key }
@@ -214,7 +214,7 @@ RSpec.describe Auth::DefaultCurrentUserProvider do
end
end
- context "rate limiting" do
+ context "with rate limiting" do
before do
RateLimiter.enable
end
@@ -435,7 +435,7 @@ RSpec.describe Auth::DefaultCurrentUserProvider do
end
- context "events" do
+ describe "events" do
before do
@refreshes = 0
@@ -472,8 +472,7 @@ RSpec.describe Auth::DefaultCurrentUserProvider do
end
end
- context "rate limiting" do
-
+ describe "rate limiting" do
before do
RateLimiter.enable
end
@@ -622,7 +621,7 @@ RSpec.describe Auth::DefaultCurrentUserProvider do
expect(user.staged).to eq(false)
end
- context "user api" do
+ describe "user api" do
fab! :user do
Fabricate(:user)
end
@@ -705,8 +704,7 @@ RSpec.describe Auth::DefaultCurrentUserProvider do
end
end
- context "rate limiting" do
-
+ context "with rate limiting" do
before do
RateLimiter.enable
end
diff --git a/spec/lib/auth/discord_authenticator_spec.rb b/spec/lib/auth/discord_authenticator_spec.rb
index ab925bedc7..cff7c662f4 100644
--- a/spec/lib/auth/discord_authenticator_spec.rb
+++ b/spec/lib/auth/discord_authenticator_spec.rb
@@ -29,7 +29,7 @@ RSpec.describe Auth::DiscordAuthenticator do
let(:authenticator) { described_class.new }
- context 'after_authenticate' do
+ describe 'after_authenticate' do
it 'works normally' do
result = authenticator.after_authenticate(hash)
expect(result.user).to eq(nil)
diff --git a/spec/lib/auth/facebook_authenticator_spec.rb b/spec/lib/auth/facebook_authenticator_spec.rb
index 8237d3a67d..4a39fe5c46 100644
--- a/spec/lib/auth/facebook_authenticator_spec.rb
+++ b/spec/lib/auth/facebook_authenticator_spec.rb
@@ -19,7 +19,7 @@ RSpec.describe Auth::FacebookAuthenticator do
let(:authenticator) { Auth::FacebookAuthenticator.new }
- context 'after_authenticate' do
+ describe 'after_authenticate' do
it 'can authenticate and create a user record for already existing users' do
user = Fabricate(:user)
result = authenticator.after_authenticate(hash.deep_merge(info: { email: user.email }))
@@ -46,7 +46,7 @@ RSpec.describe Auth::FacebookAuthenticator do
end
end
- context 'description_for_user' do
+ describe 'description_for_user' do
fab!(:user) { Fabricate(:user) }
it 'returns empty string if no entry for user' do
@@ -59,7 +59,7 @@ RSpec.describe Auth::FacebookAuthenticator do
end
end
- context 'revoke' do
+ describe 'revoke' do
fab!(:user) { Fabricate(:user) }
let(:authenticator) { Auth::FacebookAuthenticator.new }
@@ -82,5 +82,4 @@ RSpec.describe Auth::FacebookAuthenticator do
end
end
end
-
end
diff --git a/spec/lib/auth/github_authenticator_spec.rb b/spec/lib/auth/github_authenticator_spec.rb
index ce2dc26492..15020a9636 100644
--- a/spec/lib/auth/github_authenticator_spec.rb
+++ b/spec/lib/auth/github_authenticator_spec.rb
@@ -24,7 +24,7 @@ RSpec.describe Auth::GithubAuthenticator do
let(:authenticator) { described_class.new }
fab!(:user) { Fabricate(:user) }
- context 'after_authenticate' do
+ describe 'after_authenticate' do
let(:data) { auth_token_for(user) }
it 'can authenticate and create a user record for already existing users' do
@@ -247,10 +247,9 @@ RSpec.describe Auth::GithubAuthenticator do
expect(UserAssociatedAccount.exists?(user_id: user1.id)).to eq(false)
expect(UserAssociatedAccount.exists?(user_id: user2.id)).to eq(true)
end
-
end
- context 'revoke' do
+ describe 'revoke' do
fab!(:user) { Fabricate(:user) }
let(:authenticator) { Auth::GithubAuthenticator.new }
@@ -258,13 +257,12 @@ RSpec.describe Auth::GithubAuthenticator do
expect { authenticator.revoke(user) }.to raise_error(Discourse::NotFound)
end
- it 'revokes correctly' do
- UserAssociatedAccount.create!(provider_name: "github", user_id: user.id, provider_uid: 100, info: { nickname: "boris" })
- expect(authenticator.can_revoke?).to eq(true)
- expect(authenticator.revoke(user)).to eq(true)
- expect(authenticator.description_for_user(user)).to eq("")
- end
-
+ it 'revokes correctly' do
+ UserAssociatedAccount.create!(provider_name: "github", user_id: user.id, provider_uid: 100, info: { nickname: "boris" })
+ expect(authenticator.can_revoke?).to eq(true)
+ expect(authenticator.revoke(user)).to eq(true)
+ expect(authenticator.description_for_user(user)).to eq("")
+ end
end
describe 'avatar retrieval' do
diff --git a/spec/lib/auth/google_oauth2_authenticator_spec.rb b/spec/lib/auth/google_oauth2_authenticator_spec.rb
index e00b51d40c..661ef1f25c 100644
--- a/spec/lib/auth/google_oauth2_authenticator_spec.rb
+++ b/spec/lib/auth/google_oauth2_authenticator_spec.rb
@@ -29,7 +29,7 @@ RSpec.describe Auth::GoogleOAuth2Authenticator do
expect(result.user).to eq(nil)
end
- context 'after_authenticate' do
+ describe 'after_authenticate' do
it 'can authenticate and create a user record for already existing users' do
authenticator = Auth::GoogleOAuth2Authenticator.new
user = Fabricate(:user)
@@ -111,7 +111,7 @@ RSpec.describe Auth::GoogleOAuth2Authenticator do
expect(result.name).to eq("Jane Doe")
end
- context "provides groups" do
+ describe "provides groups" do
before do
SiteSetting.google_oauth2_hd = "domain.com"
group1 = OmniAuth::AuthHash.new(id: "12345", name: "group1")
@@ -137,7 +137,7 @@ RSpec.describe Auth::GoogleOAuth2Authenticator do
)
end
- context "enabled" do
+ context "when enabled" do
before do
SiteSetting.google_oauth2_hd_groups = true
end
@@ -154,7 +154,7 @@ RSpec.describe Auth::GoogleOAuth2Authenticator do
end
end
- context "disabled" do
+ context "when disabled" do
before do
SiteSetting.google_oauth2_hd_groups = false
end
@@ -167,7 +167,7 @@ RSpec.describe Auth::GoogleOAuth2Authenticator do
end
end
- context 'revoke' do
+ describe 'revoke' do
fab!(:user) { Fabricate(:user) }
let(:authenticator) { Auth::GoogleOAuth2Authenticator.new }
@@ -175,12 +175,11 @@ RSpec.describe Auth::GoogleOAuth2Authenticator do
expect { authenticator.revoke(user) }.to raise_error(Discourse::NotFound)
end
- it 'revokes correctly' do
- UserAssociatedAccount.create!(provider_name: "google_oauth2", user_id: user.id, provider_uid: 12345)
- expect(authenticator.can_revoke?).to eq(true)
- expect(authenticator.revoke(user)).to eq(true)
- expect(authenticator.description_for_user(user)).to eq("")
- end
-
+ it 'revokes correctly' do
+ UserAssociatedAccount.create!(provider_name: "google_oauth2", user_id: user.id, provider_uid: 12345)
+ expect(authenticator.can_revoke?).to eq(true)
+ expect(authenticator.revoke(user)).to eq(true)
+ expect(authenticator.description_for_user(user)).to eq("")
+ end
end
end
diff --git a/spec/lib/auth/omniauth_strategies/discourse_google_oauth2_spec.rb b/spec/lib/auth/omniauth_strategies/discourse_google_oauth2_spec.rb
index db4adc1c26..37229ecae4 100644
--- a/spec/lib/auth/omniauth_strategies/discourse_google_oauth2_spec.rb
+++ b/spec/lib/auth/omniauth_strategies/discourse_google_oauth2_spec.rb
@@ -85,12 +85,12 @@ RSpec.describe Auth::OmniAuthStrategies::DiscourseGoogleOauth2 do
OmniAuth.config.test_mode = false
end
- context 'request_groups is true' do
+ context 'when request_groups is true' do
before do
@options[:request_groups] = true
end
- context 'groups request successful' do
+ context 'when groups request successful' do
before do
@strategy = build_strategy(successful_groups_token)
end
@@ -100,7 +100,7 @@ RSpec.describe Auth::OmniAuthStrategies::DiscourseGoogleOauth2 do
end
end
- context 'groups request unsuccessful' do
+ context 'when groups request unsuccessful' do
before do
@strategy = build_strategy(unsuccessful_groups_token)
end
@@ -111,7 +111,7 @@ RSpec.describe Auth::OmniAuthStrategies::DiscourseGoogleOauth2 do
end
end
- context 'request_groups is not true' do
+ context 'when request_groups is not true' do
before do
@options[:request_groups] = false
@strategy = build_strategy(successful_groups_token)
diff --git a/spec/lib/auth/twitter_authenticator_spec.rb b/spec/lib/auth/twitter_authenticator_spec.rb
index 0e2863c3f4..14f5c834a6 100644
--- a/spec/lib/auth/twitter_authenticator_spec.rb
+++ b/spec/lib/auth/twitter_authenticator_spec.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true
RSpec.describe Auth::TwitterAuthenticator do
-
it "takes over account if email is supplied" do
auth = Auth::TwitterAuthenticator.new
@@ -51,7 +50,7 @@ RSpec.describe Auth::TwitterAuthenticator do
expect(UserAssociatedAccount.exists?(provider_name: "twitter", user_id: user2.id)).to eq(true)
end
- context 'revoke' do
+ describe 'revoke' do
fab!(:user) { Fabricate(:user) }
let(:authenticator) { Auth::TwitterAuthenticator.new }
@@ -65,7 +64,5 @@ RSpec.describe Auth::TwitterAuthenticator do
expect(authenticator.revoke(user)).to eq(true)
expect(authenticator.description_for_user(user)).to eq("")
end
-
end
-
end
diff --git a/spec/lib/backup_restore/backup_file_handler_multisite_spec.rb b/spec/lib/backup_restore/backup_file_handler_multisite_spec.rb
index c7d4417093..5a0b1f6de1 100644
--- a/spec/lib/backup_restore/backup_file_handler_multisite_spec.rb
+++ b/spec/lib/backup_restore/backup_file_handler_multisite_spec.rb
@@ -3,7 +3,7 @@
require_relative "shared_context_for_backup_restore"
RSpec.describe BackupRestore::BackupFileHandler, type: :multisite do
- include_context "shared stuff"
+ include_context "with shared stuff"
it "works with old backup file format" do
test_multisite_connection("second") do
diff --git a/spec/lib/backup_restore/backup_file_handler_spec.rb b/spec/lib/backup_restore/backup_file_handler_spec.rb
index 5b35a6c4ff..8803de7890 100644
--- a/spec/lib/backup_restore/backup_file_handler_spec.rb
+++ b/spec/lib/backup_restore/backup_file_handler_spec.rb
@@ -3,7 +3,7 @@
require_relative 'shared_context_for_backup_restore'
RSpec.describe BackupRestore::BackupFileHandler do
- include_context "shared stuff"
+ include_context "with shared stuff"
it "works with current backup file format" do
expect_decompress_and_clean_up_to_work(
diff --git a/spec/lib/backup_restore/database_restorer_multisite_spec.rb b/spec/lib/backup_restore/database_restorer_multisite_spec.rb
index ec3fc81954..19044c1f72 100644
--- a/spec/lib/backup_restore/database_restorer_multisite_spec.rb
+++ b/spec/lib/backup_restore/database_restorer_multisite_spec.rb
@@ -3,14 +3,14 @@
require_relative "shared_context_for_backup_restore"
RSpec.describe BackupRestore::DatabaseRestorer, type: :multisite do
- include_context "shared stuff"
+ include_context "with shared stuff"
let(:current_db) { RailsMultisite::ConnectionManagement.current_db }
subject { BackupRestore::DatabaseRestorer.new(logger, current_db) }
describe "#restore" do
- context "database connection" do
+ context "with database connection" do
it "reconnects to the correct database" do
RailsMultisite::ConnectionManagement.establish_connection(db: "second")
execute_stubbed_restore
diff --git a/spec/lib/backup_restore/database_restorer_spec.rb b/spec/lib/backup_restore/database_restorer_spec.rb
index 1f2de1a8ef..e8d69c0723 100644
--- a/spec/lib/backup_restore/database_restorer_spec.rb
+++ b/spec/lib/backup_restore/database_restorer_spec.rb
@@ -3,7 +3,7 @@
require_relative 'shared_context_for_backup_restore'
RSpec.describe BackupRestore::DatabaseRestorer do
- include_context "shared stuff"
+ include_context "with shared stuff"
let(:current_db) { RailsMultisite::ConnectionManagement.current_db }
@@ -79,7 +79,7 @@ RSpec.describe BackupRestore::DatabaseRestorer do
end
end
- context "rewrites database dump" do
+ describe "rewrites database dump" do
let(:logger) do
Class.new do
attr_reader :log_messages
@@ -124,7 +124,7 @@ RSpec.describe BackupRestore::DatabaseRestorer do
end
end
- context "database connection" do
+ describe "database connection" do
it 'it is not erroring for non-multisite' do
expect { execute_stubbed_restore }.not_to raise_error
end
@@ -144,7 +144,7 @@ RSpec.describe BackupRestore::DatabaseRestorer do
end
end
- context "readonly functions" do
+ describe "readonly functions" do
before do
BackupRestore::DatabaseRestorer.stubs(:core_migration_files).returns(
Dir[Rails.root.join("spec/fixtures/db/post_migrate/drop_column/**/*.rb")]
diff --git a/spec/lib/backup_restore/meta_data_handler_spec.rb b/spec/lib/backup_restore/meta_data_handler_spec.rb
index 6ea18c4837..9dd08f0e82 100644
--- a/spec/lib/backup_restore/meta_data_handler_spec.rb
+++ b/spec/lib/backup_restore/meta_data_handler_spec.rb
@@ -3,7 +3,7 @@
require_relative 'shared_context_for_backup_restore'
RSpec.describe BackupRestore::MetaDataHandler do
- include_context "shared stuff"
+ include_context "with shared stuff"
let!(:backup_filename) { 'discourse-2019-11-18-143242-v20191108000414.tar.gz' }
@@ -22,7 +22,7 @@ RSpec.describe BackupRestore::MetaDataHandler do
BackupRestore::MetaDataHandler.new(logger, filename, tmp_directory).validate
end
- context "metadata file" do
+ describe "metadata file" do
it "extracts metadata from file when metadata file exists" do
metadata = '{"source":"discourse","version":20160329101122}'
@@ -67,7 +67,7 @@ RSpec.describe BackupRestore::MetaDataHandler do
end
end
- context "filename" do
+ describe "filename" do
it "extracts metadata from filename when metadata file does not exist" do
with_metadata_file(nil) do |dir|
expect(validate_metadata(backup_filename, dir))
diff --git a/spec/lib/backup_restore/s3_backup_store_spec.rb b/spec/lib/backup_restore/s3_backup_store_spec.rb
index dbe62f6c46..4aad803cfd 100644
--- a/spec/lib/backup_restore/s3_backup_store_spec.rb
+++ b/spec/lib/backup_restore/s3_backup_store_spec.rb
@@ -77,7 +77,7 @@ RSpec.describe BackupRestore::S3BackupStore do
it_behaves_like "backup store"
it_behaves_like "remote backup store"
- context "S3 specific behavior" do
+ describe "S3 specific behavior" do
before { create_backups }
after { remove_backups }
diff --git a/spec/lib/backup_restore/shared_context_for_backup_restore.rb b/spec/lib/backup_restore/shared_context_for_backup_restore.rb
index 66047d1bc3..5ad59e604f 100644
--- a/spec/lib/backup_restore/shared_context_for_backup_restore.rb
+++ b/spec/lib/backup_restore/shared_context_for_backup_restore.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.shared_context "shared stuff" do
+RSpec.shared_context "with shared stuff" do
let!(:logger) do
Class.new do
def log(message, ex = nil); end
diff --git a/spec/lib/backup_restore/shared_examples_for_backup_store.rb b/spec/lib/backup_restore/shared_examples_for_backup_store.rb
index b65dadd9d8..eeb8ee2e05 100644
--- a/spec/lib/backup_restore/shared_examples_for_backup_store.rb
+++ b/spec/lib/backup_restore/shared_examples_for_backup_store.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# rubocop:disable Discourse/OnlyTopLevelMultisiteSpecs
-RSpec.shared_context "backups" do
+RSpec.shared_context "with backups" do
before { create_backups }
after { remove_backups }
@@ -46,7 +46,7 @@ RSpec.shared_examples "backup store" do
end
context "with backup files" do
- include_context "backups"
+ include_context "with backups"
describe "#files" do
it "sorts files by last modified date in descending order" do
@@ -214,7 +214,7 @@ RSpec.shared_examples "remote backup store" do
end
context "with backups" do
- include_context "backups"
+ include_context "with backups"
describe "#upload_file" do
def upload_file
diff --git a/spec/lib/backup_restore/system_interface_multisite_spec.rb b/spec/lib/backup_restore/system_interface_multisite_spec.rb
index 6587a71669..e9d93e6e3f 100644
--- a/spec/lib/backup_restore/system_interface_multisite_spec.rb
+++ b/spec/lib/backup_restore/system_interface_multisite_spec.rb
@@ -3,7 +3,7 @@
require_relative "shared_context_for_backup_restore"
RSpec.describe BackupRestore::SystemInterface, type: :multisite do
- include_context "shared stuff"
+ include_context "with shared stuff"
subject { BackupRestore::SystemInterface.new(logger) }
diff --git a/spec/lib/backup_restore/system_interface_spec.rb b/spec/lib/backup_restore/system_interface_spec.rb
index 8c5c295c2f..20a701d8d3 100644
--- a/spec/lib/backup_restore/system_interface_spec.rb
+++ b/spec/lib/backup_restore/system_interface_spec.rb
@@ -3,11 +3,11 @@
require_relative 'shared_context_for_backup_restore'
RSpec.describe BackupRestore::SystemInterface do
- include_context "shared stuff"
+ include_context "with shared stuff"
subject { BackupRestore::SystemInterface.new(logger) }
- context "readonly mode" do
+ describe "readonly mode" do
after do
Discourse::READONLY_KEYS.each { |key| Discourse.redis.del(key) }
end
@@ -171,7 +171,7 @@ RSpec.describe BackupRestore::SystemInterface do
end
describe "#flush_redis" do
- context "Sidekiq" do
+ context "with Sidekiq" do
after { Sidekiq.unpause! }
it "doesn't unpause Sidekiq" do
diff --git a/spec/lib/backup_restore/uploads_restorer_spec.rb b/spec/lib/backup_restore/uploads_restorer_spec.rb
index 0b55fbeeba..3314358e9e 100644
--- a/spec/lib/backup_restore/uploads_restorer_spec.rb
+++ b/spec/lib/backup_restore/uploads_restorer_spec.rb
@@ -4,7 +4,7 @@
require_relative 'shared_context_for_backup_restore'
RSpec.describe BackupRestore::UploadsRestorer do
- include_context "shared stuff"
+ include_context "with shared stuff"
subject { BackupRestore::UploadsRestorer.new(logger) }
@@ -94,7 +94,7 @@ RSpec.describe BackupRestore::UploadsRestorer do
Regexp.escape("//#{bucket}") + %q*\.s3(?:\.dualstack\.[a-z0-9\-]+?|[.\-][a-z0-9\-]+?)?\.amazonaws\.com* + Regexp.escape(path)
end
- context "uploads" do
+ describe "uploads" do
let!(:multisite) { { name: "multisite", value: true } }
let!(:no_multisite) { { name: "multisite", value: false } }
let!(:source_db_name) { { name: "db_name", value: "foo" } }
@@ -104,7 +104,7 @@ RSpec.describe BackupRestore::UploadsRestorer do
let(:target_site_name) { target_site_type == multisite ? "second" : "default" }
let(:target_hostname) { target_site_type == multisite ? "test2.localhost" : "test.localhost" }
- shared_context "no uploads" do
+ shared_context "with no uploads" do
it "does nothing when temporary uploads directory is missing or empty" do
store_class.any_instance.expects(:copy_from).never
@@ -132,7 +132,7 @@ RSpec.describe BackupRestore::UploadsRestorer do
end
end
- shared_context "restores uploads" do
+ shared_context "when restoring uploads" do
before do
Upload.where("id > 0").destroy_all
Fabricate(:optimized_image)
@@ -242,34 +242,34 @@ RSpec.describe BackupRestore::UploadsRestorer do
end
end
- context "currently stored locally" do
+ context "when currently stored locally" do
before do
SiteSetting.enable_s3_uploads = false
end
let!(:store_class) { FileStore::LocalStore }
- include_context "no uploads"
- include_context "restores uploads"
+ include_context "with no uploads"
+ include_context "when restoring uploads"
- context "remaps" do
+ context "with remaps" do
include_examples "without metadata"
- context "uploads previously stored locally" do
+ context "when uploads previously stored locally" do
let!(:s3_base_url) { { name: "s3_base_url", value: nil } }
let!(:s3_cdn_url) { { name: "s3_cdn_url", value: nil } }
- context "from regular site" do
+ context "with regular site as source" do
let!(:source_site_type) { no_multisite }
- context "to regular site" do
+ context "with regular site as target" do
let!(:target_site_type) { no_multisite }
include_examples "common remaps"
include_examples "remaps from local storage"
end
- context "to multisite", type: :multisite do
+ context "with multisite as target", type: :multisite do
let!(:target_site_type) { multisite }
include_examples "common remaps"
@@ -277,17 +277,17 @@ RSpec.describe BackupRestore::UploadsRestorer do
end
end
- context "from multisite" do
+ context "with multisite as source" do
let!(:source_site_type) { multisite }
- context "to regular site" do
+ context "with regular site as target" do
let!(:target_site_type) { no_multisite }
include_examples "common remaps"
include_examples "remaps from local storage"
end
- context "to multisite", type: :multisite do
+ context "with multisite as target", type: :multisite do
let!(:target_site_type) { multisite }
include_examples "common remaps"
@@ -296,7 +296,7 @@ RSpec.describe BackupRestore::UploadsRestorer do
end
end
- context "uploads previously stored on S3" do
+ context "with uploads previously stored on S3" do
let!(:s3_base_url) { { name: "s3_base_url", value: "//old-bucket.s3-us-east-1.amazonaws.com" } }
let!(:s3_cdn_url) { { name: "s3_cdn_url", value: "https://s3-cdn.example.com" } }
@@ -346,17 +346,17 @@ RSpec.describe BackupRestore::UploadsRestorer do
end
end
- context "from regular site" do
+ context "with regular site as source" do
let!(:source_site_type) { no_multisite }
- context "to regular site" do
+ context "with regular site as target" do
let!(:target_site_type) { no_multisite }
include_examples "common remaps"
include_examples "regular site remaps from S3"
end
- context "to multisite", type: :multisite do
+ context "with multisite as target", type: :multisite do
let!(:target_site_type) { multisite }
include_examples "common remaps"
@@ -364,17 +364,17 @@ RSpec.describe BackupRestore::UploadsRestorer do
end
end
- context "from multisite" do
+ context "with multisite as source" do
let!(:source_site_type) { multisite }
- context "to regular site" do
+ context "with regular site as target" do
let!(:target_site_type) { no_multisite }
include_examples "common remaps"
include_examples "multisite remaps from S3"
end
- context "to multisite", type: :multisite do
+ context "with multisite as target", type: :multisite do
let!(:target_site_type) { no_multisite }
include_examples "common remaps"
@@ -385,34 +385,34 @@ RSpec.describe BackupRestore::UploadsRestorer do
end
end
- context "currently stored on S3" do
+ context "when currently stored on S3" do
before do
setup_s3
end
let!(:store_class) { FileStore::S3Store }
- include_context "no uploads"
- include_context "restores uploads"
+ include_context "with no uploads"
+ include_context "when restoring uploads"
- context "remaps" do
+ context "with remaps" do
include_examples "without metadata"
- context "uploads previously stored locally" do
+ context "with uploads previously stored locally" do
let!(:s3_base_url) { { name: "s3_base_url", value: nil } }
let!(:s3_cdn_url) { { name: "s3_cdn_url", value: nil } }
- context "from regular site" do
+ context "with regular site as source" do
let!(:source_site_type) { no_multisite }
- context "to regular site" do
+ context "with regular site as target" do
let!(:target_site_type) { no_multisite }
include_examples "common remaps"
include_examples "remaps from local storage"
end
- context "to multisite", type: :multisite do
+ context "with multisite as target", type: :multisite do
let!(:target_site_type) { no_multisite }
include_examples "common remaps"
@@ -420,17 +420,17 @@ RSpec.describe BackupRestore::UploadsRestorer do
end
end
- context "from multisite" do
+ context "with multisite as source" do
let!(:source_site_type) { multisite }
- context "to regular site" do
+ context "with regular site as target" do
let!(:target_site_type) { no_multisite }
include_examples "common remaps"
include_examples "remaps from local storage"
end
- context "to multisite", type: :multisite do
+ context "with multisite as target", type: :multisite do
let!(:target_site_type) { multisite }
include_examples "common remaps"
@@ -439,7 +439,7 @@ RSpec.describe BackupRestore::UploadsRestorer do
end
end
- context "uploads previously stored on S3" do
+ context "with uploads previously stored on S3" do
let!(:s3_base_url) { { name: "s3_base_url", value: "//old-bucket.s3-us-east-1.amazonaws.com" } }
let!(:s3_cdn_url) { { name: "s3_cdn_url", value: "https://s3-cdn.example.com" } }
@@ -510,10 +510,10 @@ RSpec.describe BackupRestore::UploadsRestorer do
end
end
- context "from regular site" do
+ context "with regular site as source" do
let!(:source_site_type) { no_multisite }
- context "to regular site" do
+ context "with regular site as target" do
let!(:target_site_name) { "default" }
let!(:target_hostname) { "test.localhost" }
@@ -521,7 +521,7 @@ RSpec.describe BackupRestore::UploadsRestorer do
include_examples "regular site remaps from S3"
end
- context "to multisite", type: :multisite do
+ context "with multisite as target", type: :multisite do
let!(:target_site_name) { "second" }
let!(:target_hostname) { "test2.localhost" }
@@ -530,17 +530,17 @@ RSpec.describe BackupRestore::UploadsRestorer do
end
end
- context "from multisite" do
+ context "with multisite as source" do
let!(:source_site_type) { multisite }
- context "to regular site" do
+ context "with regular site as target" do
let!(:target_site_type) { no_multisite }
include_examples "common remaps"
include_examples "multisite remaps from S3"
end
- context "to multisite", type: :multisite do
+ context "with multisite as target", type: :multisite do
let!(:target_site_type) { multisite }
include_examples "common remaps"
diff --git a/spec/lib/common_passwords/common_passwords_spec.rb b/spec/lib/common_passwords/common_passwords_spec.rb
index 8d3ebf2499..fba5e6804f 100644
--- a/spec/lib/common_passwords/common_passwords_spec.rb
+++ b/spec/lib/common_passwords/common_passwords_spec.rb
@@ -61,7 +61,7 @@ RSpec.describe CommonPasswords do
end
end
- context "missing password file" do
+ describe "missing password file" do
it "tolerates it" do
File.stubs(:readlines).with(described_class::PASSWORD_FILE).raises(Errno::ENOENT)
expect(described_class.common_password?("password")).to eq(false)
diff --git a/spec/lib/composer_messages_finder_spec.rb b/spec/lib/composer_messages_finder_spec.rb
index e52ff3e73f..e6bbac2144 100644
--- a/spec/lib/composer_messages_finder_spec.rb
+++ b/spec/lib/composer_messages_finder_spec.rb
@@ -4,8 +4,7 @@
require 'composer_messages_finder'
RSpec.describe ComposerMessagesFinder do
-
- context "delegates work" do
+ describe "delegates work" do
let(:user) { Fabricate.build(:user) }
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'createTopic') }
@@ -19,13 +18,12 @@ RSpec.describe ComposerMessagesFinder do
finder.expects(:check_get_a_room).once
finder.find
end
-
end
describe '.check_education_message' do
let(:user) { Fabricate.build(:user) }
- context 'creating topic' do
+ context 'when creating topic' do
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'createTopic') }
before do
@@ -43,10 +41,10 @@ RSpec.describe ComposerMessagesFinder do
end
end
- context 'private message' do
+ context 'with private message' do
fab!(:topic) { Fabricate(:private_message_topic) }
- context 'starting a new private message' do
+ context 'when starting a new private message' do
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'createTopic', topic_id: topic.id) }
it 'should return an empty string' do
@@ -54,7 +52,7 @@ RSpec.describe ComposerMessagesFinder do
end
end
- context 'replying to a private message' do
+ context 'when replying to a private message' do
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'reply', topic_id: topic.id) }
it 'should return an empty string' do
@@ -63,7 +61,7 @@ RSpec.describe ComposerMessagesFinder do
end
end
- context 'creating reply' do
+ context 'when creating reply' do
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'reply') }
before do
@@ -85,7 +83,7 @@ RSpec.describe ComposerMessagesFinder do
describe '.check_new_user_many_replies' do
let(:user) { Fabricate.build(:user) }
- context 'replying' do
+ context 'when replying' do
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'reply') }
it "has no message when `posted_too_much_in_topic?` is false" do
@@ -105,7 +103,7 @@ RSpec.describe ComposerMessagesFinder do
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'createTopic') }
fab!(:user) { Fabricate(:user) }
- context "success" do
+ context "with success" do
let!(:message) { finder.check_avatar_notification }
it "returns an avatar upgrade message" do
@@ -174,7 +172,7 @@ RSpec.describe ComposerMessagesFinder do
expect(ComposerMessagesFinder.new(user, composer_action: 'reply').check_sequential_replies).to be_blank
end
- context "reply" do
+ context "with reply" do
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'reply', topic_id: topic.id) }
it "does not give a message to users who are still in the 'education' phase" do
@@ -207,7 +205,7 @@ RSpec.describe ComposerMessagesFinder do
expect(finder.check_sequential_replies).to be_blank
end
- context "success" do
+ context "with success" do
let!(:message) { finder.check_sequential_replies }
it "returns a message" do
@@ -249,7 +247,7 @@ RSpec.describe ComposerMessagesFinder do
expect(ComposerMessagesFinder.new(user, composer_action: 'reply').check_dominating_topic).to be_blank
end
- context "reply" do
+ context "with reply" do
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'reply', topic_id: topic.id) }
it "does not give a message to users who are still in the 'education' phase" do
@@ -292,7 +290,7 @@ RSpec.describe ComposerMessagesFinder do
expect(finder.check_dominating_topic).to be_blank
end
- context "success" do
+ context "with success" do
let!(:message) { finder.check_dominating_topic }
it "returns a message" do
@@ -349,7 +347,7 @@ RSpec.describe ComposerMessagesFinder do
expect(UserHistory.exists_for_user?(user, :notified_about_get_a_room)).to eq(false)
end
- context "reply" do
+ context "with reply" do
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'reply', topic_id: topic.id, post_id: op.id) }
it "does not give a message to users who are still in the 'education' phase" do
@@ -415,7 +413,7 @@ RSpec.describe ComposerMessagesFinder do
end
end
- context "success" do
+ context "with success" do
let!(:message) { finder.check_get_a_room(min_users_posted: 2) }
it "works as expected" do
@@ -440,8 +438,8 @@ RSpec.describe ComposerMessagesFinder do
expect(described_class.new(user, composer_action: 'reply').check_reviving_old_topic).to be_blank
end
- context "a reply" do
- context "warn_reviving_old_topic_age is 180 days" do
+ context "with a reply" do
+ context "when warn_reviving_old_topic_age is 180 days" do
before do
SiteSetting.warn_reviving_old_topic_age = 180
end
@@ -459,7 +457,7 @@ RSpec.describe ComposerMessagesFinder do
end
end
- context "warn_reviving_old_topic_age is 0" do
+ context "when warn_reviving_old_topic_age is 0" do
before do
SiteSetting.warn_reviving_old_topic_age = 0
end
@@ -503,5 +501,4 @@ RSpec.describe ComposerMessagesFinder do
expect(edit_post_finder.find).to eq(nil)
end
end
-
end
diff --git a/spec/lib/compression/engine_spec.rb b/spec/lib/compression/engine_spec.rb
index 913c5da072..6e96e5a226 100644
--- a/spec/lib/compression/engine_spec.rb
+++ b/spec/lib/compression/engine_spec.rb
@@ -30,7 +30,7 @@ RSpec.describe Compression::Engine do
end
end
- context 'working with zip files' do
+ context 'when working with zip files' do
let(:extension) { '.zip' }
it 'decompress the folder and inspect files correctly' do
@@ -43,7 +43,7 @@ RSpec.describe Compression::Engine do
end
end
- context 'working with .tar.gz files' do
+ context 'when working with .tar.gz files' do
let(:extension) { '.tar.gz' }
it 'decompress the folder and inspect files correctly' do
@@ -56,7 +56,7 @@ RSpec.describe Compression::Engine do
end
end
- context 'working with .tar files' do
+ context 'when working with .tar files' do
let(:extension) { '.tar' }
it 'decompress the folder and inspect files correctly' do
diff --git a/spec/lib/concern/cached_counting_spec.rb b/spec/lib/concern/cached_counting_spec.rb
index 44976a3737..260744902d 100644
--- a/spec/lib/concern/cached_counting_spec.rb
+++ b/spec/lib/concern/cached_counting_spec.rb
@@ -15,13 +15,11 @@ class TestCachedCounting
end
RSpec.describe CachedCounting do
-
it "should be default disabled in test" do
expect(CachedCounting.enabled?).to eq(false)
end
- context "backing implementation" do
-
+ describe "backing implementation" do
it "can correctly check for flush to db lock" do
CachedCounting.clear_flush_to_db_lock!
@@ -55,7 +53,7 @@ RSpec.describe CachedCounting do
end
end
- context "active record" do
+ describe "active record" do
class RailsCacheCounter < ActiveRecord::Base
include CachedCounting
self.table_name = "posts"
diff --git a/spec/lib/concern/category_hashtag_spec.rb b/spec/lib/concern/category_hashtag_spec.rb
index 94bcb3f7d0..57d687beb2 100644
--- a/spec/lib/concern/category_hashtag_spec.rb
+++ b/spec/lib/concern/category_hashtag_spec.rb
@@ -27,7 +27,7 @@ RSpec.describe CategoryHashtag do
expect(Category.query_from_hashtag_slug("non-existent#{CategoryHashtag::SEPARATOR}#{parent_category.slug}")).to eq(nil)
end
- context "multi-level categories" do
+ context "with multi-level categories" do
before do
SiteSetting.max_category_nesting = 3
end
diff --git a/spec/lib/concern/has_custom_fields_spec.rb b/spec/lib/concern/has_custom_fields_spec.rb
index 698d82604c..af0bbaebd8 100644
--- a/spec/lib/concern/has_custom_fields_spec.rb
+++ b/spec/lib/concern/has_custom_fields_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
RSpec.describe HasCustomFields do
- context "custom_fields" do
+ describe "custom_fields" do
before do
DB.exec("create temporary table custom_fields_test_items(id SERIAL primary key)")
DB.exec("create temporary table custom_fields_test_item_custom_fields(id SERIAL primary key, custom_fields_test_item_id int, name varchar(256) not null, value text, created_at TIMESTAMP, updated_at TIMESTAMP)")
diff --git a/spec/lib/concern/has_search_data_spec.rb b/spec/lib/concern/has_search_data_spec.rb
index e0a0583af1..74f4fbb66d 100644
--- a/spec/lib/concern/has_search_data_spec.rb
+++ b/spec/lib/concern/has_search_data_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
RSpec.describe HasSearchData do
- context "belongs to its model" do
+ describe "belongs to its model" do
before do
DB.exec("create temporary table model_items(id SERIAL primary key)")
DB.exec("create temporary table model_item_search_data(model_item_id int primary key, search_data tsvector, raw_data text, locale text)")
diff --git a/spec/lib/concern/positionable_spec.rb b/spec/lib/concern/positionable_spec.rb
index b491ab1090..f4a5746386 100644
--- a/spec/lib/concern/positionable_spec.rb
+++ b/spec/lib/concern/positionable_spec.rb
@@ -1,12 +1,11 @@
# frozen_string_literal: true
RSpec.describe Positionable do
-
def positions
TestItem.order('position asc, id asc').pluck(:id)
end
- context "move_to" do
+ describe "move_to" do
before do
class TestItem < ActiveRecord::Base
include Positionable
diff --git a/spec/lib/concern/searchable_spec.rb b/spec/lib/concern/searchable_spec.rb
index 75e3cafa08..b92b0eb4af 100644
--- a/spec/lib/concern/searchable_spec.rb
+++ b/spec/lib/concern/searchable_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
RSpec.describe Searchable do
- context "has search data" do
+ describe "has search data" do
before do
DB.exec("create temporary table searchable_records(id SERIAL primary key)")
DB.exec("create temporary table searchable_record_search_data(searchable_record_id int primary key, search_data tsvector, raw_data text, locale text)")
diff --git a/spec/lib/concern/second_factor_manager_spec.rb b/spec/lib/concern/second_factor_manager_spec.rb
index 1f0dd30cd8..a30b726e73 100644
--- a/spec/lib/concern/second_factor_manager_spec.rb
+++ b/spec/lib/concern/second_factor_manager_spec.rb
@@ -409,7 +409,7 @@ RSpec.describe SecondFactorManager do
end
end
- context 'backup codes' do
+ describe 'backup codes' do
describe '#generate_backup_codes' do
it 'should generate and store 10 backup codes' do
backup_codes = user.generate_backup_codes
diff --git a/spec/lib/cooked_post_processor_spec.rb b/spec/lib/cooked_post_processor_spec.rb
index 2dc678159c..4c633b5a54 100644
--- a/spec/lib/cooked_post_processor_spec.rb
+++ b/spec/lib/cooked_post_processor_spec.rb
@@ -249,12 +249,12 @@ RSpec.describe CookedPostProcessor do
end
end
- context "processing images" do
+ context "when processing images" do
before do
SiteSetting.responsive_post_image_sizes = ""
end
- context "responsive images" do
+ context "with responsive images" do
before { SiteSetting.responsive_post_image_sizes = "1|1.5|3" }
it "includes responsive images on demand" do
@@ -361,7 +361,7 @@ RSpec.describe CookedPostProcessor do
cpp.post_process
end
- context "valid" do
+ context "when valid" do
let(:image_sizes) { { "http://foo.bar/image.png" => { "width" => 111, "height" => 222 } } }
it "uses them" do
@@ -371,17 +371,17 @@ RSpec.describe CookedPostProcessor do
end
end
- context "invalid width" do
+ context "with invalid width" do
let(:image_sizes) { { "http://foo.bar/image.png" => { "width" => 0, "height" => 222 } } }
include_examples "leave dimensions alone"
end
- context "invalid height" do
+ context "with invalid height" do
let(:image_sizes) { { "http://foo.bar/image.png" => { "width" => 111, "height" => 0 } } }
include_examples "leave dimensions alone"
end
- context "invalid width & height" do
+ context "with invalid width & height" do
let(:image_sizes) { { "http://foo.bar/image.png" => { "width" => 0, "height" => 0 } } }
include_examples "leave dimensions alone"
end
@@ -433,7 +433,7 @@ RSpec.describe CookedPostProcessor do
expect(cpp).to be_dirty
end
- describe 'when image is inside onebox' do
+ context 'when image is inside onebox' do
let(:url) { 'https://image.com/my-avatar' }
let(:post) { Fabricate(:post, raw: url) }
@@ -452,7 +452,7 @@ RSpec.describe CookedPostProcessor do
end
end
- describe 'when image is an svg' do
+ context 'when image is an svg' do
fab!(:post) do
Fabricate(:post, raw: "
")
end
@@ -467,7 +467,7 @@ RSpec.describe CookedPostProcessor do
HTML
end
- describe 'when image src is an URL' do
+ context 'when image src is an URL' do
let(:post) do
Fabricate(:post, raw: "
")
end
@@ -482,7 +482,7 @@ RSpec.describe CookedPostProcessor do
end
end
- context "s3_uploads" do
+ context "with s3_uploads" do
let(:upload) { Fabricate(:secure_upload_s3) }
before do
@@ -746,7 +746,7 @@ RSpec.describe CookedPostProcessor do
end
- context "topic image" do
+ context "with topic image" do
fab!(:post) { Fabricate(:post_with_uploaded_image) }
let(:cpp) { CookedPostProcessor.new(post) }
@@ -822,7 +822,7 @@ RSpec.describe CookedPostProcessor do
expect(post.reload.image_upload_id).to eq(upload2.id)
end
- context "post image" do
+ context "with post image" do
let(:reply) { Fabricate(:post_with_uploaded_image, post_number: 2) }
let(:cpp) { CookedPostProcessor.new(reply) }
@@ -838,18 +838,15 @@ RSpec.describe CookedPostProcessor do
end
describe "#extract_images" do
-
let(:post) { build(:post_with_plenty_of_images) }
let(:cpp) { CookedPostProcessor.new(post) }
it "does not extract emojis or images inside oneboxes or quotes" do
expect(cpp.extract_images.length).to eq(0)
end
-
end
describe "#get_size_from_attributes" do
-
let(:post) { build(:post) }
let(:cpp) { CookedPostProcessor.new(post) }
@@ -879,11 +876,9 @@ RSpec.describe CookedPostProcessor do
img = { 'src' => nil, 'height' => 100 }
expect(cpp.get_size_from_attributes(img)).to be_nil
end
-
end
describe "#get_size_from_image_sizes" do
-
let(:post) { build(:post) }
let(:cpp) { CookedPostProcessor.new(post) }
@@ -891,11 +886,9 @@ RSpec.describe CookedPostProcessor do
image_sizes = { "http://my.discourse.org/image.png" => { "width" => 111, "height" => 222 } }
expect(cpp.get_size_from_image_sizes("/image.png", image_sizes)).to eq([111, 222])
end
-
end
describe "#get_size" do
-
let(:post) { build(:post) }
let(:cpp) { CookedPostProcessor.new(post) }
@@ -917,7 +910,6 @@ RSpec.describe CookedPostProcessor do
end
describe "#is_valid_image_url?" do
-
let(:post) { build(:post) }
let(:cpp) { CookedPostProcessor.new(post) }
@@ -936,11 +928,9 @@ RSpec.describe CookedPostProcessor do
it "doesn't throw an exception with a bad URI" do
expect(cpp.is_valid_image_url?("http://do