A platform for community discussion. Free, open, simple.
DEV: Bump rubocop-discourse to 3.20.0 (#43365)
Alan Guo Xiang Tan14f29ac2106c
diff --git a/Gemfile.lock b/Gemfile.lockindex 12a3195f972..b2a2107368a 100644--- a/Gemfile.lock+++ b/Gemfile.lock@@ -637,7 +637,7 @@ GEMrubocop-capybara (3.0.0)lint_roller (~> 1.1)rubocop (~> 1.81)- rubocop-discourse (3.19.0)+ rubocop-discourse (3.20.0)activesupport (>= 6.1)lint_roller (>= 1.1.0)rubocop-capybara (>= 2.23.0)@@ -1248,7 +1248,7 @@ CHECKSUMSrubocop (1.90.0) sha256=9eb4c065b5c5154e4ef554c547972f3905a9eb6b53e657e580b6796b54bf8242rubocop-ast (1.50.0) sha256=b9ca88300da0803ee222ad20cdb30494c0a784eed06fdc35d254b06d662788dbrubocop-capybara (3.0.0) sha256=7a64655238acda7f8f3c87e37ac825a64c615a79c17c253f1a28270dc3768c4b- rubocop-discourse (3.19.0) sha256=8c441eae02dceb1962e2860b92eec1213f4ab8f3defeda2b89b1f2efaf121a31+ rubocop-discourse (3.20.0) sha256=47086bcf9b937e469398e82615fc4a6b86bd40df73bf85611a9109a83a1e9c70rubocop-discourse-base (1.0.0) sha256=a4121f0f2a8e32c3259fee22106af9fd35372cbeac14b0c69673bdee79b472b7rubocop-factory_bot (2.28.0) sha256=4b17fc02124444173317e131759d195b0d762844a71a29fe8139c1105d92f0cbrubocop-rails (2.37.0) sha256=6e1645add5060e0328f8ddda0d820f55697c591394398bf14bb9dccb62f14b7ediff --git a/migrations/core/spec/lib/database/prepared_statement_cache_spec.rb b/migrations/core/spec/lib/database/prepared_statement_cache_spec.rbindex 96454f8e33b..0698013a957 100644--- a/migrations/core/spec/lib/database/prepared_statement_cache_spec.rb+++ b/migrations/core/spec/lib/database/prepared_statement_cache_spec.rb@@ -9,7 +9,7 @@ RSpec.describe Migrations::Database::PreparedStatementCache doinstance_double(Extralite::Query, close: nil)end- it "should inherit behavior from LruRedux::Cache" do+ it "inherits behavior from LruRedux::Cache" doexpect(described_class).to be < LruRedux::Cacheenddiff --git a/plugins/automation/spec/requests/discourse_automation_automations_spec.rb b/plugins/automation/spec/requests/discourse_automation_automations_spec.rbindex 4d3eaeb5f85..208d28b0a84 100644--- a/plugins/automation/spec/requests/discourse_automation_automations_spec.rb+++ b/plugins/automation/spec/requests/discourse_automation_automations_spec.rb@@ -56,7 +56,7 @@ describe DiscourseAutomation::AdminAutomationsController dolet(:admin) { Fabricate(:admin) }let(:api_key) { Fabricate(:api_key, user: admin) }- it "works" do+ it "enqueues the automation trigger with an admin API key" dopost "/automations/#{automation.id}/trigger.json",params: {context: {diff --git a/plugins/automation/spec/scripts/add_user_to_group_through_custom_field_spec.rb b/plugins/automation/spec/scripts/add_user_to_group_through_custom_field_spec.rbindex c748d596875..d7341b28edd 100644--- a/plugins/automation/spec/scripts/add_user_to_group_through_custom_field_spec.rb+++ b/plugins/automation/spec/scripts/add_user_to_group_through_custom_field_spec.rb@@ -20,7 +20,7 @@ describe "AddUserToGroupThroughCustomField" doendcontext "with no matching user custom fields" do- it "works" do+ it "leaves both users outside the target group" doexpect(user_1.in_any_groups?([target_group.id])).to eq(false)expect(user_2.in_any_groups?([target_group.id])).to eq(false)@@ -40,7 +40,7 @@ describe "AddUserToGroupThroughCustomField" do)end- it "works" do+ it "adds only the matching user to the target group" doexpect(user_1.in_any_groups?([target_group.id])).to eq(false)expect(user_2.in_any_groups?([target_group.id])).to eq(false)@@ -70,7 +70,7 @@ describe "AddUserToGroupThroughCustomField" docontext "when group is already present" dobefore { target_group.add(user_1) }- it "works" do+ it "preserves existing group membership" doexpect(user_1.in_any_groups?([target_group.id])).to eq(true)expect(user_2.in_any_groups?([target_group.id])).to eq(false)diff --git a/plugins/automation/spec/scripts/auto_responder_spec.rb b/plugins/automation/spec/scripts/auto_responder_spec.rbindex 1718fb117e8..2a6ca518085 100644--- a/plugins/automation/spec/scripts/auto_responder_spec.rb+++ b/plugins/automation/spec/scripts/auto_responder_spec.rb@@ -160,7 +160,7 @@ describe "AutoResponder" doendend- context "when post contains two keywords" do+ context "when post contains two keywords with different letter casing" doit "creates an answer with both answers" dopost = create_post(topic: topic, raw: "this is a post with FOO and bar")automation.trigger!("post" => post)@@ -169,7 +169,7 @@ describe "AutoResponder" doendend- context "when post doesn’t contain a keyword" do+ context "when post contains no keyword" doit "doesn’t create an answer" dopost = create_post(topic: topic, raw: "this is a post with no keyword")@@ -186,7 +186,7 @@ describe "AutoResponder" doendend- context "when post doesn’t contain a keyword" do+ context "when post only contains a keyword as part of another word" doit "doesn’t create an answer" dopost = create_post(topic: topic, raw: "this is a post bfoo with no keyword fooa")diff --git a/plugins/automation/spec/scripts/auto_tag_topic_spec.rb b/plugins/automation/spec/scripts/auto_tag_topic_spec.rbindex d1330db26cd..91a842c6cae 100644--- a/plugins/automation/spec/scripts/auto_tag_topic_spec.rb+++ b/plugins/automation/spec/scripts/auto_tag_topic_spec.rb@@ -21,7 +21,7 @@ describe "AutoTagTopic" docontext "when there are tags" dobefore { automation.upsert_field!("tags", "tags", { value: %w[tag1 tag2] }) }- it "works" do+ it "adds the configured tags" dopost = create_post(topic: topic)automation.trigger!("post" => post)@@ -46,7 +46,7 @@ describe "AutoTagTopic" doFabricate(:tag_group, permissions: { "staff" => 1 }, tag_names: ["restricted"])end- it "works" do+ it "adds a restricted tag" dopost = create_post(topic: topic)automation.trigger!("post" => post)expect(topic.reload.tags.pluck(:name).sort).to match_array(["restricted"])@@ -60,7 +60,7 @@ describe "AutoTagTopic" doCategoryTag.create!(category: restricted_category, tag: restricted_tag)end- it "works" do+ it "adds a tag restricted to the topic category" dotopic.update!(category: restricted_category)post = create_post(topic: topic)automation.trigger!("post" => post)@@ -95,7 +95,7 @@ describe "AutoTagTopic" do)end- it "works" do+ it "adds the configured tags after an automatic closure" doautomation.trigger!("topic" => topic, "status" => :automatically)expect(topic.reload.tags.pluck(:name)).to match_array(%w[tag1 tag2])diff --git a/plugins/automation/spec/scripts/close_topic_spec.rb b/plugins/automation/spec/scripts/close_topic_spec.rbindex 543508a2331..688d1b4667a 100644--- a/plugins/automation/spec/scripts/close_topic_spec.rb+++ b/plugins/automation/spec/scripts/close_topic_spec.rb@@ -9,7 +9,7 @@ describe "CloseTopic" dobefore { automation.upsert_field!("topic", "text", { value: topic.id }, target: "script") }context "with default params" do- it "works" do+ it "closes the topic with an empty closing post" doexpect(topic.closed).to be_falseyautomation.trigger!@@ -32,7 +32,7 @@ describe "CloseTopic" do)end- it "works" do+ it "closes the topic with the configured message" doexpect(topic.closed).to be_falseyautomation.trigger!diff --git a/plugins/automation/spec/scripts/pin_topic_spec.rb b/plugins/automation/spec/scripts/pin_topic_spec.rbindex ee96c464026..3716d605dd0 100644--- a/plugins/automation/spec/scripts/pin_topic_spec.rb+++ b/plugins/automation/spec/scripts/pin_topic_spec.rb@@ -11,7 +11,7 @@ describe "PinTopic" doendcontext "when not pinned globally" do- it "works" do+ it "pins the topic locally" doexpect(topic.pinned_at).to be_nilautomation.trigger!@@ -26,7 +26,7 @@ describe "PinTopic" docontext "when pinned globally" dobefore { automation.upsert_field!("pinned_globally", "boolean", { value: true }) }- it "works" do+ it "pins the topic globally" doexpect(topic.pinned_at).to be_nilautomation.trigger!@@ -44,7 +44,7 @@ describe "PinTopic" doautomation.upsert_field!("pinned_until", "date_time", { value: 10.days.from_now })end- it "works" do+ it "schedules the topic to be unpinned" doexpect(topic.pinned_at).to be_nilautomation.trigger!diff --git a/plugins/automation/spec/scripts/topic_required_words_spec.rb b/plugins/automation/spec/scripts/topic_required_words_spec.rbindex 8e9703415f3..9876445c09a 100644--- a/plugins/automation/spec/scripts/topic_required_words_spec.rb+++ b/plugins/automation/spec/scripts/topic_required_words_spec.rb@@ -60,7 +60,7 @@ describe "TopicRequiredWords" dofab!(:post) { Fabricate(:post, topic: topic, raw: "this is quite cool #bar") }fab!(:destination_topic) { Fabricate(:post).topic }- it "works" do+ it "moves the post to the destination topic" doexpect dotopic.move_posts(admin, [post.id], destination_topic_id: destination_topic.id)end.to_not raise_errordiff --git a/plugins/automation/spec/system/smoke_test_spec.rb b/plugins/automation/spec/system/smoke_test_spec.rbindex d869626265c..bdb83e390c9 100644--- a/plugins/automation/spec/system/smoke_test_spec.rb+++ b/plugins/automation/spec/system/smoke_test_spec.rb@@ -53,7 +53,7 @@ describe "DiscourseAutomation | smoke test" doendend- it "works" do+ it "creates an enabled group membership automation" dovisit("/admin/plugins/automation")find(".admin-config-area-empty-list__cta-button").clickdiff --git a/plugins/automation/spec/triggers/after_post_cook_spec.rb b/plugins/automation/spec/triggers/after_post_cook_spec.rbindex bae83ab787c..0386d0c11b9 100644--- a/plugins/automation/spec/triggers/after_post_cook_spec.rb+++ b/plugins/automation/spec/triggers/after_post_cook_spec.rb@@ -25,13 +25,13 @@ describe DiscourseAutomation::Triggers::AFTER_POST_COOK doautomation.reloadend- it "should not fire when tag is missing" do+ it "does not fire when the tag is missing" docaptured = capture_contexts { post.rebake! }expect(captured).to be_blankend- it "should fire when tag is present" do+ it "fires when the tag is present" dotopic.tags << filtered_tagtopic.save!diff --git a/plugins/automation/spec/triggers/post_created_edited_spec.rb b/plugins/automation/spec/triggers/post_created_edited_spec.rbindex 7a1228ca9e9..4619b3c1436 100644--- a/plugins/automation/spec/triggers/post_created_edited_spec.rb+++ b/plugins/automation/spec/triggers/post_created_edited_spec.rb@@ -415,7 +415,7 @@ describe "PostCreatedEdited" doexpect(list[0]["kind"]).to eq("post_created_edited")end- it "will not fire on unrelated categories" do+ it "does not fire on unrelated categories" dolist =capture_contexts doPostCreator.create(user, basic_topic_params.merge({ category: another_category.id }))diff --git a/plugins/automation/spec/triggers/topic_tags_changed_spec.rb b/plugins/automation/spec/triggers/topic_tags_changed_spec.rbindex 037b6ce0dd2..8d269fb921f 100644--- a/plugins/automation/spec/triggers/topic_tags_changed_spec.rb+++ b/plugins/automation/spec/triggers/topic_tags_changed_spec.rb@@ -46,7 +46,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED do)end- it "should fire the trigger if the tag is added" do+ it "fires the trigger if the tag is added" dotopic_0 = Fabricate(:topic, user: user, tags: [], category: category)list =@@ -59,7 +59,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doexpect(list[0]["user"]).to eq(user)end- it "should fire the trigger if the tag is removed" do+ it "fires the trigger if the tag is removed" dotopic_0 = Fabricate(:topic, user: user, tags: [cool_tag], category: category)list =@@ -70,7 +70,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doexpect(list[0]["user"]).to eq(user)end- it "should not fire if the tag is not present" do+ it "does not fire if the tag is not present" dotopic_0 = Fabricate(:topic, user: user, tags: [], category: category)list =@@ -96,7 +96,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doautomation.reloadend- it "should fire the trigger if any tag is added" do+ it "fires the trigger if any tag is added" dotopic_0 = Fabricate(:topic, user: user, tags: [], category: category)list =@@ -108,7 +108,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doexpect(list[0]["kind"]).to eq(DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED)end- it "should fire the trigger if any tag is removed" do+ it "fires the trigger if any tag is removed" dotopic_0 = Fabricate(:topic, user: user, tags: [cool_tag], category: category)list =@@ -118,7 +118,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doexpect(list[0]["kind"]).to eq(DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED)end- it "should not fire if the tag is not present" do+ it "does not fire if the tag is not present" dotopic_0 = Fabricate(:topic, user: user, tags: [], category: category)list =@@ -129,7 +129,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doexpect(list.length).to eq(0)end- it "should fire the trigger if a tag is add and one is removed" do+ it "fires the trigger if one tag is added and another is removed" dotopic_0 = Fabricate(:topic, user: user, tags: [cool_tag], category: category)list =@@ -153,7 +153,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doautomation.reloadend- it "should fire the trigger if the tag is added" do+ it "fires the trigger if the tag is added" dotopic_0 = Fabricate(:topic, user: user, tags: [], category: category)topic_1 = Fabricate(:topic, user: user, tags: [], category: Fabricate(:category))@@ -167,7 +167,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doexpect(list[0]["kind"]).to eq(DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED)end- it "should fire the trigger if the tag is removed" do+ it "fires the trigger if the tag is removed" dotopic_0 = Fabricate(:topic, user: user, tags: [cool_tag], category: category)list =@@ -176,7 +176,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doexpect(list[0]["kind"]).to eq(DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED)end- it "should not fire if not the watching category" do+ it "does not fire outside the watched category" dotopic_0 = Fabricate(:topic, user: user, tags: [], category: Fabricate(:category))list =@@ -202,7 +202,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doautomation.reloadend- it "should fire the trigger if any tag is added" do+ it "fires the trigger if any tag is added" dotopic_0 = Fabricate(:topic, user: user, tags: [], category: category)topic_1 = Fabricate(:topic, user: user, tags: [], category: category_2)@@ -216,7 +216,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doexpect(list[0]["kind"]).to eq(DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED)end- it "should fire the trigger if any tag is removed" do+ it "fires the trigger if any tag is removed" dotopic_0 = Fabricate(:topic, user: user, tags: [cool_tag], category: category)list =@@ -225,7 +225,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doexpect(list[0]["kind"]).to eq(DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED)end- it "should not fire if not the watching category" do+ it "does not fire outside the watched category" dotopic_0 = Fabricate(:topic, user: user, tags: [], category: Fabricate(:category))list =@@ -238,7 +238,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doendcontext "when without any watching tags or categories" do- it "should fire the trigger if the tag is added" do+ it "fires the trigger if the tag is added" dotopic_0 = Fabricate(:topic, user: user, tags: [], category: category)list =@@ -250,7 +250,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doexpect(list[0]["kind"]).to eq(DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED)end- it "should fire the trigger if the tag is removed" do+ it "fires the trigger if the tag is removed" dotopic_0 = Fabricate(:topic, user: user, tags: [cool_tag], category: category)list =@@ -260,7 +260,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doexpect(list[0]["kind"]).to eq(DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED)end- it "should send the correct removed tags in context" do+ it "sends the removed tags in the context" dotopic_0 = Fabricate(:topic, user: user, tags: [cool_tag], category: category)list =@@ -278,7 +278,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doexpect(list[0]["removed_tags"]).to eq([cool_tag.name])end- it "should send the correct added tags in context" do+ it "sends the added tags in the context" dotopic_0 = Fabricate(:topic, user: user, tags: [cool_tag], category: category)list =@@ -296,7 +296,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doexpect(list[0]["removed_tags"]).to eq([])end- it "should not fire the trigger on PMs by default" do+ it "does not fire the trigger on private messages by default" dopm = Fabricate(:private_message_topic)list =capture_contexts do@@ -309,7 +309,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doexpect(list.length).to eq(0)end- it "should fire the trigger on PMs if trigger_with_pms is set" do+ it "fires the trigger on private messages when trigger_with_pms is set" doautomation.upsert_field!("trigger_with_pms","boolean",@@ -330,7 +330,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doendcontext "with TAGS_ADDED set in trigger_on field" do- it "should fire if tag is added" do+ it "fires if the tag is added" doautomation.upsert_field!("trigger_on","choices",@@ -349,7 +349,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doexpect(list[0]["kind"]).to eq(DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED)end- it "should not fire if tag is removed" do+ it "does not fire if the tag is removed" doautomation.upsert_field!("trigger_on","choices",@@ -367,7 +367,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doendcontext "with TAGS_REMOVED set in trigger_on field" do- it "should fire if tag is removed" do+ it "fires if the tag is removed" doautomation.upsert_field!("trigger_on","choices",@@ -384,7 +384,7 @@ describe DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED doexpect(list[0]["kind"]).to eq(DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED)end- it "should not fire if tag is added" do+ it "does not fire if the tag is added" doautomation.upsert_field!("trigger_on","choices",diff --git a/plugins/chat/spec/jobs/scheduled/periodical_updates_spec.rb b/plugins/chat/spec/jobs/scheduled/periodical_updates_spec.rbindex 5fa751779a3..658799e2991 100644--- a/plugins/chat/spec/jobs/scheduled/periodical_updates_spec.rb+++ b/plugins/chat/spec/jobs/scheduled/periodical_updates_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe Jobs::Chat::PeriodicalUpdates do- it "works" do+ it "runs the periodic updates without raising an error" do# does not blow up, no mocks, everything is calledJobs::Chat::PeriodicalUpdates.new.execute(nil)enddiff --git a/plugins/chat/spec/lib/chat/notifier_spec.rb b/plugins/chat/spec/lib/chat/notifier_spec.rbindex 4efdd5fccc6..53c8bcc1172 100644--- a/plugins/chat/spec/lib/chat/notifier_spec.rb+++ b/plugins/chat/spec/lib/chat/notifier_spec.rb@@ -38,7 +38,7 @@ describe Chat::Notifier doexpect(to_notify[list_key]).to be_emptyend- it "will never include someone who is not accepting channel-wide notifications" do+ it "excludes users who ignore channel-wide notifications" douser_2.user_option.update!(ignore_channel_wide_mention: true)msg = build_cooked_msg(mention, user_1)@@ -47,7 +47,7 @@ describe Chat::Notifier doexpect(to_notify[list_key]).to be_emptyend- it "will never mention when channel is not accepting channel wide mentions" do+ it "excludes mentions when the channel disables channel-wide mentions" dochannel.update!(allow_channel_wide_mentions: false)msg = build_cooked_msg(mention, user_1)@@ -56,7 +56,7 @@ describe Chat::Notifier doexpect(to_notify[list_key]).to be_emptyend- it "will publish a mention warning" do+ it "publishes a mention warning" dochannel.update!(allow_channel_wide_mentions: false)msg = build_cooked_msg(mention, user_1)@@ -73,7 +73,7 @@ describe Chat::Notifier do)end- it "will respect user's locale on mention warning" do+ it "uses the user's locale for the mention warning" doSiteSetting.allow_user_locale = trueuser_1.update!(locale: "pt_BR")channel.update!(allow_channel_wide_mentions: false)@@ -102,7 +102,7 @@ describe Chat::Notifier doendshared_examples "ensure only channel members are notified" do- it "will never include someone outside the channel" do+ it "excludes users outside the channel" douser3 = Fabricate(:user)@chat_group.add(user3)another_channel = Fabricate(:category_channel)@@ -114,7 +114,7 @@ describe Chat::Notifier doexpect(to_notify[list_key]).to contain_exactly(user_2.id)end- it "will never include someone not following the channel anymore" do+ it "excludes users who no longer follow the channel" douser3 = Fabricate(:user)@chat_group.add(user3)Fabricate(@@ -130,7 +130,7 @@ describe Chat::Notifier doexpect(to_notify[list_key]).to contain_exactly(user_2.id)end- it "will never include someone who is suspended" do+ it "excludes suspended users" douser3 = Fabricate(:user, suspended_till: 2.years.from_now)@chat_group.add(user3)Fabricate(diff --git a/plugins/chat/spec/lib/chat/statistics_spec.rb b/plugins/chat/spec/lib/chat/statistics_spec.rbindex 4c3832b84fb..b5187a176cd 100644--- a/plugins/chat/spec/lib/chat/statistics_spec.rb+++ b/plugins/chat/spec/lib/chat/statistics_spec.rb@@ -1,342 +1,475 @@# frozen_string_literal: truedescribe Chat::Statistics do- fab!(:frozen_time) { DateTime.parse("2022-07-08 09:30:00") }-- fab!(:user1, :user)- fab!(:user2, :user)- fab!(:user3, :user)- fab!(:user4, :user)- fab!(:user5, :user)-- fab!(:channel1) { Fabricate(:chat_channel, created_at: frozen_time - 1.hour) }- fab!(:channel2) { Fabricate(:chat_channel, created_at: frozen_time - 2.days) }- fab!(:channel3) { Fabricate(:chat_channel, created_at: frozen_time - 6.days) }- fab!(:channel3) { Fabricate(:chat_channel, created_at: frozen_time - 20.days) }- fab!(:channel4) { Fabricate(:chat_channel, created_at: frozen_time - 21.days, status: :closed) }- fab!(:channel5) { Fabricate(:chat_channel, created_at: frozen_time - 24.days) }- fab!(:channel6) { Fabricate(:chat_channel, created_at: frozen_time - 40.days) }- fab!(:channel7) do- Fabricate(:chat_channel, created_at: frozen_time - 100.days, status: :archived)- end-- fab!(:membership1) do- Fabricate(:user_chat_channel_membership, user: user1, chat_channel: channel1)- end- fab!(:membership2) do- Fabricate(:user_chat_channel_membership, user: user2, chat_channel: channel1)- end- fab!(:membership3) do- Fabricate(:user_chat_channel_membership, user: user3, chat_channel: channel1)- end-- fab!(:message1) do- Fabricate(- :chat_message,- chat_channel: channel1,- created_at: frozen_time - 5.minutes,- user: user1,- )- end- fab!(:message2) do- Fabricate(:chat_message, chat_channel: channel1, created_at: frozen_time - 2.days, user: user2)- end- fab!(:message3) do- Fabricate(:chat_message, chat_channel: channel1, created_at: frozen_time - 6.days, user: user2)- end- fab!(:message4) do- Fabricate(:chat_message, chat_channel: channel1, created_at: frozen_time - 11.days, user: user2)- end- fab!(:message5) do- Fabricate(:chat_message, chat_channel: channel4, created_at: frozen_time - 12.days, user: user3)- end- fab!(:message6) do- Fabricate(:chat_message, chat_channel: channel1, created_at: frozen_time - 13.days, user: user2)- end- fab!(:message7) do- Fabricate(:chat_message, chat_channel: channel1, created_at: frozen_time - 16.days, user: user1)- end- fab!(:message8) do- Fabricate(:chat_message, chat_channel: channel1, created_at: frozen_time - 42.days, user: user3)- end- fab!(:message9) do- Fabricate(- :chat_message,- chat_channel: channel1,- created_at: frozen_time - 42.days,- user: user3,- deleted_at: frozen_time - 10.days,- deleted_by: user3,- )- end- fab!(:message10) do- Fabricate(:chat_message, chat_channel: channel1, created_at: frozen_time - 50.days, user: user4)- end- fab!(:message10) do- Fabricate(:chat_message, chat_channel: channel1, created_at: frozen_time - 62.days, user: user4)- end+ context "when calculating summary metrics" do+ fab!(:frozen_time) { DateTime.parse("2022-07-08 09:30:00") }- before { freeze_time(DateTime.parse("2022-07-08 09:30:00")) }+ fab!(:user1, :user)+ fab!(:user2, :user)+ fab!(:user3, :user)+ fab!(:user4, :user)+ fab!(:user5, :user)- describe "#about_messages" do- it "counts non-deleted messages created in all status channels in the time period accurately" do- about_messages = described_class.about_messages- expect(about_messages[:last_day]).to eq(1)- expect(about_messages[:"7_days"]).to eq(3)- expect(about_messages[:"30_days"]).to eq(7)- expect(about_messages[:previous_30_days]).to eq(2)- expect(about_messages[:count]).to eq(10)+ fab!(:channel1) { Fabricate(:chat_channel, created_at: frozen_time - 1.hour) }+ fab!(:channel2) { Fabricate(:chat_channel, created_at: frozen_time - 2.days) }+ fab!(:channel3) { Fabricate(:chat_channel, created_at: frozen_time - 6.days) }+ fab!(:channel3) { Fabricate(:chat_channel, created_at: frozen_time - 20.days) }+ fab!(:channel4) { Fabricate(:chat_channel, created_at: frozen_time - 21.days, status: :closed) }+ fab!(:channel5) { Fabricate(:chat_channel, created_at: frozen_time - 24.days) }+ fab!(:channel6) { Fabricate(:chat_channel, created_at: frozen_time - 40.days) }+ fab!(:channel7) do+ Fabricate(:chat_channel, created_at: frozen_time - 100.days, status: :archived)end- end- describe "#about_channels" do- it "counts open channels created in the time period accurately" do- about_channels = described_class.about_channels- expect(about_channels[:last_day]).to eq(1)- expect(about_channels[:"7_days"]).to eq(3)- expect(about_channels[:"30_days"]).to eq(5)- expect(about_channels[:previous_30_days]).to eq(1)- expect(about_channels[:count]).to eq(6)+ fab!(:membership1) do+ Fabricate(:user_chat_channel_membership, user: user1, chat_channel: channel1)end- end-- describe "#about_users" do- it "counts any users who have sent any message to a chat channel in the time periods accurately" do- about_users = described_class.about_users- expect(about_users[:last_day]).to eq(1)- expect(about_users[:"7_days"]).to eq(2)- expect(about_users[:"30_days"]).to eq(3)- expect(about_users[:previous_30_days]).to eq(2)- expect(about_users[:count]).to eq(4)+ fab!(:membership2) do+ Fabricate(:user_chat_channel_membership, user: user2, chat_channel: channel1)end- end-- describe "#monthly" do- it "has the correct counts of users, messages, and channels created since the start of this month" do- monthly = described_class.monthly- expect(monthly[:messages]).to eq(3)- expect(monthly[:channels]).to eq(3)- expect(monthly[:users]).to eq(2)- end- end-end--describe Chat::Statistics do- describe "#channel_messages" do- now = Time.now-- fab!(:channel_1) { Fabricate(:chat_channel, status: :open) }- fab!(:channel_2) { Fabricate(:chat_channel, status: :closed) }- fab!(:channel_3) { Fabricate(:chat_channel, status: :archived) }-- fab!(:message1) { Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 1.hour) }- fab!(:message2) { Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 3.days) }- fab!(:message3) { Fabricate(:chat_message, chat_channel: channel_3, created_at: now - 5.days) }- fab!(:message4) { Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 10.days) }- fab!(:message5) { Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 12.days) }- fab!(:message6) { Fabricate(:chat_message, chat_channel: channel_3, created_at: now - 27.days) }- fab!(:message7) { Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 29.days) }- fab!(:message8) { Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 30.days) }- fab!(:message9) { Fabricate(:chat_message, chat_channel: channel_3, created_at: now - 40.days) }- fab!(:message10) do- Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 50.days)+ fab!(:membership3) do+ Fabricate(:user_chat_channel_membership, user: user3, chat_channel: channel1)end- fab!(:dm_channel_1, :direct_message_channel)- fab!(:dm_channel_2, :direct_message_channel)- fab!(:dm_channel_3, :direct_message_channel)-- # these DM channel messages should be ignored when counting:- fab!(:dm_message1) do- Fabricate(:chat_message, chat_channel: dm_channel_1, created_at: now - 1.hour)- end- fab!(:dm_message2) do- Fabricate(:chat_message, chat_channel: dm_channel_2, created_at: now - 3.days)- end- fab!(:dm_message3) do- Fabricate(:chat_message, chat_channel: dm_channel_3, created_at: now - 20.days)- end- fab!(:dm_message4) do- Fabricate(:chat_message, chat_channel: dm_channel_1, created_at: now - 50.days)- end-- it "counts messages count accurately" do- channel_messages = described_class.channel_messages- expect(channel_messages[:last_day]).to eq(1)- expect(channel_messages[:"7_days"]).to eq(3)- expect(channel_messages[:"28_days"]).to eq(6)- expect(channel_messages[:"30_days"]).to eq(7)- expect(channel_messages[:count]).to eq(10)- end- end-- describe "#direct_messages" do- now = Time.now-- fab!(:dm_channel_1) { Fabricate(:direct_message_channel, status: :open) }- fab!(:dm_channel_2) { Fabricate(:direct_message_channel, status: :closed) }- fab!(:dm_channel_3) { Fabricate(:direct_message_channel, status: :archived) }-fab!(:message1) do- Fabricate(:chat_message, chat_channel: dm_channel_1, created_at: now - 1.hour)+ Fabricate(+ :chat_message,+ chat_channel: channel1,+ created_at: frozen_time - 5.minutes,+ user: user1,+ )endfab!(:message2) do- Fabricate(:chat_message, chat_channel: dm_channel_2, created_at: now - 3.days)+ Fabricate(+ :chat_message,+ chat_channel: channel1,+ created_at: frozen_time - 2.days,+ user: user2,+ )endfab!(:message3) do- Fabricate(:chat_message, chat_channel: dm_channel_3, created_at: now - 5.days)+ Fabricate(+ :chat_message,+ chat_channel: channel1,+ created_at: frozen_time - 6.days,+ user: user2,+ )endfab!(:message4) do- Fabricate(:chat_message, chat_channel: dm_channel_1, created_at: now - 10.days)+ Fabricate(+ :chat_message,+ chat_channel: channel1,+ created_at: frozen_time - 11.days,+ user: user2,+ )endfab!(:message5) do- Fabricate(:chat_message, chat_channel: dm_channel_2, created_at: now - 12.days)+ Fabricate(+ :chat_message,+ chat_channel: channel4,+ created_at: frozen_time - 12.days,+ user: user3,+ )endfab!(:message6) do- Fabricate(:chat_message, chat_channel: dm_channel_3, created_at: now - 27.days)+ Fabricate(+ :chat_message,+ chat_channel: channel1,+ created_at: frozen_time - 13.days,+ user: user2,+ )endfab!(:message7) do- Fabricate(:chat_message, chat_channel: dm_channel_1, created_at: now - 29.days)+ Fabricate(+ :chat_message,+ chat_channel: channel1,+ created_at: frozen_time - 16.days,+ user: user1,+ )endfab!(:message8) do- Fabricate(:chat_message, chat_channel: dm_channel_2, created_at: now - 30.days)+ Fabricate(+ :chat_message,+ chat_channel: channel1,+ created_at: frozen_time - 42.days,+ user: user3,+ )endfab!(:message9) do- Fabricate(:chat_message, chat_channel: dm_channel_3, created_at: now - 40.days)+ Fabricate(+ :chat_message,+ chat_channel: channel1,+ created_at: frozen_time - 42.days,+ user: user3,+ deleted_at: frozen_time - 10.days,+ deleted_by: user3,+ )endfab!(:message10) do- Fabricate(:chat_message, chat_channel: dm_channel_1, created_at: now - 50.days)+ Fabricate(+ :chat_message,+ chat_channel: channel1,+ created_at: frozen_time - 50.days,+ user: user4,+ )end-- # these non DM channel messages should be ignored when counting:- fab!(:channel_1) { Fabricate(:chat_channel, status: :open) }- fab!(:channel_2) { Fabricate(:chat_channel, status: :closed) }- fab!(:channel_3) { Fabricate(:chat_channel, status: :archived) }-- fab!(:dm_message1) do- Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 1.hour)- end- fab!(:dm_message2) do- Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 3.days)- end- fab!(:dm_message3) do- Fabricate(:chat_message, chat_channel: channel_3, created_at: now - 20.days)- end- fab!(:dm_message4) do- Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 50.days)- end-- it "counts messages count accurately" do- direct_messages = described_class.direct_messages- expect(direct_messages[:last_day]).to eq(1)- expect(direct_messages[:"7_days"]).to eq(3)- expect(direct_messages[:"28_days"]).to eq(6)- expect(direct_messages[:"30_days"]).to eq(7)- expect(direct_messages[:count]).to eq(10)- end- end-- describe "#open_channels_with_threads_enabled" do- fab!(:open_channel_with_threads_enabled_1) do- Fabricate(:chat_channel, threading_enabled: true, status: :open)- end- fab!(:open_channel_with_threads_enabled_2) do- Fabricate(:chat_channel, threading_enabled: true, status: :open)- end-- fab!(:channel3) { Fabricate(:chat_channel, threading_enabled: true, status: :closed) }- fab!(:channel4) { Fabricate(:chat_channel, threading_enabled: true, status: :archived) }- fab!(:channel5) { Fabricate(:chat_channel, threading_enabled: false, status: :open) }- fab!(:channel6) { Fabricate(:chat_channel, threading_enabled: false, status: :closed) }- fab!(:channel7) { Fabricate(:chat_channel, threading_enabled: false, status: :archived) }-- it "counts channels count accurately" do- channels = described_class.open_channels_with_threads_enabled- expect(channels[:count]).to eq(2)- end- end-- describe "#threaded_messages" do- now = Time.now-- fab!(:channel_1) { Fabricate(:chat_channel, status: :open) }- fab!(:channel_2) { Fabricate(:chat_channel, status: :closed) }-- # note that fabricating a thread also fabricates the first message in that thread- # so these two threads add up 2 messages- fab!(:thread_1) { Fabricate(:chat_thread, channel: channel_1) }- fab!(:thread_2) { Fabricate(:chat_thread, channel: channel_2) }-- fab!(:threaded_message1) do- Fabricate(:chat_message, chat_channel: channel_1, thread: thread_1, created_at: now - 1.hour)- end- fab!(:threaded_message2) do- Fabricate(:chat_message, chat_channel: channel_2, thread: thread_2, created_at: now - 3.days)- end- fab!(:threaded_message3) do- Fabricate(:chat_message, chat_channel: channel_1, thread: thread_1, created_at: now - 5.days)- end- fab!(:threaded_message4) do- Fabricate(:chat_message, chat_channel: channel_2, thread: thread_2, created_at: now - 10.days)- end- fab!(:threaded_message5) do- Fabricate(:chat_message, chat_channel: channel_1, thread: thread_1, created_at: now - 12.days)- end- fab!(:threaded_message6) do- Fabricate(:chat_message, chat_channel: channel_2, thread: thread_2, created_at: now - 27.days)- end- fab!(:threaded_message7) do- Fabricate(:chat_message, chat_channel: channel_1, thread: thread_1, created_at: now - 29.days)- end- fab!(:threaded_message8) do- Fabricate(:chat_message, chat_channel: channel_2, thread: thread_2, created_at: now - 30.days)- end- fab!(:threaded_message9) do- Fabricate(:chat_message, chat_channel: channel_1, thread: thread_1, created_at: now - 40.days)- end- fab!(:threaded_message10) do- Fabricate(:chat_message, chat_channel: channel_2, thread: thread_2, created_at: now - 50.days)- end-- # these messages are not in a thread, so they should be ignored when counting:- fab!(:message1) { Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 1.hour) }- fab!(:message2) { Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 3.days) }- fab!(:message3) { Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 5.days) }- fab!(:message4) { Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 10.days) }- fab!(:message5) { Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 12.days) }- fab!(:message6) { Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 20.days) }- fab!(:message7) { Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 21.days) }- fab!(:message8) { Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 30.days) }- fab!(:message9) { Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 40.days) }fab!(:message10) do- Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 50.days)- end-- fab!(:dm_channel_1, :direct_message_channel)- fab!(:dm_channel_2, :direct_message_channel)- fab!(:dm_channel_3, :direct_message_channel)-- # these DM channel messages should be ignored when counting:- fab!(:dm_message1) do- Fabricate(:chat_message, chat_channel: dm_channel_1, created_at: now - 1.hour)- end- fab!(:dm_message2) do- Fabricate(:chat_message, chat_channel: dm_channel_2, created_at: now - 3.days)- end- fab!(:dm_message3) do- Fabricate(:chat_message, chat_channel: dm_channel_3, created_at: now - 20.days)- end- fab!(:dm_message4) do- Fabricate(:chat_message, chat_channel: dm_channel_1, created_at: now - 50.days)+ Fabricate(+ :chat_message,+ chat_channel: channel1,+ created_at: frozen_time - 62.days,+ user: user4,+ )+ end++ before { freeze_time(DateTime.parse("2022-07-08 09:30:00")) }++ describe "#about_messages" do+ it "counts non-deleted messages created in all status channels in the time period accurately" do+ about_messages = described_class.about_messages+ expect(about_messages[:last_day]).to eq(1)+ expect(about_messages[:"7_days"]).to eq(3)+ expect(about_messages[:"30_days"]).to eq(7)+ expect(about_messages[:previous_30_days]).to eq(2)+ expect(about_messages[:count]).to eq(10)+ end+ end++ describe "#about_channels" do+ it "counts open channels created in the time period accurately" do+ about_channels = described_class.about_channels+ expect(about_channels[:last_day]).to eq(1)+ expect(about_channels[:"7_days"]).to eq(3)+ expect(about_channels[:"30_days"]).to eq(5)+ expect(about_channels[:previous_30_days]).to eq(1)+ expect(about_channels[:count]).to eq(6)+ end+ end++ describe "#about_users" do+ it "counts any users who have sent any message to a chat channel in the time periods accurately" do+ about_users = described_class.about_users+ expect(about_users[:last_day]).to eq(1)+ expect(about_users[:"7_days"]).to eq(2)+ expect(about_users[:"30_days"]).to eq(3)+ expect(about_users[:previous_30_days]).to eq(2)+ expect(about_users[:count]).to eq(4)+ end+ end++ describe "#monthly" do+ it "has the correct counts of users, messages, and channels created since the start of this month" do+ monthly = described_class.monthly+ expect(monthly[:messages]).to eq(3)+ expect(monthly[:channels]).to eq(3)+ expect(monthly[:users]).to eq(2)+ endend+ end- it "counts messages count accurately" do- threaded_messages = described_class.threaded_messages- expect(threaded_messages[:last_day]).to eq(3)- expect(threaded_messages[:"7_days"]).to eq(5)- expect(threaded_messages[:"28_days"]).to eq(8)- expect(threaded_messages[:"30_days"]).to eq(9)- expect(threaded_messages[:count]).to eq(12)+ context "when calculating channel message metrics" do+ describe "#channel_messages" do+ now = Time.now++ fab!(:channel_1) { Fabricate(:chat_channel, status: :open) }+ fab!(:channel_2) { Fabricate(:chat_channel, status: :closed) }+ fab!(:channel_3) { Fabricate(:chat_channel, status: :archived) }++ fab!(:message1) do+ Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 1.hour)+ end+ fab!(:message2) do+ Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 3.days)+ end+ fab!(:message3) do+ Fabricate(:chat_message, chat_channel: channel_3, created_at: now - 5.days)+ end+ fab!(:message4) do+ Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 10.days)+ end+ fab!(:message5) do+ Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 12.days)+ end+ fab!(:message6) do+ Fabricate(:chat_message, chat_channel: channel_3, created_at: now - 27.days)+ end+ fab!(:message7) do+ Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 29.days)+ end+ fab!(:message8) do+ Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 30.days)+ end+ fab!(:message9) do+ Fabricate(:chat_message, chat_channel: channel_3, created_at: now - 40.days)+ end+ fab!(:message10) do+ Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 50.days)+ end++ fab!(:dm_channel_1, :direct_message_channel)+ fab!(:dm_channel_2, :direct_message_channel)+ fab!(:dm_channel_3, :direct_message_channel)++ # these DM channel messages should be ignored when counting:+ fab!(:dm_message1) do+ Fabricate(:chat_message, chat_channel: dm_channel_1, created_at: now - 1.hour)+ end+ fab!(:dm_message2) do+ Fabricate(:chat_message, chat_channel: dm_channel_2, created_at: now - 3.days)+ end+ fab!(:dm_message3) do+ Fabricate(:chat_message, chat_channel: dm_channel_3, created_at: now - 20.days)+ end+ fab!(:dm_message4) do+ Fabricate(:chat_message, chat_channel: dm_channel_1, created_at: now - 50.days)+ end++ it "counts messages count accurately" do+ channel_messages = described_class.channel_messages+ expect(channel_messages[:last_day]).to eq(1)+ expect(channel_messages[:"7_days"]).to eq(3)+ expect(channel_messages[:"28_days"]).to eq(6)+ expect(channel_messages[:"30_days"]).to eq(7)+ expect(channel_messages[:count]).to eq(10)+ end+ end++ describe "#direct_messages" do+ now = Time.now++ fab!(:dm_channel_1) { Fabricate(:direct_message_channel, status: :open) }+ fab!(:dm_channel_2) { Fabricate(:direct_message_channel, status: :closed) }+ fab!(:dm_channel_3) { Fabricate(:direct_message_channel, status: :archived) }++ fab!(:message1) do+ Fabricate(:chat_message, chat_channel: dm_channel_1, created_at: now - 1.hour)+ end+ fab!(:message2) do+ Fabricate(:chat_message, chat_channel: dm_channel_2, created_at: now - 3.days)+ end+ fab!(:message3) do+ Fabricate(:chat_message, chat_channel: dm_channel_3, created_at: now - 5.days)+ end+ fab!(:message4) do+ Fabricate(:chat_message, chat_channel: dm_channel_1, created_at: now - 10.days)+ end+ fab!(:message5) do+ Fabricate(:chat_message, chat_channel: dm_channel_2, created_at: now - 12.days)+ end+ fab!(:message6) do+ Fabricate(:chat_message, chat_channel: dm_channel_3, created_at: now - 27.days)+ end+ fab!(:message7) do+ Fabricate(:chat_message, chat_channel: dm_channel_1, created_at: now - 29.days)+ end+ fab!(:message8) do+ Fabricate(:chat_message, chat_channel: dm_channel_2, created_at: now - 30.days)+ end+ fab!(:message9) do+ Fabricate(:chat_message, chat_channel: dm_channel_3, created_at: now - 40.days)+ end+ fab!(:message10) do+ Fabricate(:chat_message, chat_channel: dm_channel_1, created_at: now - 50.days)+ end++ # these non DM channel messages should be ignored when counting:+ fab!(:channel_1) { Fabricate(:chat_channel, status: :open) }+ fab!(:channel_2) { Fabricate(:chat_channel, status: :closed) }+ fab!(:channel_3) { Fabricate(:chat_channel, status: :archived) }++ fab!(:dm_message1) do+ Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 1.hour)+ end+ fab!(:dm_message2) do+ Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 3.days)+ end+ fab!(:dm_message3) do+ Fabricate(:chat_message, chat_channel: channel_3, created_at: now - 20.days)+ end+ fab!(:dm_message4) do+ Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 50.days)+ end++ it "counts messages count accurately" do+ direct_messages = described_class.direct_messages+ expect(direct_messages[:last_day]).to eq(1)+ expect(direct_messages[:"7_days"]).to eq(3)+ expect(direct_messages[:"28_days"]).to eq(6)+ expect(direct_messages[:"30_days"]).to eq(7)+ expect(direct_messages[:count]).to eq(10)+ end+ end++ describe "#open_channels_with_threads_enabled" do+ fab!(:open_channel_with_threads_enabled_1) do+ Fabricate(:chat_channel, threading_enabled: true, status: :open)+ end+ fab!(:open_channel_with_threads_enabled_2) do+ Fabricate(:chat_channel, threading_enabled: true, status: :open)+ end++ fab!(:channel3) { Fabricate(:chat_channel, threading_enabled: true, status: :closed) }+ fab!(:channel4) { Fabricate(:chat_channel, threading_enabled: true, status: :archived) }+ fab!(:channel5) { Fabricate(:chat_channel, threading_enabled: false, status: :open) }+ fab!(:channel6) { Fabricate(:chat_channel, threading_enabled: false, status: :closed) }+ fab!(:channel7) { Fabricate(:chat_channel, threading_enabled: false, status: :archived) }++ it "counts channels count accurately" do+ channels = described_class.open_channels_with_threads_enabled+ expect(channels[:count]).to eq(2)+ end+ end++ describe "#threaded_messages" do+ now = Time.now++ fab!(:channel_1) { Fabricate(:chat_channel, status: :open) }+ fab!(:channel_2) { Fabricate(:chat_channel, status: :closed) }++ # note that fabricating a thread also fabricates the first message in that thread+ # so these two threads add up 2 messages+ fab!(:thread_1) { Fabricate(:chat_thread, channel: channel_1) }+ fab!(:thread_2) { Fabricate(:chat_thread, channel: channel_2) }++ fab!(:threaded_message1) do+ Fabricate(+ :chat_message,+ chat_channel: channel_1,+ thread: thread_1,+ created_at: now - 1.hour,+ )+ end+ fab!(:threaded_message2) do+ Fabricate(+ :chat_message,+ chat_channel: channel_2,+ thread: thread_2,+ created_at: now - 3.days,+ )+ end+ fab!(:threaded_message3) do+ Fabricate(+ :chat_message,+ chat_channel: channel_1,+ thread: thread_1,+ created_at: now - 5.days,+ )+ end+ fab!(:threaded_message4) do+ Fabricate(+ :chat_message,+ chat_channel: channel_2,+ thread: thread_2,+ created_at: now - 10.days,+ )+ end+ fab!(:threaded_message5) do+ Fabricate(+ :chat_message,+ chat_channel: channel_1,+ thread: thread_1,+ created_at: now - 12.days,+ )+ end+ fab!(:threaded_message6) do+ Fabricate(+ :chat_message,+ chat_channel: channel_2,+ thread: thread_2,+ created_at: now - 27.days,+ )+ end+ fab!(:threaded_message7) do+ Fabricate(+ :chat_message,+ chat_channel: channel_1,+ thread: thread_1,+ created_at: now - 29.days,+ )+ end+ fab!(:threaded_message8) do+ Fabricate(+ :chat_message,+ chat_channel: channel_2,+ thread: thread_2,+ created_at: now - 30.days,+ )+ end+ fab!(:threaded_message9) do+ Fabricate(+ :chat_message,+ chat_channel: channel_1,+ thread: thread_1,+ created_at: now - 40.days,+ )+ end+ fab!(:threaded_message10) do+ Fabricate(+ :chat_message,+ chat_channel: channel_2,+ thread: thread_2,+ created_at: now - 50.days,+ )+ end++ # these messages are not in a thread, so they should be ignored when counting:+ fab!(:message1) do+ Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 1.hour)+ end+ fab!(:message2) do+ Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 3.days)+ end+ fab!(:message3) do+ Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 5.days)+ end+ fab!(:message4) do+ Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 10.days)+ end+ fab!(:message5) do+ Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 12.days)+ end+ fab!(:message6) do+ Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 20.days)+ end+ fab!(:message7) do+ Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 21.days)+ end+ fab!(:message8) do+ Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 30.days)+ end+ fab!(:message9) do+ Fabricate(:chat_message, chat_channel: channel_1, created_at: now - 40.days)+ end+ fab!(:message10) do+ Fabricate(:chat_message, chat_channel: channel_2, created_at: now - 50.days)+ end++ fab!(:dm_channel_1, :direct_message_channel)+ fab!(:dm_channel_2, :direct_message_channel)+ fab!(:dm_channel_3, :direct_message_channel)++ # these DM channel messages should be ignored when counting:+ fab!(:dm_message1) do+ Fabricate(:chat_message, chat_channel: dm_channel_1, created_at: now - 1.hour)+ end+ fab!(:dm_message2) do+ Fabricate(:chat_message, chat_channel: dm_channel_2, created_at: now - 3.days)+ end+ fab!(:dm_message3) do+ Fabricate(:chat_message, chat_channel: dm_channel_3, created_at: now - 20.days)+ end+ fab!(:dm_message4) do+ Fabricate(:chat_message, chat_channel: dm_channel_1, created_at: now - 50.days)+ end++ it "counts messages count accurately" do+ threaded_messages = described_class.threaded_messages+ expect(threaded_messages[:last_day]).to eq(3)+ expect(threaded_messages[:"7_days"]).to eq(5)+ expect(threaded_messages[:"28_days"]).to eq(8)+ expect(threaded_messages[:"30_days"]).to eq(9)+ expect(threaded_messages[:count]).to eq(12)+ endendendenddiff --git a/plugins/chat/spec/lib/chat_sdk/channel_spec.rb b/plugins/chat/spec/lib/chat_sdk/channel_spec.rbindex bf55b7ae2d7..5d7f1525c1b 100644--- a/plugins/chat/spec/lib/chat_sdk/channel_spec.rb+++ b/plugins/chat/spec/lib/chat_sdk/channel_spec.rb@@ -23,7 +23,7 @@ describe ChatSDK::Channel docontext "when guardian can't see the channel" dofab!(:channel_1, :private_category_channel)- it "fails" do+ it "rejects a guardian without access to the channel" doparams[:guardian] = Fabricate(:user).guardianexpect { described_class.messages(**params) }.to raise_error("Guardian can't view channel")@@ -31,7 +31,7 @@ describe ChatSDK::Channel doendcontext "when target_message doesn't exist" do- it "fails" do+ it "rejects a nonexistent target message" doexpect { described_class.messages(**params, target_message_id: -999) }.to raise_error("Target message doesn't exist",)@@ -39,7 +39,7 @@ describe ChatSDK::Channel doendcontext "when direction is invalid" do- it "fails" do+ it "rejects an invalid direction" doexpect { described_class.messages(**params, direction: "invalid") }.to raise_error("Direction is not included in the list",)@@ -65,7 +65,7 @@ describe ChatSDK::Channel doendcontext "when the channel doesn't exist" do- it "fails" do+ it "rejects a nonexistent channel" doparams[:channel_id] = -999expect { described_class.start_reply(**params) }.to raise_error(@@ -75,7 +75,7 @@ describe ChatSDK::Channel doendcontext "when the thread doesn't exist" do- it "fails" do+ it "rejects a nonexistent thread" doparams[:thread_id] = -999expect { described_class.start_reply(**params) }.to raise_error(@@ -113,7 +113,7 @@ describe ChatSDK::Channel doendcontext "when the channel doesn't exist" do- it "fails" do+ it "rejects a nonexistent channel" doparams[:channel_id] = -999expect { described_class.stop_reply(**params) }.to raise_error(@@ -123,7 +123,7 @@ describe ChatSDK::Channel doendcontext "when the thread doesn't exist" do- it "fails" do+ it "rejects a nonexistent thread" doparams[:thread_id] = -999expect { described_class.stop_reply(**params) }.to raise_error(diff --git a/plugins/chat/spec/lib/chat_sdk/message_spec.rb b/plugins/chat/spec/lib/chat_sdk/message_spec.rbindex 85b261fcb64..06d44db10cd 100644--- a/plugins/chat/spec/lib/chat_sdk/message_spec.rb+++ b/plugins/chat/spec/lib/chat_sdk/message_spec.rb@@ -62,7 +62,7 @@ describe ChatSDK::Message dobefore { channel_1.add(user) }- it "fails" do+ it "rejects messages with blocks from non-bot users" doexpect { described_class.create(**params) }.to raise_error("Only bots can create messages with blocks",)@@ -96,7 +96,7 @@ describe ChatSDK::Message doendcontext "when channel doesn’t exist" do- it "fails" do+ it "rejects a nonexistent channel" doexpect { described_class.create(**params, channel_id: -999) }.to raise_error("Couldn't find channel with id: `-999`",)@@ -104,7 +104,7 @@ describe ChatSDK::Message doendcontext "when user can't join channel" do- it "fails" do+ it "rejects users without channel membership" doparams[:guardian] = Fabricate(:user).guardianexpect { described_class.create(**params) }.to raise_error(@@ -114,7 +114,7 @@ describe ChatSDK::Message doendcontext "when membership is enforced" do- it "works" do+ it "creates the message and enforces channel membership" doSiteSetting.chat_allowed_groups = Group::AUTO_GROUPS[:everyone]params[:enforce_membership] = trueparams[:guardian] = Fabricate(:user).guardian@@ -126,7 +126,7 @@ describe ChatSDK::Message doendcontext "when thread doesn't exist" do- it "fails" do+ it "rejects a nonexistent thread" doexpect { described_class.create(**params, thread_id: -999) }.to raise_error("Couldn't find thread with id: `-999`",)@@ -134,7 +134,7 @@ describe ChatSDK::Message doendcontext "when params are invalid" do- it "fails" do+ it "rejects a missing channel and message body" doexpect { described_class.create(**params, raw: nil, channel_id: nil) }.to raise_error("Chat channel can't be blank, Message can't be blank",)@@ -182,7 +182,7 @@ describe ChatSDK::Message doendcontext "when user can't stop streaming" do- it "fails" do+ it "rejects users without permission to stop the stream" douser = Fabricate(:user)message_1.chat_channel.add(user)@@ -197,7 +197,7 @@ describe ChatSDK::Message doFabricate(:chat_message, chat_channel: Fabricate(:private_category_channel))end- it "fails" do+ it "rejects users outside the channel" douser = Fabricate(:user)expect {diff --git a/plugins/chat/spec/lib/chat_sdk/thread_spec.rb b/plugins/chat/spec/lib/chat_sdk/thread_spec.rbindex 5240e22dc34..fb2873e337e 100644--- a/plugins/chat/spec/lib/chat_sdk/thread_spec.rb+++ b/plugins/chat/spec/lib/chat_sdk/thread_spec.rb@@ -15,7 +15,7 @@ describe ChatSDK::Thread doendcontext "when missing param" do- it "fails" do+ it "raises a missing keyword error" doparams.delete(:thread_id)expect { described_class.update_title(**params) }.to raise_error(@@ -27,7 +27,7 @@ describe ChatSDK::Thread docontext "when guardian can't see the channel" dofab!(:thread_1) { Fabricate(:chat_thread, channel: Fabricate(:private_category_channel)) }- it "fails" do+ it "raises a channel visibility error" doparams[:guardian] = Fabricate(:user).guardianexpect { described_class.update_title(**params) }.to raise_error(@@ -37,7 +37,7 @@ describe ChatSDK::Thread doendcontext "when guardian can't edit the thread" do- it "fails" do+ it "raises a thread permission error" doparams[:guardian] = Fabricate(:user).guardianexpect { described_class.update_title(**params) }.to raise_error(@@ -49,7 +49,7 @@ describe ChatSDK::Thread docontext "when the threading is not enabled" dobefore { thread_1.channel.update!(threading_enabled: false) }- it "fails" do+ it "raises a threading-disabled error" doexpect { described_class.update_title(**params) }.to raise_error("Threading is not enabled for this channel",)@@ -57,7 +57,7 @@ describe ChatSDK::Thread doendcontext "when the thread doesn't exist" do- it "fails" do+ it "raises a missing-thread error" doparams[:thread_id] = -999expect { described_class.update_title(**params) }.to raise_error("Couldn’t find thread with id: `-999`",@@ -127,7 +127,7 @@ describe ChatSDK::Thread doendcontext "when target_message doesn’t exist" do- it "fails" do+ it "raises a missing-message error" doexpect { described_class.messages(**params, target_message_id: -999) }.to raise_error("Target message doesn't exist",)diff --git a/plugins/chat/spec/requests/chat/api/channel_messages_controller_spec.rb b/plugins/chat/spec/requests/chat/api/channel_messages_controller_spec.rbindex b8a15e7f219..bf27c04434c 100644--- a/plugins/chat/spec/requests/chat/api/channel_messages_controller_spec.rb+++ b/plugins/chat/spec/requests/chat/api/channel_messages_controller_spec.rb@@ -16,7 +16,7 @@ RSpec.describe Chat::Api::ChannelMessagesController dofab!(:message_1) { Fabricate(:chat_message, chat_channel: channel) }fab!(:message_2, :chat_message)- it "works" do+ it "returns messages from the requested channel" doget "/chat/api/channels/#{channel.id}/messages"expect(response.status).to eq(200)@@ -81,7 +81,7 @@ RSpec.describe Chat::Api::ChannelMessagesController dobefore { Discourse.enable_readonly_mode }after { Discourse.disable_readonly_mode }- it "works" do+ it "returns messages in read-only mode" doget "/chat/api/channels/#{channel.id}/messages"expect(response.status).to eq(200)@@ -456,7 +456,7 @@ RSpec.describe Chat::Api::ChannelMessagesController dodescribe "#update" docontext "when message is updated" dofab!(:message_1) { Fabricate(:chat_message, chat_channel: channel, user: current_user) }- it "works" do+ it "updates the message" doput "/chat/api/channels/#{channel.id}/messages/#{message_1.id}",params: {message: "abcdefg",diff --git a/plugins/chat/spec/requests/chat/api/channel_thread_messages_controller_spec.rb b/plugins/chat/spec/requests/chat/api/channel_thread_messages_controller_spec.rbindex 77c91649dae..d6a1df732c4 100644--- a/plugins/chat/spec/requests/chat/api/channel_thread_messages_controller_spec.rb+++ b/plugins/chat/spec/requests/chat/api/channel_thread_messages_controller_spec.rb@@ -18,7 +18,7 @@ RSpec.describe Chat::Api::ChannelThreadMessagesController dofab!(:message_1) { Fabricate(:chat_message, thread: thread, chat_channel: thread.channel) }fab!(:message_2) { Fabricate(:chat_message, chat_channel: thread.channel) }- it "works" do+ it "returns the thread's messages" doget "/chat/api/channels/#{thread.channel.id}/threads/#{thread.id}/messages"expect(response.status).to eq(200)diff --git a/plugins/chat/spec/requests/chat/api/channel_threads_controller_spec.rb b/plugins/chat/spec/requests/chat/api/channel_threads_controller_spec.rbindex f3245f0aaa4..80d44560f2b 100644--- a/plugins/chat/spec/requests/chat/api/channel_threads_controller_spec.rb+++ b/plugins/chat/spec/requests/chat/api/channel_threads_controller_spec.rb@@ -35,7 +35,7 @@ RSpec.describe Chat::Api::ChannelThreadsController do)end- it "works" do+ it "returns the requested thread" doget "/chat/api/channels/#{thread.channel_id}/threads/#{thread.id}"expect(response.status).to eq(200)expect(response.parsed_body["thread"]["id"]).to eq(thread.id)diff --git a/plugins/chat/spec/requests/chat/api/channels_current_user_membership_controller_spec.rb b/plugins/chat/spec/requests/chat/api/channels_current_user_membership_controller_spec.rbindex add0bfcc09c..e713333a1f0 100644--- a/plugins/chat/spec/requests/chat/api/channels_current_user_membership_controller_spec.rb+++ b/plugins/chat/spec/requests/chat/api/channels_current_user_membership_controller_spec.rb@@ -26,7 +26,7 @@ describe Chat::Api::ChannelsCurrentUserMembershipController docontext "when current user can’t see the channel" dofab!(:channel_2) { Fabricate(:private_category_channel, group: Fabricate(:group)) }- it "fails" do+ it "forbids creating a channel membership" doexpect { post "/chat/api/channels/#{channel_2.id}/memberships/me" }.not_to change {Chat::UserChatChannelMembership.where(user_id: current_user.id).count}@@ -50,7 +50,7 @@ describe Chat::Api::ChannelsCurrentUserMembershipController doreadonly_group_1.add(current_user)end- it "fails" do+ it "forbids creating a channel membership" doexpect { post "/chat/api/channels/#{channel_2.id}/memberships/me" }.not_to change {Chat::UserChatChannelMembership.where(user_id: current_user.id).count}@@ -73,7 +73,7 @@ describe Chat::Api::ChannelsCurrentUserMembershipController doreadonly_group_1.add(current_user)end- it "works" do+ it "creates a channel membership" doexpect { post "/chat/api/channels/#{channel_2.id}/memberships/me" }.to change {Chat::UserChatChannelMembership.where(user_id: current_user.id).count}.by(1)@@ -155,7 +155,7 @@ describe Chat::Api::ChannelsCurrentUserMembershipController dodescribe "#destroy" dodescribe "success" do- it "works" do+ it "allows leaving the channel" dodelete "/chat/api/channels/#{channel_1.id}/memberships/me"expect(response.status).to eq(200)diff --git a/plugins/chat/spec/requests/chat/api/channels_current_user_membership_follows_controller_spec.rb b/plugins/chat/spec/requests/chat/api/channels_current_user_membership_follows_controller_spec.rbindex cf15d9659e9..df5d6951e8f 100644--- a/plugins/chat/spec/requests/chat/api/channels_current_user_membership_follows_controller_spec.rb+++ b/plugins/chat/spec/requests/chat/api/channels_current_user_membership_follows_controller_spec.rb@@ -14,7 +14,7 @@ describe Chat::Api::ChannelsCurrentUserMembershipController dodescribe "for a category channel" dofab!(:channel_1, :category_channel)- it "works" do+ it "unfollows the category channel" dodelete "/chat/api/channels/#{channel_1.id}/memberships/me/follows"expect(response.status).to eq(200)@@ -39,7 +39,7 @@ describe Chat::Api::ChannelsCurrentUserMembershipController doFabricate(:direct_message_channel, users: [current_user, other_user_1, other_user_2])end- it "works" do+ it "unfollows the multi-user direct message channel" dodelete "/chat/api/channels/#{channel_1.id}/memberships/me/follows"expect(response.status).to eq(200)@@ -51,7 +51,7 @@ describe Chat::Api::ChannelsCurrentUserMembershipController dofab!(:other_user_1, :user)fab!(:channel_1) { Fabricate(:direct_message_channel, users: [current_user, other_user_1]) }- it "works" do+ it "unfollows the direct message channel" dodelete "/chat/api/channels/#{channel_1.id}/memberships/me/follows"expect(response.status).to eq(200)diff --git a/plugins/chat/spec/requests/chat/api/channels_drafts_controller_spec.rb b/plugins/chat/spec/requests/chat/api/channels_drafts_controller_spec.rbindex 6664feccd37..bc092862730 100644--- a/plugins/chat/spec/requests/chat/api/channels_drafts_controller_spec.rb+++ b/plugins/chat/spec/requests/chat/api/channels_drafts_controller_spec.rb@@ -13,7 +13,7 @@ RSpec.describe Chat::Api::ChannelsDraftsController dodescribe "#create" dodescribe "success" do- it "works" do+ it "creates the draft" dopost "/chat/api/channels/#{channel_1.id}/drafts", params: { data: { message: "a" } }expect(response.status).to eq(200)diff --git a/plugins/chat/spec/requests/chat/api/channels_invites_controller_spec.rb b/plugins/chat/spec/requests/chat/api/channels_invites_controller_spec.rbindex d4ca0c36f7d..c8bade24d92 100644--- a/plugins/chat/spec/requests/chat/api/channels_invites_controller_spec.rb+++ b/plugins/chat/spec/requests/chat/api/channels_invites_controller_spec.rb@@ -15,7 +15,7 @@ RSpec.describe Chat::Api::ChannelsInvitesController dodescribe "create" dodescribe "success" do- it "works" do+ it "notifies the invited users" doexpect {post "/chat/api/channels/#{channel_1.id}/invites?user_ids=#{user_1.id},#{user_2.id}"}.to change {@@ -42,7 +42,7 @@ RSpec.describe Chat::Api::ChannelsInvitesController dodescribe "message_id param" dofab!(:message_1) { Fabricate(:chat_message, chat_channel: channel_1) }- it "works" do+ it "includes the message in each notification" dopost "/chat/api/channels/#{channel_1.id}/invites?user_ids=#{user_1.id},#{user_2.id}&message_id=#{message_1.id}"expect(JSON.parse(Notification.last.data)["chat_message_id"]).to eq(message_1.id)diff --git a/plugins/chat/spec/requests/chat/api/channels_memberships_controller_spec.rb b/plugins/chat/spec/requests/chat/api/channels_memberships_controller_spec.rbindex c578bec431d..1d55bc3b095 100644--- a/plugins/chat/spec/requests/chat/api/channels_memberships_controller_spec.rb+++ b/plugins/chat/spec/requests/chat/api/channels_memberships_controller_spec.rb@@ -42,7 +42,7 @@ RSpec.describe Chat::Api::ChannelsMembershipsController dodescribe "#create" dodescribe "success" do- it "works" do+ it "adds the requested user to the channel" doadd_users_to_channel(current_user, channel_1)post "/chat/api/channels/#{channel_1.id}/memberships",params: {@@ -88,7 +88,7 @@ RSpec.describe Chat::Api::ChannelsMembershipsController dolet(:current_user) { Fabricate(:admin) }describe "success" do- it "works" do+ it "removes the other user's membership" dodelete "/chat/api/channels/#{channel_1.id}/memberships/#{other_user.id}"expect(response.status).to eq(200)diff --git a/plugins/chat/spec/requests/chat/api/channels_messages_flags_controller_spec.rb b/plugins/chat/spec/requests/chat/api/channels_messages_flags_controller_spec.rbindex a72622d9afd..3974de9adf4 100644--- a/plugins/chat/spec/requests/chat/api/channels_messages_flags_controller_spec.rb+++ b/plugins/chat/spec/requests/chat/api/channels_messages_flags_controller_spec.rb@@ -35,7 +35,7 @@ RSpec.describe Chat::Api::ChannelsMessagesFlagsController doenddescribe "success" do- it "works" do+ it "flags the message" dopost "/chat/api/channels/#{message_1.chat_channel.id}/messages/#{message_1.id}/flags",params: paramsdiff --git a/plugins/chat/spec/requests/chat/api/channels_read_controller_spec.rb b/plugins/chat/spec/requests/chat/api/channels_read_controller_spec.rbindex 85bc9d0b5d1..bf99ad395a2 100644--- a/plugins/chat/spec/requests/chat/api/channels_read_controller_spec.rb+++ b/plugins/chat/spec/requests/chat/api/channels_read_controller_spec.rb@@ -58,7 +58,7 @@ RSpec.describe Chat::Api::ChannelsReadController docontext "when message_id refers to deleted message" dobefore { message_1.trash!(Discourse.system_user) }- it "works" do+ it "accepts the last read message update" doput "/chat/api/channels/#{chat_channel.id}/read?message_id=#{message_1.id}"expect(response.status).to eq(200)enddiff --git a/plugins/chat/spec/requests/chat/api/channels_threads_drafts_controller_spec.rb b/plugins/chat/spec/requests/chat/api/channels_threads_drafts_controller_spec.rbindex 5b402e5da04..d91002998f3 100644--- a/plugins/chat/spec/requests/chat/api/channels_threads_drafts_controller_spec.rb+++ b/plugins/chat/spec/requests/chat/api/channels_threads_drafts_controller_spec.rb@@ -14,7 +14,7 @@ RSpec.describe Chat::Api::ChannelsThreadsDraftsController dodescribe "#create" dodescribe "success" do- it "works" do+ it "saves the thread draft" dopost "/chat/api/channels/#{channel_1.id}/threads/#{thread_1.id}/drafts",params: {data: {diff --git a/plugins/chat/spec/requests/chat/api/current_user_threads_spec.rb b/plugins/chat/spec/requests/chat/api/current_user_threads_spec.rbindex c80fd071575..a6455045e3e 100644--- a/plugins/chat/spec/requests/chat/api/current_user_threads_spec.rb+++ b/plugins/chat/spec/requests/chat/api/current_user_threads_spec.rb@@ -20,7 +20,7 @@ describe Chat::Api::CurrentUserThreadsController do)end- it "works" do+ it "returns the current user's threads" doget "/chat/api/me/threads"expect(response).to have_http_status :okdiff --git a/plugins/chat/spec/requests/chat_controller_spec.rb b/plugins/chat/spec/requests/chat_controller_spec.rbindex 2ee529bca48..b15ce824460 100644--- a/plugins/chat/spec/requests/chat_controller_spec.rb+++ b/plugins/chat/spec/requests/chat_controller_spec.rb@@ -33,7 +33,7 @@ RSpec.describe Chat::ChatController dodescribe "#rebake" dofab!(:chat_message) { Fabricate(:chat_message, chat_channel: chat_channel, user: user) }- it "works" do+ it "rebakes the message" dosign_in(admin)put "/chat/#{chat_channel.id}/#{chat_message.id}/rebake.json"expect(response.status).to eq(200)diff --git a/plugins/chat/spec/serializer/chat/chat_message_serializer_spec.rb b/plugins/chat/spec/serializer/chat/chat_message_serializer_spec.rbindex f8b8e4d432a..ebbc4668683 100644--- a/plugins/chat/spec/serializer/chat/chat_message_serializer_spec.rb+++ b/plugins/chat/spec/serializer/chat/chat_message_serializer_spec.rb@@ -10,7 +10,7 @@ describe Chat::MessageSerializer dolet(:guardian) { Guardian.new(guardian_user) }- describe "#mentioned_users" do+ describe "#mentioned_users with a configured mention limit" doit "is limited by max_mentions_per_chat_message setting" doFabricate.times(2, :user_chat_mention, chat_message: message_1)SiteSetting.max_mentions_per_chat_message = 1@@ -284,7 +284,7 @@ describe Chat::MessageSerializer doendend- describe "#mentioned_users" do+ describe "#mentioned_users after a mentioned user is deleted" doit "doesn't fail if mentioned user was deleted" domentioned_user = Fabricate(:user)message =diff --git a/plugins/chat/spec/services/chat/create_thread_spec.rb b/plugins/chat/spec/services/chat/create_thread_spec.rbindex 3082e4f0576..dc6b36ffdcc 100644--- a/plugins/chat/spec/services/chat/create_thread_spec.rb+++ b/plugins/chat/spec/services/chat/create_thread_spec.rb@@ -159,7 +159,7 @@ RSpec.describe Chat::CreateThread doit { is_expected.to fail_a_policy(:threading_enabled_for_channel) }end- context "when original message is not found" do+ context "when the original message belongs to another channel" dofab!(:channel_2) { Fabricate(:chat_channel, threading_enabled: true) }before { params[:channel_id] = channel_2.id }@@ -167,7 +167,7 @@ RSpec.describe Chat::CreateThread doit { is_expected.to fail_to_find_a_model(:original_message) }end- context "when original message is not found" do+ context "when the original message has been destroyed" dobefore { message_1.destroy! }it { is_expected.to fail_to_find_a_model(:original_message) }diff --git a/plugins/chat/spec/services/chat/update_user_thread_last_read_spec.rb b/plugins/chat/spec/services/chat/update_user_thread_last_read_spec.rbindex 2b183e4ff36..3cf9895483c 100644--- a/plugins/chat/spec/services/chat/update_user_thread_last_read_spec.rb+++ b/plugins/chat/spec/services/chat/update_user_thread_last_read_spec.rb@@ -76,7 +76,7 @@ RSpec.describe Chat::UpdateUserThreadLastRead doendcontext "when the message doesn’t exist" do- it "fails" do+ it "fails to find the message" doparams[:message_id] = 999is_expected.to fail_to_find_a_model(:message)enddiff --git a/plugins/chat/spec/system/archive_channel_spec.rb b/plugins/chat/spec/system/archive_channel_spec.rbindex 3a306de9219..fdd1a7ddb2f 100644--- a/plugins/chat/spec/system/archive_channel_spec.rb+++ b/plugins/chat/spec/system/archive_channel_spec.rb@@ -53,7 +53,7 @@ RSpec.describe "Archive channel" doendcontext "when archiving" do- it "works" do+ it "archives the channel and creates a topic" doSiteSetting.tagging_enabled = truetag = Fabricate(:tag, name: "archived")Jobs.run_immediately!diff --git a/plugins/chat/spec/system/browse_page_spec.rb b/plugins/chat/spec/system/browse_page_spec.rbindex 26019b1968d..89d7560742e 100644--- a/plugins/chat/spec/system/browse_page_spec.rb+++ b/plugins/chat/spec/system/browse_page_spec.rb@@ -130,7 +130,7 @@ RSpec.describe "Browse page" docontext "when loading more" dobefore { 25.times { Fabricate(:chat_channel, status: :open) } }- it "works" do+ it "loads the remaining channels" dochat_page.visit_browse(:all)scroll_to(find(".chat-channel-card:last-child"))diff --git a/plugins/chat/spec/system/chat_composer_spec.rb b/plugins/chat/spec/system/chat_composer_spec.rbindex 10c0b9f60b5..35161d2ce75 100644--- a/plugins/chat/spec/system/chat_composer_spec.rb+++ b/plugins/chat/spec/system/chat_composer_spec.rb@@ -233,7 +233,7 @@ RSpec.describe "Chat composer" docontext "when posting a message with length equal to minimum length" dobefore { SiteSetting.chat_minimum_message_length = 1 }- it "works" do+ it "sends the minimum-length message" dochat_page.visit_channel(channel_1)channel_page.send_message("1")diff --git a/plugins/chat/spec/system/message_thread_indicator_spec.rb b/plugins/chat/spec/system/message_thread_indicator_spec.rbindex 0ff7008b0d6..44ea32f1e15 100644--- a/plugins/chat/spec/system/message_thread_indicator_spec.rb+++ b/plugins/chat/spec/system/message_thread_indicator_spec.rb@@ -56,7 +56,7 @@ describe "Thread indicator for chat messages" do)end- it "it shows the reply count but no participant avatars when there is only one participant" do+ it "shows the reply count but no participant avatars when there is only one participant" dosingle_user_thread =chat_thread_chain_bootstrap(channel: channel, users: [current_user], messages_count: 3)diff --git a/plugins/chat/spec/system/reply_to_message/smoke_spec.rb b/plugins/chat/spec/system/reply_to_message/smoke_spec.rbindex 79407e14369..7a87a8b18eb 100644--- a/plugins/chat/spec/system/reply_to_message/smoke_spec.rb+++ b/plugins/chat/spec/system/reply_to_message/smoke_spec.rb@@ -19,7 +19,7 @@ RSpec.describe "Reply to message - smoke" doendcontext "when two users create a thread on the same message" do- it "works" do+ it "opens the same thread for both users" dosign_in(user_1)chat_page.visit_channel(channel_1)channel_page.reply_to(original_message)diff --git a/plugins/chat/spec/system/thread_list/full_page_spec.rb b/plugins/chat/spec/system/thread_list/full_page_spec.rbindex 8b56ba86724..48887e9d793 100644--- a/plugins/chat/spec/system/thread_list/full_page_spec.rb+++ b/plugins/chat/spec/system/thread_list/full_page_spec.rb@@ -31,7 +31,7 @@ describe "Thread list in side panel | full page" dobefore { chat_system_user_bootstrap(user: other_user, channel: channel) }- it "it shows threads in the channel even if the user is not tracking them" do+ it "shows threads in the channel even if the user is not tracking them" dothread_1 =Fabricate(:chat_thread,diff --git a/plugins/chat/spec/system/transcript_spec.rb b/plugins/chat/spec/system/transcript_spec.rbindex 828dfeaf6f4..92de99017cc 100644--- a/plugins/chat/spec/system/transcript_spec.rb+++ b/plugins/chat/spec/system/transcript_spec.rb@@ -94,7 +94,7 @@ RSpec.describe "Quoting chat message transcripts" domessage_1.rebake!end- it "works" do+ it "pastes a transcript with the onebox content" dochat_page.visit_channel(chat_channel_1)clip_text = copy_messages_to_clipboard(message_1)diff --git a/plugins/discourse-ai/spec/jobs/regular/digest_rag_upload_spec.rb b/plugins/discourse-ai/spec/jobs/regular/digest_rag_upload_spec.rbindex aab495124be..360b7b7d168 100644--- a/plugins/discourse-ai/spec/jobs/regular/digest_rag_upload_spec.rb+++ b/plugins/discourse-ai/spec/jobs/regular/digest_rag_upload_spec.rb@@ -36,7 +36,7 @@ describe Jobs::DigestRagUpload dodescribe "#execute" docontext "when processing an image upload" do- it "will reject the indexing if the site setting is not enabled" do+ it "rejects indexing if the site setting is disabled" doSiteSetting.ai_rag_images_enabled = falseexpect {diff --git a/plugins/discourse-ai/spec/lib/agents/tool_runner/http_spec.rb b/plugins/discourse-ai/spec/lib/agents/tool_runner/http_spec.rbindex ef33e5196c3..e079052f016 100644--- a/plugins/discourse-ai/spec/lib/agents/tool_runner/http_spec.rb+++ b/plugins/discourse-ai/spec/lib/agents/tool_runner/http_spec.rb@@ -190,7 +190,7 @@ RSpec.describe DiscourseAi::Agents::ToolRunner doexpect(result).to eq("Hello World")end- it "will not timeout on slow HTTP reqs" do+ it "does not time out on slow HTTP requests" doscript = <<~JSfunction invoke(params) {result = http.get("https://example.com/" + params.query,diff --git a/plugins/discourse-ai/spec/lib/agents/tools/google_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/google_spec.rbindex 3c361a494fc..b8d5b17b4b5 100644--- a/plugins/discourse-ai/spec/lib/agents/tools/google_spec.rb+++ b/plugins/discourse-ai/spec/lib/agents/tools/google_spec.rb@@ -15,7 +15,7 @@ RSpec.describe DiscourseAi::Agents::Tools::Google doenddescribe "#process" do- it "will not explode if there are no results" do+ it "returns safely when there are no results" dojson_text = { searchInformation: { totalResults: "0" } }.to_jsonstub_request(diff --git a/plugins/discourse-ai/spec/lib/completions/cancel_manager_spec.rb b/plugins/discourse-ai/spec/lib/completions/cancel_manager_spec.rbindex 784ec8d6065..cb3a1450766 100644--- a/plugins/discourse-ai/spec/lib/completions/cancel_manager_spec.rb+++ b/plugins/discourse-ai/spec/lib/completions/cancel_manager_spec.rb@@ -60,7 +60,7 @@ describe DiscourseAi::Completions::CancelManager dowaiter&.killend- it "should do nothing when cancel manager is already cancelled" do+ it "does nothing when the cancel manager is already cancelled" docancel_manager = DiscourseAi::Completions::CancelManager.newcancel_manager.cancel!@@ -75,7 +75,7 @@ describe DiscourseAi::Completions::CancelManager doexpect(result).to be_nilend- it "should be able to cancel a completion" do+ it "cancels a completion" do# Start an HTTP server that hangs indefinitelyserver = TCPServer.new("127.0.0.1", 0)port = server.addr[1]diff --git a/plugins/discourse-ai/spec/lib/completions/dialects/chat_gpt_spec.rb b/plugins/discourse-ai/spec/lib/completions/dialects/chat_gpt_spec.rbindex f57fa611108..5e76c111ca5 100644--- a/plugins/discourse-ai/spec/lib/completions/dialects/chat_gpt_spec.rb+++ b/plugins/discourse-ai/spec/lib/completions/dialects/chat_gpt_spec.rb@@ -20,7 +20,7 @@ RSpec.describe DiscourseAi::Completions::Dialects::ChatGpt doexpect(translated).to contain_exactly(*open_ai_version)end- it "will retain usernames for unicode usernames, correctly in mixed mode" do+ it "retains Unicode usernames correctly in mixed mode" doprompt =DiscourseAi::Completions::Prompt.new("You are a bot",diff --git a/plugins/discourse-ai/spec/lib/completions/dialects/dialect_spec.rb b/plugins/discourse-ai/spec/lib/completions/dialects/dialect_spec.rbindex c4b246ea74c..3d8ef933ad1 100644--- a/plugins/discourse-ai/spec/lib/completions/dialects/dialect_spec.rb+++ b/plugins/discourse-ai/spec/lib/completions/dialects/dialect_spec.rb@@ -87,7 +87,7 @@ RSpec.describe DiscourseAi::Completions::Dialects::Dialect dodescribe "#trim_messages" dolet(:five_token_msg) { "This represents five tokens." }- it "should trim tool messages if tool_calls are trimmed" do+ it "trims tool messages when tool calls are trimmed" doprompt = DiscourseAi::Completions::Prompt.new(five_token_msg)prompt.push(type: :user, content: five_token_msg)prompt.push(type: :tool_call, content: five_token_msg, id: 1)diff --git a/plugins/discourse-ai/spec/lib/completions/endpoints/anthropic_spec.rb b/plugins/discourse-ai/spec/lib/completions/endpoints/anthropic_spec.rbindex baaa29b8c6a..963a20e9773 100644--- a/plugins/discourse-ai/spec/lib/completions/endpoints/anthropic_spec.rb+++ b/plugins/discourse-ai/spec/lib/completions/endpoints/anthropic_spec.rb@@ -1271,7 +1271,7 @@ RSpec.describe DiscourseAi::Completions::Endpoints::Anthropic doenddescribe "max output tokens" do- it "it respects max output tokens supplied to model unconditionally, even with thinking" do+ it "respects the model's maximum output tokens even with thinking enabled" domodel.update!(provider_params: {enable_reasoning: true,diff --git a/plugins/discourse-ai/spec/lib/completions/endpoints/aws_bedrock_spec.rb b/plugins/discourse-ai/spec/lib/completions/endpoints/aws_bedrock_spec.rbindex 3422cfcc1f6..b45cda08041 100644--- a/plugins/discourse-ai/spec/lib/completions/endpoints/aws_bedrock_spec.rb+++ b/plugins/discourse-ai/spec/lib/completions/endpoints/aws_bedrock_spec.rb@@ -29,7 +29,7 @@ RSpec.describe DiscourseAi::Completions::Endpoints::AwsBedrock dobefore { enable_current_plugin }- it "should provide accurate max token count" do+ it "provides an accurate maximum token count" doprompt = DiscourseAi::Completions::Prompt.new("hello")dialect = DiscourseAi::Completions::Dialects::Claude.new(prompt, model)endpoint = DiscourseAi::Completions::Endpoints::AwsBedrock.new(model)diff --git a/plugins/discourse-ai/spec/lib/completions/endpoints/nova_spec.rb b/plugins/discourse-ai/spec/lib/completions/endpoints/nova_spec.rbindex 8c25f43d9df..903d7075970 100644--- a/plugins/discourse-ai/spec/lib/completions/endpoints/nova_spec.rb+++ b/plugins/discourse-ai/spec/lib/completions/endpoints/nova_spec.rb@@ -29,7 +29,7 @@ RSpec.describe DiscourseAi::Completions::Endpoints::AwsBedrock dobefore { enable_current_plugin }- it "should be able to make a simple request" do+ it "makes a simple request" doproxy = DiscourseAi::Completions::Llm.proxy(nova_model)content = {@@ -62,7 +62,7 @@ RSpec.describe DiscourseAi::Completions::Endpoints::AwsBedrock doexpect(log.response_tokens).to eq(119)end- it "should be able to make a streaming request" do+ it "makes a streaming request" domessages =[{ messageStart: { role: "assistant" } },@@ -102,7 +102,7 @@ RSpec.describe DiscourseAi::Completions::Endpoints::AwsBedrock doexpect(log.response_tokens).to eq(18)end- it "should support native streaming tool calls" do+ it "supports native streaming tool calls" do#model.provider_params["disable_native_tools"] = true#model.save!diff --git a/plugins/discourse-ai/spec/lib/completions/endpoints/open_ai_spec.rb b/plugins/discourse-ai/spec/lib/completions/endpoints/open_ai_spec.rbindex 7561f8a062d..5cd89ee4493 100644--- a/plugins/discourse-ai/spec/lib/completions/endpoints/open_ai_spec.rb+++ b/plugins/discourse-ai/spec/lib/completions/endpoints/open_ai_spec.rb@@ -836,7 +836,7 @@ RSpec.describe DiscourseAi::Completions::Endpoints::OpenAi docompliance.streaming_mode_simple_prompt(open_ai_mock)end- it "will automatically recover from a bad payload" do+ it "recovers automatically from a bad payload" docalled = false# this should not happen, but lets ensure nothing bad happensdiff --git a/plugins/discourse-ai/spec/lib/completions/json_stream_decoder_spec.rb b/plugins/discourse-ai/spec/lib/completions/json_stream_decoder_spec.rbindex 3dbb9ddcf4a..5d4893907fc 100644--- a/plugins/discourse-ai/spec/lib/completions/json_stream_decoder_spec.rb+++ b/plugins/discourse-ai/spec/lib/completions/json_stream_decoder_spec.rb@@ -5,12 +5,12 @@ describe DiscourseAi::Completions::JsonStreamDecoder dobefore { enable_current_plugin }- it "should be able to parse simple messages" do+ it "parses simple messages" doresult = decoder << "data: #{{ hello: "world" }.to_json}"expect(result).to eq([{ hello: "world" }])end- it "should handle anthropic mixed stlye streams" do+ it "handles Anthropic mixed-style streams" dostream = <<~TEXT.split("|")event: |message_start|data: |{"hel|lo": "world"}|@@ -30,7 +30,7 @@ describe DiscourseAi::Completions::JsonStreamDecoder doexpect(results.flatten.compact).to eq([{ hello: "world" }, { foo: "bar" }, { baz: "qux" }])end- it "should be able to handle complex overlaps" do+ it "handles complex overlaps" dostream = <<~TEXT.split("|")data: |{"hel|lo": "world"}diff --git a/plugins/discourse-ai/spec/lib/completions/prompt_messages_builder_spec.rb b/plugins/discourse-ai/spec/lib/completions/prompt_messages_builder_spec.rbindex 61b8b04f210..79fcaf14204 100644--- a/plugins/discourse-ai/spec/lib/completions/prompt_messages_builder_spec.rb+++ b/plugins/discourse-ai/spec/lib/completions/prompt_messages_builder_spec.rb@@ -71,14 +71,14 @@ describe DiscourseAi::Completions::PromptMessagesBuilder doexpect(content[3]).to eq({ upload_id: 2 })end- it "should allow merging user messages" do+ it "merges user messages" dobuilder.push(type: :user, content: "Hello", id: "Alice")builder.push(type: :user, content: "World", id: "Bob")expect(builder.to_a).to eq([{ type: :user, content: "Alice: Hello\nBob: World" }])end- it "should allow adding uploads" do+ it "adds uploads" dobuilder.push(type: :user, content: "Hello", name: "Alice", upload_ids: [1, 2])expect(builder.to_a).to eq(@@ -86,7 +86,7 @@ describe DiscourseAi::Completions::PromptMessagesBuilder do)end- it "should support function calls" do+ it "supports function calls" dobuilder.push(type: :user, content: "Echo 123 please", name: "Alice")builder.push(type: :tool_call, content: "echo(123)", name: "echo", id: 1)builder.push(type: :tool, content: "123", name: "echo", id: 1)@@ -100,7 +100,7 @@ describe DiscourseAi::Completions::PromptMessagesBuilder doexpect(builder.to_a).to eq(expected)end- it "should drop a tool call if it is not followed by tool" do+ it "drops a tool call that is not followed by a tool result" dobuilder.push(type: :user, content: "Echo 123 please", id: "Alice")builder.push(type: :tool_call, content: "echo(123)", name: "echo", id: 1)builder.push(type: :user, content: "OK", id: "James")@@ -109,7 +109,7 @@ describe DiscourseAi::Completions::PromptMessagesBuilder doexpect(builder.to_a).to eq(expected)end- it "should format messages for topic style" do+ it "formats messages for topic style" do# Create a topic with tagstopic = Fabricate(:topic, title: "This is an Example Topic")@@ -752,7 +752,7 @@ describe DiscourseAi::Completions::PromptMessagesBuilder do)end- it "handles uploads correctly in topic style messages (and times)" do+ it "combines uploads and timestamps in topic-style messages" dofreeze_time 32.days.ago# Use Discourse's upload format in the post raw content@@ -962,7 +962,7 @@ describe DiscourseAi::Completions::PromptMessagesBuilder do)end- it "handles uploads correctly in topic style messages (and times)" do+ it "retains upload Markdown while attaching uploads to topic-style messages" dofreeze_time 32.days.ago# Use Discourse's upload format in the post raw contentdiff --git a/plugins/discourse-ai/spec/lib/completions/xml_tag_stripper_spec.rb b/plugins/discourse-ai/spec/lib/completions/xml_tag_stripper_spec.rbindex a7eabef2307..6ce2985cd91 100644--- a/plugins/discourse-ai/spec/lib/completions/xml_tag_stripper_spec.rb+++ b/plugins/discourse-ai/spec/lib/completions/xml_tag_stripper_spec.rb@@ -5,7 +5,7 @@ describe DiscourseAi::Completions::PromptMessagesBuilder dobefore { enable_current_plugin }- it "should strip tags correctly in simple cases" do+ it "strips tags correctly in simple cases" doresult = tag_stripper << "x<thinking>hello</thinki"expect(result).to eq("x")diff --git a/plugins/discourse-ai/spec/lib/discourse_automation/llm_triage_spec.rb b/plugins/discourse-ai/spec/lib/discourse_automation/llm_triage_spec.rbindex 49222a8f14d..626e2fe6bdc 100644--- a/plugins/discourse-ai/spec/lib/discourse_automation/llm_triage_spec.rb+++ b/plugins/discourse-ai/spec/lib/discourse_automation/llm_triage_spec.rb@@ -109,7 +109,7 @@ describe DiscourseAi::Automation::LlmTriage do# nothing should happen, no classification, its a PMend- it "will triage PMs if automation allows it" do+ it "triages PMs if automation allows it" do# needs to be admin or it will not be able to just step in to# PMreply_user.update!(admin: true)diff --git a/plugins/discourse-ai/spec/lib/modules/ai_bot/entry_point_spec.rb b/plugins/discourse-ai/spec/lib/modules/ai_bot/entry_point_spec.rbindex 1213a3c30ac..a447868e2f8 100644--- a/plugins/discourse-ai/spec/lib/modules/ai_bot/entry_point_spec.rb+++ b/plugins/discourse-ai/spec/lib/modules/ai_bot/entry_point_spec.rb@@ -186,7 +186,7 @@ describe DiscourseAi::AiBot::EntryPoint doendend- it "will include ai_search_discoveries field in the user_option if discover agent is enabled" do+ it "includes ai_search_discoveries in user_option if the discover agent is enabled" douser = Fabricate(:user)group = Fabricate(:group)group.add(user)diff --git a/plugins/discourse-ai/spec/lib/modules/ai_bot/playground_spec.rb b/plugins/discourse-ai/spec/lib/modules/ai_bot/playground_spec.rbindex b7dd5e52afb..6656b069f64 100644--- a/plugins/discourse-ai/spec/lib/modules/ai_bot/playground_spec.rb+++ b/plugins/discourse-ai/spec/lib/modules/ai_bot/playground_spec.rb@@ -69,7 +69,7 @@ RSpec.describe DiscourseAi::AiBot::Playground doAiAgent.agent_cache.flush!end- describe "#title_playground" do+ describe "#title_playground with a multipart model response" doit "updates the topic title when the LLM returns multiple text blocks" doDiscourseAi::Completions::Llm.with_prepared_responses([["A concise ", "conversation title"]],@@ -416,7 +416,7 @@ RSpec.describe DiscourseAi::AiBot::Playground doagent.update!(allow_chat_channel_mentions: true, default_llm_id: opus_model.id)end- it "should behave in a sane way when threading is enabled" do+ it "creates the reply correctly when threading is enabled" dochannel.update!(threading_enabled: true)message =@@ -490,7 +490,7 @@ RSpec.describe DiscourseAi::AiBot::Playground doexpect(reply.message).to eq("world")end- it "should reply to a mention if properly enabled" do+ it "replies to a mention when enabled" doprompts = nilChatSDK::Message.create(@@ -1511,7 +1511,7 @@ RSpec.describe DiscourseAi::AiBot::Playground dodescribe "#canceling a completions" doafter { DiscourseAi::AiBot::PostStreamer.on_callback = nil }- it "should be able to cancel a completion halfway through" do+ it "cancels a completion halfway through" dobody = <<~STRING.stripevent: message_startdata: {"type": "message_start", "message": {"id": "msg_1nZdL29xx5MUA1yADyHTEsnR8uuvGzszyY", "type": "message", "role": "assistant", "content": [], "model": "claude-3-opus-20240229", "stop_reason": null, "stop_sequence": null, "usage": {"input_tokens": 25, "output_tokens": 1}}}diff --git a/plugins/discourse-ai/spec/lib/modules/ai_helper/entry_point_spec.rb b/plugins/discourse-ai/spec/lib/modules/ai_helper/entry_point_spec.rbindex 89c281f39f2..423795fed49 100644--- a/plugins/discourse-ai/spec/lib/modules/ai_helper/entry_point_spec.rb+++ b/plugins/discourse-ai/spec/lib/modules/ai_helper/entry_point_spec.rb@@ -6,7 +6,7 @@ describe DiscourseAi::AiHelper::EntryPoint dobefore { enable_current_plugin }- it "will correctly localize available prompts" do+ it "localizes available prompts" doassign_fake_provider_to(:ai_default_llm_model)SiteSetting.default_locale = "en"SiteSetting.allow_user_locale = truediff --git a/plugins/discourse-ai/spec/lib/modules/automation/report_context_generator_spec.rb b/plugins/discourse-ai/spec/lib/modules/automation/report_context_generator_spec.rbindex ee1094e9b7e..da51d131a8f 100644--- a/plugins/discourse-ai/spec/lib/modules/automation/report_context_generator_spec.rb+++ b/plugins/discourse-ai/spec/lib/modules/automation/report_context_generator_spec.rb@@ -46,7 +46,7 @@ module DiscourseAibefore { enable_current_plugin }if defined?(DiscourseSolved)- it "will correctly denote solved topics" do+ it "marks solved topics" doFabricate(:solved_topic, topic: topic_with_likes, answer_post: post_with_likes2)context = ReportContextGenerator.generate(start_date: 1.day.ago, duration: 2.days)@@ -56,7 +56,7 @@ module DiscourseAiendend- it "will exclude non visible topics" do+ it "excludes invisible topics" dopost_with_likes3.topic.update(visible: false)context = ReportContextGenerator.generate(start_date: 1.day.ago, duration: 2.days)diff --git a/plugins/discourse-ai/spec/lib/utils/diff_utils/hunk_diff_spec.rb b/plugins/discourse-ai/spec/lib/utils/diff_utils/hunk_diff_spec.rbindex 5739459a13e..888307f9f68 100644--- a/plugins/discourse-ai/spec/lib/utils/diff_utils/hunk_diff_spec.rb+++ b/plugins/discourse-ai/spec/lib/utils/diff_utils/hunk_diff_spec.rb@@ -184,7 +184,7 @@ RSpec.describe DiscourseAi::Utils::DiffUtils::HunkDiff dolet(:original_text) { "hello" }let(:diff) { "world" }- it "will append to the end" do+ it "appends to the end" doexpect(apply_hunk).to eq("hello\nworld")endenddiff --git a/plugins/discourse-ai/spec/models/ai_tool_spec.rb b/plugins/discourse-ai/spec/models/ai_tool_spec.rbindex fad5cf30e33..739b9981bd6 100644--- a/plugins/discourse-ai/spec/models/ai_tool_spec.rb+++ b/plugins/discourse-ai/spec/models/ai_tool_spec.rb@@ -30,7 +30,7 @@ RSpec.describe AiTool dobefore { enable_current_plugin }- it "it can run a basic tool" do+ it "runs a basic tool" dotool = create_toolexpect(tool.signature).to eq(diff --git a/plugins/discourse-ai/spec/models/llm_model_spec.rb b/plugins/discourse-ai/spec/models/llm_model_spec.rbindex a19f1007e56..4a800397cf1 100644--- a/plugins/discourse-ai/spec/models/llm_model_spec.rb+++ b/plugins/discourse-ai/spec/models/llm_model_spec.rb@@ -8,7 +8,7 @@ RSpec.describe LlmModel dobefore { ENV["DISCOURSE_AI_SEEDED_LLM_API_KEY_2"] = "blabla" }- it "should use environment variable over database value if seeded LLM" do+ it "uses the environment variable instead of the database value for a seeded LLM" doexpect(llm_model.api_key).to eq("blabla")endenddiff --git a/plugins/discourse-ai/spec/requests/admin/ai_agents_controller_spec.rb b/plugins/discourse-ai/spec/requests/admin/ai_agents_controller_spec.rbindex 694d9ddb2dc..9b3890ee895 100644--- a/plugins/discourse-ai/spec/requests/admin/ai_agents_controller_spec.rb+++ b/plugins/discourse-ai/spec/requests/admin/ai_agents_controller_spec.rb@@ -935,7 +935,7 @@ RSpec.describe DiscourseAi::Admin::AiAgentsController doendend- describe "DELETE #destroy" do+ describe "DELETE #destroy with a parent agent" doit "removes the deleted agent from parent subagent IDs" dochild = Fabricate(:ai_agent)parent = Fabricate(:ai_agent, subagent_ids: [child.id])diff --git a/plugins/discourse-ai/spec/requests/admin/rag_document_fragments_controller_spec.rb b/plugins/discourse-ai/spec/requests/admin/rag_document_fragments_controller_spec.rbindex 7bfe371ff98..022f0a0d4e9 100644--- a/plugins/discourse-ai/spec/requests/admin/rag_document_fragments_controller_spec.rb+++ b/plugins/discourse-ai/spec/requests/admin/rag_document_fragments_controller_spec.rb@@ -34,7 +34,7 @@ RSpec.describe DiscourseAi::Admin::RagDocumentFragmentsController dotempfileend- it "works" do+ it "uploads the document fragment file" dopost "/admin/plugins/discourse-ai/rag-document-fragments/files/upload.json",params: {file: Rack::Test::UploadedFile.new(file_from_fixtures("spec.txt", "md")),diff --git a/plugins/discourse-ai/spec/requests/embeddings/embeddings_controller_spec.rb b/plugins/discourse-ai/spec/requests/embeddings/embeddings_controller_spec.rbindex 3f0b8bdb0d3..42faa16a925 100644--- a/plugins/discourse-ai/spec/requests/embeddings/embeddings_controller_spec.rb+++ b/plugins/discourse-ai/spec/requests/embeddings/embeddings_controller_spec.rb@@ -69,7 +69,7 @@ describe DiscourseAi::Embeddings::EmbeddingsController docontext "when rate limiting is enabled" dobefore { RateLimiter.enable }- it "will rate limit correctly" do+ it "rate limits repeated requests" dostub_const(described_class, :MAX_HYDE_SEARCHES_PER_MINUTE, 1) dostub_const(described_class, :MAX_SEARCHES_PER_MINUTE, 2) doquery = "test #{SecureRandom.hex}"diff --git a/plugins/discourse-ai/spec/requests/topic_spec.rb b/plugins/discourse-ai/spec/requests/topic_spec.rbindex abe3a6bb46d..3b5af62eade 100644--- a/plugins/discourse-ai/spec/requests/topic_spec.rb+++ b/plugins/discourse-ai/spec/requests/topic_spec.rb@@ -20,7 +20,7 @@ describe ::TopicsController doendcontext "when a user is logged on" do- it "includes related topics in payload when configured" do+ it "includes related topics for anonymous and logged-in requests" doget("#{topic.relative_url}.json")expect(response.status).to eq(200)json = response.parsed_body@@ -37,7 +37,7 @@ describe ::TopicsController doexpect(json["related_topics"].length).to eq(2)end- it "includes related topics in payload when configured" do+ it "includes related topics alongside lazy-loaded categories" doSiteSetting.lazy_load_categories_groups = "#{Group::AUTO_GROUPS[:anonymous_users]}"category = Fabricate(:category)topic.update!(category: category)diff --git a/plugins/discourse-ai/spec/system/admin_ai_agent_spec.rb b/plugins/discourse-ai/spec/system/admin_ai_agent_spec.rbindex 254b0e4c58e..234d4469a73 100644--- a/plugins/discourse-ai/spec/system/admin_ai_agent_spec.rb+++ b/plugins/discourse-ai/spec/system/admin_ai_agent_spec.rb@@ -96,7 +96,7 @@ RSpec.describe "Admin AI agent configuration" doexpect(parent.reload.subagent_ids).to eq([])end- it "will not allow deletion or editing of system agents" do+ it "prevents deletion or editing of system agents" dovisit "/admin/plugins/discourse-ai/ai-agents/#{DiscourseAi::Agents::Agent.system_agents.values.first}/edit"expect(page).not_to have_selector(".ai-agent-editor__delete")expect(form.field("system_prompt")).to be_disabled@@ -215,7 +215,7 @@ RSpec.describe "Admin AI agent configuration" doexpect(agent_editor_page).to have_floating_actionsend- it "will enable agent right away when you click on enable but does not save side effects" do+ it "enables the agent immediately without saving other edits" doagent = Fabricate(:ai_agent, enabled: false)visit "/admin/plugins/discourse-ai/ai-agents/#{agent.id}/edit"diff --git a/plugins/discourse-ai/spec/system/ai_helper/ai_composer_helper_spec.rb b/plugins/discourse-ai/spec/system/ai_helper/ai_composer_helper_spec.rbindex d03da1fa78d..857e72272b3 100644--- a/plugins/discourse-ai/spec/system/ai_helper/ai_composer_helper_spec.rb+++ b/plugins/discourse-ai/spec/system/ai_helper/ai_composer_helper_spec.rb@@ -565,7 +565,7 @@ RSpec.describe "AI Composer helper" doendcontext "when triggering composer AI helper", mobile: true do- it "should close the composer helper before showing the diff modal" do+ it "closes the composer helper before showing the diff modal" dovisit("/latest")page.find("#create-topic").clickcomposer.fill_content(input)diff --git a/plugins/discourse-ai/spec/system/ai_helper/ai_post_helper_spec.rb b/plugins/discourse-ai/spec/system/ai_helper/ai_post_helper_spec.rbindex 2299bd31518..ec01fda6bab 100644--- a/plugins/discourse-ai/spec/system/ai_helper/ai_post_helper_spec.rb+++ b/plugins/discourse-ai/spec/system/ai_helper/ai_post_helper_spec.rb@@ -62,7 +62,7 @@ RSpec.describe "AI Post helper" doexpect(post_ai_helper).to have_post_ai_helper_optionsend- it "should not have the mobile post AI helper" do+ it "does not display the mobile post AI helper" doselect_post_text(post)post_ai_helper.click_ai_buttonexpect(post_ai_helper).to have_no_mobile_post_ai_helper@@ -181,7 +181,7 @@ RSpec.describe "AI Post helper" doendcontext "when triggering post AI helper on mobile", mobile: true do- it "should use the bottom modal instead of the popup menu" do+ it "uses the bottom modal instead of the popup menu" doselect_post_text(post)post_ai_helper.click_ai_buttonexpect(post_ai_helper).to have_mobile_post_ai_helperdiff --git a/plugins/discourse-ai/spec/system/ai_user_preferences_spec.rb b/plugins/discourse-ai/spec/system/ai_user_preferences_spec.rbindex 2ba72706db9..3e6ed03238e 100644--- a/plugins/discourse-ai/spec/system/ai_user_preferences_spec.rb+++ b/plugins/discourse-ai/spec/system/ai_user_preferences_spec.rb@@ -21,7 +21,7 @@ describe "User AI preferences" docontext "when discoveries are enabled" dobefore { enable_legacy_discover }- it "should have the setting present in the user preferences page" do+ it "shows the setting on the user preferences page" douser_preferences_ai_page.visit(user)expect(user_preferences_ai_page).to have_ai_preference("pref-ai-search-discoveries")end@@ -52,7 +52,7 @@ describe "User AI preferences" docontext "when discoveries are disabled" dobefore { SiteSetting.ai_discover_enabled = false }- it "should not have the setting present in the user preferences page" do+ it "hides the setting from the user preferences page" douser_preferences_ai_page.visit(user)expect(user_preferences_ai_page).to have_no_ai_preference("pref-ai-search-discoveries")enddiff --git a/plugins/discourse-apple-auth/spec/requests/auth_apple_spec.rb b/plugins/discourse-apple-auth/spec/requests/auth_apple_spec.rbindex 44868d2d9f9..a9d81da5148 100644--- a/plugins/discourse-apple-auth/spec/requests/auth_apple_spec.rb+++ b/plugins/discourse-apple-auth/spec/requests/auth_apple_spec.rb@@ -111,7 +111,7 @@ describe "sign in with apple" doendend- it "works" do+ it "authenticates the Apple callback payload" do# Like an OAuth2 callback, but with some apple-specific stuff per# https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js/incorporating_sign_in_with_apple_into_other_platformsget "/auth/apple/callback",diff --git a/plugins/discourse-assign/spec/components/topic_query_spec.rb b/plugins/discourse-assign/spec/components/topic_query_spec.rbindex f58a970042f..90aae656356 100644--- a/plugins/discourse-assign/spec/components/topic_query_spec.rb+++ b/plugins/discourse-assign/spec/components/topic_query_spec.rb@@ -196,7 +196,7 @@ describe TopicQuery dogroup_assigned_topicend- it "should return the right topics" do+ it "returns messages assigned to the user or their group" doexpect(TopicQuery.new(user).list_private_messages_assigned(user).topics).to contain_exactly(assigned_topic,group_assigned_topic,diff --git a/plugins/discourse-assign/spec/jobs/regular/remind_user_spec.rb b/plugins/discourse-assign/spec/jobs/regular/remind_user_spec.rbindex 8e6869ba747..bcd6908c14b 100644--- a/plugins/discourse-assign/spec/jobs/regular/remind_user_spec.rb+++ b/plugins/discourse-assign/spec/jobs/regular/remind_user_spec.rb@@ -2,7 +2,7 @@RSpec.describe Jobs::RemindUser dodescribe "#execute" do- it "should raise the right error when user_id is invalid" do+ it "raises InvalidParameters when user_id is missing" doexpect do described_class.new.execute({}) end.to raise_error(Discourse::InvalidParameters)endenddiff --git a/plugins/discourse-assign/spec/jobs/regular/unassign_notification_spec.rb b/plugins/discourse-assign/spec/jobs/regular/unassign_notification_spec.rbindex c3a9afea8ec..42c13c89b54 100644--- a/plugins/discourse-assign/spec/jobs/regular/unassign_notification_spec.rb+++ b/plugins/discourse-assign/spec/jobs/regular/unassign_notification_spec.rb@@ -38,7 +38,7 @@ RSpec.describe Jobs::UnassignNotification do}.to change { user2.notifications.count }.by(-1)end- it "should publish the right message when private message" do+ it "publishes the notification for a private message" douser = pm.allowed_users.firstassign_allowed_group.add(user)diff --git a/plugins/discourse-assign/spec/lib/assigner_spec.rb b/plugins/discourse-assign/spec/lib/assigner_spec.rbindex ca5a3d301cb..ddcb886dfc5 100644--- a/plugins/discourse-assign/spec/lib/assigner_spec.rb+++ b/plugins/discourse-assign/spec/lib/assigner_spec.rb@@ -1079,7 +1079,7 @@ RSpec.describe Assigner do}end- it "doesn't send an email if the assigner and assignee are not different" do+ it "doesn't send an email when assigning a user to themself" doSiteSetting.assign_mailer = AssignMailer.levels[:different_users]expect { described_class.new(topic, moderator).assign(moderator_2) }.to change {@@ -1087,7 +1087,7 @@ RSpec.describe Assigner do}.by(1)end- it "doesn't send an email if the assigner and assignee are not different" do+ it "doesn't send an email when assigning a group to one of its members" doSiteSetting.assign_mailer = AssignMailer.levels[:different_users]expect { described_class.new(topic, moderator).assign(moderator) }.not_to change {diff --git a/plugins/discourse-assign/spec/requests/list_controller_spec.rb b/plugins/discourse-assign/spec/requests/list_controller_spec.rbindex 2a196a334e0..921172d9fe3 100644--- a/plugins/discourse-assign/spec/requests/list_controller_spec.rb+++ b/plugins/discourse-assign/spec/requests/list_controller_spec.rb@@ -293,7 +293,7 @@ describe ListController doafter { SearchIndexer.disable }- it "returns topics as per filter for #group_topics_assigned" do+ it "filters group-assigned topics by title" dotopic1.title = "QUnit testing is love"topic2.title = "RSpec testing is too fun"topic3.title = "Testing is main part of programming"@@ -327,7 +327,7 @@ describe ListController do)end- it "returns topics as per filter for #group_topics_assigned" do+ it "filters the user's assigned messages by title" dotopic1.title = "QUnit testing is love"topic2.title = "RSpec testing is too fun"topic3.title = "Testing is main part of programming"@@ -415,7 +415,7 @@ describe ListController dofab!(:post_2) { Fabricate(:post, topic: topic_2) }fab!(:post_3) { Fabricate(:post, topic: topic_3) }- describe "when user cannot assign" do+ describe "when user cannot assign and filters by username" doit "ignores the assign filter" doassign_allowed_group.add(user)@@ -566,7 +566,7 @@ describe ListController doendend- describe "when user cannot assign" do+ describe "when user cannot assign and filters by assignment status" doit "ignores the assigned:* filter" doassign_allowed_group.add(admin)diff --git a/plugins/discourse-assign/spec/serializers/topic_list_serializer_spec.rb b/plugins/discourse-assign/spec/serializers/topic_list_serializer_spec.rbindex 37499f0de7f..d6ecebd8161 100644--- a/plugins/discourse-assign/spec/serializers/topic_list_serializer_spec.rb+++ b/plugins/discourse-assign/spec/serializers/topic_list_serializer_spec.rb@@ -43,7 +43,7 @@ RSpec.describe TopicListSerializer dobefore { assigned_topic }- it "should include right attribute" do+ it "includes assigned_messages_count" doexpect(serializer.as_json[:topic_list][:assigned_messages_count]).to eq(1)end@@ -53,7 +53,7 @@ RSpec.describe TopicListSerializer dodescribe "as an admin user" dolet(:guardian) { Guardian.new(Fabricate(:admin)) }- it "should not include the attribute" do+ it "omits assigned_messages_count" doexpect(serializer.as_json[:topic_list][:assigned_messages_count]).to eq(nil)endend@@ -61,7 +61,7 @@ RSpec.describe TopicListSerializer dodescribe "as an anon user" dolet(:guardian) { Guardian.new }- it "should not include the attribute" do+ it "omits assigned_messages_count" doexpect(serializer.as_json[:topic_list][:assigned_messages_count]).to eq(nil)endend@@ -71,7 +71,7 @@ RSpec.describe TopicListSerializer dodescribe "as an anon user" dolet(:guardian) { Guardian.new }- it "should not include the attribute" do+ it "omits assigned_messages_count" doexpect(serializer.as_json[:topic_list][:assigned_messages_count]).to eq(nil)endend@@ -80,7 +80,7 @@ RSpec.describe TopicListSerializer dolet(:admin) { Fabricate(:admin) }let(:guardian) { Guardian.new(admin) }- it "should include the right attribute" do+ it "includes assigned_messages_count" doexpect(serializer.as_json[:topic_list][:assigned_messages_count]).to eq(1)endend@@ -88,7 +88,7 @@ RSpec.describe TopicListSerializer dodescribe "as a normal user" dolet(:guardian) { Guardian.new(Fabricate(:user)) }- it "should not include the attribute" do+ it "omits assigned_messages_count" doexpect(serializer.as_json[:topic_list][:assigned_messages_count]).to eq(nil)endenddiff --git a/plugins/discourse-cakeday/spec/jobs/migrate_date_of_birth_to_users_table_spec.rb b/plugins/discourse-cakeday/spec/jobs/migrate_date_of_birth_to_users_table_spec.rbindex 9a84d6877f3..fc0cfd48fb4 100644--- a/plugins/discourse-cakeday/spec/jobs/migrate_date_of_birth_to_users_table_spec.rb+++ b/plugins/discourse-cakeday/spec/jobs/migrate_date_of_birth_to_users_table_spec.rb@@ -37,7 +37,7 @@ RSpec.describe Jobs::MigrateDateOfBirthToUsersTable doendcontext "when custom field date is invalid" do- it "should ignore the error" do+ it "continues after an error" douser.custom_fields["date_of_birth"] = "02/13/1904"user.save!@@ -48,7 +48,7 @@ RSpec.describe Jobs::MigrateDateOfBirthToUsersTable doendcontext "when custom field date is blank" do- it "should remove the custom field" do+ it "removes the custom field" douser.custom_fields["date_of_birth"] = ""user.save!diff --git a/plugins/discourse-captcha/spec/services/problem_check/hcaptcha_configuration_spec.rb b/plugins/discourse-captcha/spec/services/problem_check/hcaptcha_configuration_spec.rbindex c08b389e3e9..db65d899689 100644--- a/plugins/discourse-captcha/spec/services/problem_check/hcaptcha_configuration_spec.rb+++ b/plugins/discourse-captcha/spec/services/problem_check/hcaptcha_configuration_spec.rb@@ -15,7 +15,7 @@ RSpec.describe ProblemCheck::HcaptchaConfiguration doit { expect(check).to be_chill_about_it }end- context "when discourse_captcha_provider siteSetting is HCaptcha" do+ context "when hCaptcha is enabled and configured as the provider" dobefore doSiteSetting.discourse_captcha_enabled = trueSiteSetting.discourse_captcha_provider = DiscourseCaptcha::CaptchaProvider::HCAPTCHA@@ -47,7 +47,7 @@ RSpec.describe ProblemCheck::HcaptchaConfiguration doendend- context "when discourse_captcha_provider siteSetting is HCaptcha" do+ context "when hCaptcha is configured as the provider but disabled" dobefore { SiteSetting.discourse_captcha_provider = DiscourseCaptcha::CaptchaProvider::HCAPTCHA }describe "`hcaptcha_site_key` is not set" dodiff --git a/plugins/discourse-chat-integration/spec/helpers/helper_spec.rb b/plugins/discourse-chat-integration/spec/helpers/helper_spec.rbindex 16f76a836eb..a45524aed10 100644--- a/plugins/discourse-chat-integration/spec/helpers/helper_spec.rb+++ b/plugins/discourse-chat-integration/spec/helpers/helper_spec.rb@@ -25,7 +25,7 @@ RSpec.describe DiscourseChatIntegration::Manager do# Not testing how filters are merged here, that's done in .smart_create_rule# We just want to make sure the commands are being interpreted correctly- it "should add a new rule correctly" do+ it "adds a new category rule" doresponse = DiscourseChatIntegration::Helper.process_command(chan1, ["watch", category.slug])expect(response).to eq(I18n.t("chat_integration.provider.dummy.create.created"))@@ -37,7 +37,7 @@ RSpec.describe DiscourseChatIntegration::Manager doexpect(rule.tags).to eq(nil)end- it "should work with all four filter types" do+ it "supports all four filter types" doresponse =DiscourseChatIntegration::Helper.process_command(chan1, ["thread", category.slug])@@ -76,7 +76,7 @@ RSpec.describe DiscourseChatIntegration::Manager docontext "with tags enabled" dobefore { SiteSetting.tagging_enabled = true }- it "should add a new tag rule correctly" do+ it "adds a new tag rule" doresponse =DiscourseChatIntegration::Helper.process_command(chan1, ["watch", "tag:#{tag1.name}"])@@ -89,7 +89,7 @@ RSpec.describe DiscourseChatIntegration::Manager doexpect(rule.tags).to eq([tag1.name])end- it "should work with a category and multiple tags" do+ it "supports a category with multiple tags" doresponse =DiscourseChatIntegration::Helper.process_command(chan1,@@ -144,21 +144,21 @@ RSpec.describe DiscourseChatIntegration::Manager doenddescribe "help command" do- it "should return the right response" do+ it "returns the help response" doresponse = DiscourseChatIntegration::Helper.process_command(chan1, ["help"])expect(response).to eq(I18n.t("chat_integration.provider.dummy.help"))endenddescribe "status command" do- it "should return the right response" do+ it "returns the channel status" doresponse = DiscourseChatIntegration::Helper.process_command(chan1, ["status"])expect(response).to eq(DiscourseChatIntegration::Helper.status_for_channel(chan1))endenddescribe "unknown command" do- it "should return the right response" do+ it "returns the unknown-command response" doresponse = DiscourseChatIntegration::Helper.process_command(chan1, ["somerandomtext"])expect(response).to eq(I18n.t("chat_integration.provider.dummy.parse_error"))enddiff --git a/plugins/discourse-chat-integration/spec/integration/automation_spec.rb b/plugins/discourse-chat-integration/spec/integration/automation_spec.rbindex 081de477f40..953af90b219 100644--- a/plugins/discourse-chat-integration/spec/integration/automation_spec.rb+++ b/plugins/discourse-chat-integration/spec/integration/automation_spec.rb@@ -76,7 +76,7 @@ RSpec.describe "Triggering notifications" doexpect(validated_provider.sent_messages.length).to eq(0)end- it "should not trigger a provider notification on topic creation for topic_tags_changed script" do+ it "does not trigger a provider notification when topic_tags_changed creates a topic" doTopicCreator.create(admin,Guardian.new(admin),diff --git a/plugins/discourse-chat-integration/spec/jobs/onceoff/migrate_from_slack_official_spec.rb b/plugins/discourse-chat-integration/spec/jobs/onceoff/migrate_from_slack_official_spec.rbindex 654f3006ca6..d19976ba9d3 100644--- a/plugins/discourse-chat-integration/spec/jobs/onceoff/migrate_from_slack_official_spec.rb+++ b/plugins/discourse-chat-integration/spec/jobs/onceoff/migrate_from_slack_official_spec.rb@@ -26,7 +26,7 @@ RSpec.describe Jobs::DiscourseChatMigrateFromSlackOfficial doSiteSetting.create!(value: User.last.username, data_type: 1, name: "slack_discourse_username")end- it "should migrate the site settings correctly" do+ it "migrates the site settings correctly" dodescribed_class.new.execute_onceoff({})expect(SiteSetting.find_by(name: "slack_enabled").value).to eq("f")@@ -49,7 +49,7 @@ RSpec.describe Jobs::DiscourseChatMigrateFromSlackOfficial dodescribe "when slack_discourse_username is not valid" dobefore { SiteSetting.find_by(name: "slack_discourse_username").update!(value: "someguy") }- it "should default to the system user" do+ it "defaults to the system user" dodescribed_class.new.execute_onceoff({})expect(SiteSetting.chat_integration_discourse_username).to eq(@@ -70,7 +70,7 @@ RSpec.describe Jobs::DiscourseChatMigrateFromSlackOfficial do)end- it "should create the right channels and rules" do+ it "creates the expected channels and rules" dodescribed_class.new.execute_onceoff({})expect(DiscourseChatIntegration::Channel.count).to eq(2)@@ -113,7 +113,7 @@ RSpec.describe Jobs::DiscourseChatMigrateFromSlackOfficial do)end- it "should discard invalid tags" do+ it "discards invalid tags" dodescribed_class.new.execute_onceoff({})rule = DiscourseChatIntegration::Rule.first@@ -132,7 +132,7 @@ RSpec.describe Jobs::DiscourseChatMigrateFromSlackOfficial do)end- it "should migrate the settings correctly" do+ it "migrates the settings correctly" dodescribed_class.new.execute_onceoff({})channel = DiscourseChatIntegration::Channel.first@@ -158,7 +158,7 @@ RSpec.describe Jobs::DiscourseChatMigrateFromSlackOfficial do)end- it "should not migrate the settings" do+ it "does not migrate the settings" dodescribed_class.new.execute_onceoff({})expect(DiscourseChatIntegration::Channel.count).to eq(0)diff --git a/plugins/discourse-chat-integration/spec/jobs/regular/notify_chats_spec.rb b/plugins/discourse-chat-integration/spec/jobs/regular/notify_chats_spec.rbindex 04a77d725be..a459190695d 100644--- a/plugins/discourse-chat-integration/spec/jobs/regular/notify_chats_spec.rb+++ b/plugins/discourse-chat-integration/spec/jobs/regular/notify_chats_spec.rb@@ -9,7 +9,7 @@ RSpec.describe PostCreator dodescribe "when plugin is enabled" dobefore { SiteSetting.chat_integration_enabled = true }- it "should schedule a chat notification job" do+ it "schedules a chat notification job" dofreeze_time Time.now.beginning_of_daypost = PostCreator.new(topic.user, raw: "Some post content", topic_id: topic.id).create!@@ -27,7 +27,7 @@ RSpec.describe PostCreator dodescribe "when plugin is not enabled" dobefore { SiteSetting.chat_integration_enabled = false }- it "should not schedule a job for chat notifications" do+ it "does not schedule a chat notification job" doPostCreator.new(topic.user, raw: "Some post content", topic_id: topic.id).create!expect(Jobs::NotifyChats.jobs).to eq([])diff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/mattermost/mattermost_command_controller_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/mattermost/mattermost_command_controller_spec.rbindex e5ebe1bbe40..ae1224abbf2 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/mattermost/mattermost_command_controller_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/mattermost/mattermost_command_controller_spec.rb@@ -14,7 +14,7 @@ describe "Mattermost Command Controller", type: :request doenddescribe "with plugin disabled" do- it "should return a 404" do+ it "returns a 404" dopost "/chat-integration/mattermost/command.json"expect(response.status).to eq(404)end@@ -26,7 +26,7 @@ describe "Mattermost Command Controller", type: :request doSiteSetting.chat_integration_mattermost_enabled = falseend- it "should return a 404" do+ it "returns a 404" dopost "/chat-integration/mattermost/command.json"expect(response.status).to eq(404)end@@ -41,7 +41,7 @@ describe "Mattermost Command Controller", type: :request doenddescribe "when forum is private" do- it "should not redirect to login page" do+ it "does not redirect to the login page" doSiteSetting.login_required = truetoken = "sometoken"SiteSetting.chat_integration_mattermost_incoming_webhook_token = token@@ -53,14 +53,14 @@ describe "Mattermost Command Controller", type: :request doenddescribe "when the token is invalid" do- it "should raise the right error" do+ it "returns an error for a missing token" dopost "/chat-integration/mattermost/command.json", params: { text: "help" }expect(response.status).to eq(400)endenddescribe "when incoming webhook token has not been set" do- it "should raise the right error" do+ it "returns an error for an invalid token" dopost "/chat-integration/mattermost/command.json",params: {text: "help",@@ -80,7 +80,7 @@ describe "Mattermost Command Controller", type: :request dobefore { SiteSetting.chat_integration_mattermost_incoming_webhook_token = token }describe "add new rule" do- it "should add a new rule correctly" do+ it "adds a new rule" dopost "/chat-integration/mattermost/command.json",params: {text: "watch #{category.slug}",diff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/mattermost/mattermost_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/mattermost/mattermost_provider_spec.rbindex 6f9dbf2a10d..bb8545bed73 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/mattermost/mattermost_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/mattermost/mattermost_provider_spec.rb@@ -35,7 +35,7 @@ RSpec.describe DiscourseChatIntegration::Provider::MattermostProvider doenddescribe "when mattermost icon has been configured" do- it "should use the right icon" do+ it "uses the configured icon URL" doSiteSetting.chat_integration_mattermost_icon_url = "https://specific_logo"message = described_class.mattermost_message(post, chan1)expect(message[:icon_url]).to eq(SiteSetting.chat_integration_mattermost_icon_url)diff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_command_controller_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_command_controller_spec.rbindex 8909e932d8d..32ef5b8b1da 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_command_controller_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_command_controller_spec.rb@@ -11,7 +11,7 @@ describe "Slack Command Controller", type: :request doenddescribe "with plugin disabled" do- it "should return a 404" do+ it "returns a 404 response" dopost "/chat-integration/slack/command.json"expect(response.status).to eq(404)end@@ -23,7 +23,7 @@ describe "Slack Command Controller", type: :request doSiteSetting.chat_integration_slack_enabled = falseend- it "should return a 404" do+ it "returns a 404 response" dopost "/chat-integration/slack/command.json"expect(response.status).to eq(404)end@@ -38,7 +38,7 @@ describe "Slack Command Controller", type: :request doenddescribe "when forum is private" do- it "should not redirect to login page" do+ it "does not redirect to the login page" doSiteSetting.login_required = truetoken = "sometoken"SiteSetting.chat_integration_slack_incoming_webhook_token = token@@ -50,14 +50,14 @@ describe "Slack Command Controller", type: :request doenddescribe "when the token is invalid" do- it "should raise the right error" do+ it "returns an invalid-token error" dopost "/chat-integration/slack/command.json", params: { text: "help" }expect(response.status).to eq(400)endenddescribe "backwards compatibility with discourse-slack-official" do- it "should return the right response" do+ it "accepts the legacy webhook token" dotoken = "secret sauce"SiteSetting.chat_integration_slack_incoming_webhook_token = token@@ -69,7 +69,7 @@ describe "Slack Command Controller", type: :request doenddescribe "when incoming webhook token has not been set" do- it "should raise the right error" do+ it "returns a missing-token error" dopost "/chat-integration/slack/command.json", params: { text: "help", token: "some token" }expect(response.status).to eq(403)@@ -85,7 +85,7 @@ describe "Slack Command Controller", type: :request dobefore { SiteSetting.chat_integration_slack_incoming_webhook_token = token }describe "add new rule" do- it "should add a new rule correctly" do+ it "adds a new Slack rule" dopost "/chat-integration/slack/command.json",params: {text: "watch #{category.slug}",diff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_message_formatter_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_message_formatter_spec.rbindex f621b5884b0..f32f45e3f18 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_message_formatter_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_message_formatter_spec.rb@@ -3,14 +3,14 @@RSpec.describe DiscourseChatIntegration::Provider::SlackProvider::SlackMessageFormatter dodescribe ".format" docontext "with links" do- it "should return the right message" do+ it "returns the expected message" doexpect(described_class.format("<a href='http://somepath.com'>test</a>")).to eq("<http://somepath.com|test>",)enddescribe "when text contains a link with an incomplete URL" do- it "should return the right message" do+ it "returns the expected message" doexpect(described_class.format("test <a href='//localhost:3000/some/path'></a>")).to eq("test <http://localhost:3000/some/path|>",)@@ -23,7 +23,7 @@ RSpec.describe DiscourseChatIntegration::Provider::SlackProvider::SlackMessageFoendend- it "should not raise an error with unparseable urls" do+ it "does not raise an error for unparseable URLs" doexpect(described_class.format("<a>test</a>")).to eq("<test.localhost|test>")endenddiff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_provider_spec.rbindex 3b01fc75d54..4c41e7986a1 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_provider_spec.rb@@ -7,13 +7,13 @@ RSpec.describe DiscourseChatIntegration::Provider::SlackProvider dodescribe "when post contains emoijs" dobefore { post.update!(raw: ":slight_smile: This is a test") }- it "should return the right excerpt" do+ it "returns the post excerpt" doexpect(described_class.excerpt(post)).to eq("🙂 This is a test")endenddescribe "when post contains onebox" do- it "should return the right excerpt" do+ it "returns an excerpt without the onebox" dopost.update!(cooked: <<~COOKED)<aside class=\"onebox whitelistedgeneric\"><header class=\"source\">@@ -47,7 +47,7 @@ RSpec.describe DiscourseChatIntegration::Provider::SlackProvider doenddescribe "when post contains an email" do- it "should return the right excerpt" do+ it "returns an excerpt containing the email address" dopost.update!(cooked: <<~COOKED)The address is <a href=\"mailto:[email protected]\">my email</a>COOKED@@ -282,7 +282,7 @@ RSpec.describe DiscourseChatIntegration::Provider::SlackProvider doenddescribe ".create_slack_message" do- it "should work with a simple message" do+ it "creates a simple Slack message" docontent = "Simple message"url = "http://example.com"message = { channel: "#general", username: "Discourse", content: "#{content} - #{url}" }@@ -303,7 +303,7 @@ RSpec.describe DiscourseChatIntegration::Provider::SlackProvider do).to eq(message)end- it "should do the replacements" do+ it "replaces the topic placeholders" dotopic = Fabricate(:topic)topic.posts << Fabricate(:post, topic: topic)tag1, tag2, tag3, tag4 = [Fabricate(:tag), Fabricate(:tag), Fabricate(:tag), Fabricate(:tag)]@@ -330,7 +330,7 @@ RSpec.describe DiscourseChatIntegration::Provider::SlackProvider doexpect(text).to include("<#{tag3.full_url}|#{tag3.name}>, <#{tag4.full_url}|#{tag4.name}>")end- it "should do the replacements for ${ADDED_AND_REMOVED}" do+ it "replaces the combined added-and-removed placeholder" dotopic = Fabricate(:topic)topic.posts << Fabricate(:post, topic: topic)tag1, tag2 = [Fabricate(:tag), Fabricate(:tag)]@@ -397,7 +397,7 @@ RSpec.describe DiscourseChatIntegration::Provider::SlackProvider do)end- it "should raise errors if tags are not present but uses in content" do+ it "raises an error when tag placeholders lack tag data" dotopic = Fabricate(:topic)topic.posts << Fabricate(:post, topic: topic)content = "This should not work ${ADDED_TAGS}"diff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/telegram/telegram_command_controller_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/telegram/telegram_command_controller_spec.rbindex 0dfa6def309..a31b32409f7 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/telegram/telegram_command_controller_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/telegram/telegram_command_controller_spec.rb@@ -18,7 +18,7 @@ describe "Telegram Command Controller", type: :request doenddescribe "with plugin disabled" do- it "should return a 404" do+ it "returns a 404" dopost "/chat-integration/telegram/command/abcd.json"expect(response.status).to eq(404)end@@ -30,7 +30,7 @@ describe "Telegram Command Controller", type: :request doSiteSetting.chat_integration_telegram_enabled = falseend- it "should return a 404" do+ it "returns a 404" dopost "/chat-integration/telegram/command/abcd.json"expect(response.status).to eq(404)end@@ -51,7 +51,7 @@ describe "Telegram Command Controller", type: :request doenddescribe "when forum is private" do- it "should not redirect to login page" do+ it "does not redirect to the login page" doSiteSetting.login_required = truepost "/chat-integration/telegram/command/shhh.json",@@ -69,7 +69,7 @@ describe "Telegram Command Controller", type: :request doenddescribe "when the token is invalid" do- it "should raise the right error" do+ it "rejects an invalid command token" dopost "/chat-integration/telegram/command/blah.json",params: {message: {@@ -85,7 +85,7 @@ describe "Telegram Command Controller", type: :request doenddescribe "when token has not been set" do- it "should raise the right error" do+ it "rejects commands when the access token is missing" doSiteSetting.chat_integration_telegram_access_token = ""post "/chat-integration/telegram/command/blah.json",params: {@@ -107,7 +107,7 @@ describe "Telegram Command Controller", type: :request dobefore { SiteSetting.chat_integration_telegram_enable_slash_commands = true }describe "add new rule" do- it "should add a new rule correctly" do+ it "adds a new rule" dopost "/chat-integration/telegram/command/shhh.json",params: {message: {@@ -128,7 +128,7 @@ describe "Telegram Command Controller", type: :request doexpect(rule.tags).to eq(nil)end- it "should add a new rule correctly using group chat syntax" do+ it "adds a new rule using group chat syntax" dopost "/chat-integration/telegram/command/shhh.json",params: {message: {@@ -167,7 +167,7 @@ describe "Telegram Command Controller", type: :request doendend- it "should respond only to a specific command in a broadcast channel" do+ it "responds only to a specific command in a broadcast channel" dopost "/chat-integration/telegram/command/shhh.json",params: {channel_post: {diff --git a/plugins/discourse-chat-integration/spec/models/channel_spec.rb b/plugins/discourse-chat-integration/spec/models/channel_spec.rbindex 9b8c33ea7db..766a30d0452 100644--- a/plugins/discourse-chat-integration/spec/models/channel_spec.rb+++ b/plugins/discourse-chat-integration/spec/models/channel_spec.rb@@ -6,7 +6,7 @@ RSpec.describe DiscourseChatIntegration::Channel doinclude_context "with dummy provider"include_context "with validated dummy provider"- it "should save and load successfully" do+ it "saves and loads successfully" doexpect(DiscourseChatIntegration::Channel.all.length).to eq(0)chan = DiscourseChatIntegration::Channel.create(provider: "dummy")@@ -18,7 +18,7 @@ RSpec.describe DiscourseChatIntegration::Channel doexpect(loadedChan.provider).to eq("dummy")end- it "should edit successfully" do+ it "edits successfully" dochannel = DiscourseChatIntegration::Channel.create!(provider: "dummy2", data: { val: "hello" })expect(channel.valid?).to eq(true)channel.save!diff --git a/plugins/discourse-chat-integration/spec/models/rule_spec.rb b/plugins/discourse-chat-integration/spec/models/rule_spec.rbindex 18e4b2353f7..9f2275cebb2 100644--- a/plugins/discourse-chat-integration/spec/models/rule_spec.rb+++ b/plugins/discourse-chat-integration/spec/models/rule_spec.rb@@ -13,20 +13,20 @@ RSpec.describe DiscourseChatIntegration::Rule dolet(:group) { Fabricate(:group) }describe ".alloc_key" do- it "should return sequential numbers" do+ it "returns sequential rule numbers" doexpect(DiscourseChatIntegration::Rule.create(channel: channel).key).to eq("rule:1")expect(DiscourseChatIntegration::Rule.create(channel: channel).key).to eq("rule:2")expect(DiscourseChatIntegration::Rule.create(channel: channel).key).to eq("rule:3")endend- it "should convert between channel and channel_id successfully" do+ it "resolves the channel and its ID" dorule = DiscourseChatIntegration::Rule.create(channel: channel)expect(rule.channel_id).to eq(channel.id)expect(rule.channel.id).to eq(channel.id)end- it "should save and load successfully" do+ it "saves and loads the rule" doexpect(DiscourseChatIntegration::Rule.all.length).to eq(0)rule =diff --git a/plugins/discourse-chat-integration/spec/requests/chat_controller_spec.rb b/plugins/discourse-chat-integration/spec/requests/chat_controller_spec.rbindex adeba586693..9b0859e8f97 100644--- a/plugins/discourse-chat-integration/spec/requests/chat_controller_spec.rb+++ b/plugins/discourse-chat-integration/spec/requests/chat_controller_spec.rb@@ -20,14 +20,14 @@ RSpec.describe "Chat Controller", type: :request doshared_examples "admin constraints" do |action, route|context "when user is not signed in" do- it "should raise the right error" do+ it "raises the expected error" dopublic_send(action, route)expect(response.status).to eq(404)endendcontext "when user is not an admin" do- it "should raise the right error" do+ it "raises the expected error" dosign_in(Fabricate(:user))public_send(action, route)expect(response.status).to eq(404)@@ -43,7 +43,7 @@ RSpec.describe "Chat Controller", type: :request docontext "when signed in as an admin" dobefore { sign_in(admin) }- it "should return the right response" do+ it "returns the expected response" doget "/admin/plugins/discourse-chat-integration/providers.json"expect(response.status).to eq(200)@@ -300,7 +300,7 @@ RSpec.describe "Chat Controller", type: :request docontext "when signed in as an admin" dobefore { sign_in(admin) }- it "should return the right response" do+ it "returns the expected response" dopost "/admin/plugins/discourse-chat-integration/test.json",params: {channel_id: channel.id,@@ -310,7 +310,7 @@ RSpec.describe "Chat Controller", type: :request doexpect(response.status).to eq(200)end- it "should fail for invalid channel" do+ it "fails for an invalid channel" dopost "/admin/plugins/discourse-chat-integration/test.json",params: {channel_id: 999,@@ -330,7 +330,7 @@ RSpec.describe "Chat Controller", type: :request docontext "when signed in as an admin" dobefore { sign_in(admin) }- it "should return the right response" do+ it "returns the expected response" dorule =DiscourseChatIntegration::Rule.create(channel: channel,@@ -369,7 +369,7 @@ RSpec.describe "Chat Controller", type: :request do)end- it "should fail for invalid provider" do+ it "fails for an invalid provider" doget "/admin/plugins/discourse-chat-integration/channels.json",params: {provider: "someprovider",@@ -387,7 +387,7 @@ RSpec.describe "Chat Controller", type: :request docontext "as an admin" dobefore { sign_in(admin) }- it "should be able to add a new channel" do+ it "adds a new channel" dopost "/admin/plugins/discourse-chat-integration/channels.json",params: {channel: {@@ -404,7 +404,7 @@ RSpec.describe "Chat Controller", type: :request doexpect(channel.provider).to eq("dummy")end- it "should fail for invalid params" do+ it "fails for invalid parameters" dopost "/admin/plugins/discourse-chat-integration/channels.json",params: {channel: {@@ -432,7 +432,7 @@ RSpec.describe "Chat Controller", type: :request docontext "as an admin" dobefore { sign_in(admin) }- it "should be able update a channel" do+ it "updates a channel" doput "/admin/plugins/discourse-chat-integration/channels/#{channel.id}.json",params: {channel: {@@ -448,7 +448,7 @@ RSpec.describe "Chat Controller", type: :request doexpect(channel.data).to eq("val" => "something-else")end- it "should fail for invalid params" do+ it "fails for invalid parameters" doput "/admin/plugins/discourse-chat-integration/channels/#{channel.id}.json",params: {channel: {@@ -473,7 +473,7 @@ RSpec.describe "Chat Controller", type: :request docontext "as an admin" dobefore { sign_in(admin) }- it "should be able delete a channel" do+ it "deletes a channel" dodelete "/admin/plugins/discourse-chat-integration/channels/#{channel.id}.json"expect(response.status).to eq(200)@@ -490,7 +490,7 @@ RSpec.describe "Chat Controller", type: :request docontext "as an admin" dobefore { sign_in(admin) }- it "should be able to add a new rule" do+ it "adds a new rule" dopost "/admin/plugins/discourse-chat-integration/rules.json",params: {rule: {@@ -511,7 +511,7 @@ RSpec.describe "Chat Controller", type: :request doexpect(rule.tags).to eq([tag.name])end- it "should fail for invalid params" do+ it "fails for invalid parameters" dopost "/admin/plugins/discourse-chat-integration/rules.json",params: {rule: {@@ -544,7 +544,7 @@ RSpec.describe "Chat Controller", type: :request docontext "as an admin" dobefore { sign_in(admin) }- it "should be able update a rule" do+ it "updates a rule" doput "/admin/plugins/discourse-chat-integration/rules/#{rule.id}.json",params: {rule: {@@ -561,7 +561,7 @@ RSpec.describe "Chat Controller", type: :request doexpect(rule.category_id).to eq(category2.id)end- it "should fail for invalid params" do+ it "fails for invalid parameters" doput "/admin/plugins/discourse-chat-integration/rules/#{rule.id}.json",params: {rule: {@@ -594,7 +594,7 @@ RSpec.describe "Chat Controller", type: :request docontext "as an admin" dobefore { sign_in(admin) }- it "should be able delete a rule" do+ it "deletes a rule" dodelete "/admin/plugins/discourse-chat-integration/rules/#{rule.id}.json"expect(response.status).to eq(200)diff --git a/plugins/discourse-chat-integration/spec/requests/public_controller_spec.rb b/plugins/discourse-chat-integration/spec/requests/public_controller_spec.rbindex 5f5c187485f..a789bd4a44f 100644--- a/plugins/discourse-chat-integration/spec/requests/public_controller_spec.rb+++ b/plugins/discourse-chat-integration/spec/requests/public_controller_spec.rb@@ -4,7 +4,7 @@ RSpec.describe "Public Controller", type: :request dobefore { SiteSetting.chat_integration_enabled = true }describe "loading a transcript" do- it "should be able to load a transcript" do+ it "loads a saved transcript" dokey = DiscourseChatIntegration::Helper.save_transcript("Some content here")get "/chat-transcript/#{key}.json"@@ -14,7 +14,7 @@ RSpec.describe "Public Controller", type: :request doexpect(response.body).to eq('{"content":"Some content here"}')end- it "should 404 for non-existent transcript" do+ it "returns 404 for a missing transcript" dokey = "abcdefghijk"get "/chat-transcript/#{key}.json"diff --git a/plugins/discourse-chat-integration/spec/services/manager_spec.rb b/plugins/discourse-chat-integration/spec/services/manager_spec.rbindex c5180429272..d56d3fd4d59 100644--- a/plugins/discourse-chat-integration/spec/services/manager_spec.rb+++ b/plugins/discourse-chat-integration/spec/services/manager_spec.rb@@ -25,7 +25,7 @@ RSpec.describe DiscourseChatIntegration::Manager doSiteSetting.dummy_provider_enabled = trueend- it "should fail gracefully when a provider throws an exception" do+ it "continues when a provider raises an exception" doDiscourseChatIntegration::Rule.create!(channel: chan1,filter: "watch",@@ -54,7 +54,7 @@ RSpec.describe DiscourseChatIntegration::Manager doexpect(DiscourseChatIntegration::Channel.all.first.error_key.nil?).to be trueend- it "should not send notifications when provider is disabled" do+ it "does not notify a disabled provider" doSiteSetting.dummy_provider_enabled = falseDiscourseChatIntegration::Rule.create!(channel: chan1,@@ -67,7 +67,7 @@ RSpec.describe DiscourseChatIntegration::Manager doexpect(provider.sent_to_channel_ids).to contain_exactlyend- it "should send a notification to watched and following channels for new topic" do+ it "notifies watched and followed channels about a new topic" doDiscourseChatIntegration::Rule.create!(channel: chan1,filter: "watch",@@ -89,7 +89,7 @@ RSpec.describe DiscourseChatIntegration::Manager doexpect(provider.sent_to_channel_ids).to contain_exactly(chan1.id, chan2.id)end- it "should send a notification only to watched for reply" do+ it "notifies only watched channels about a reply" doDiscourseChatIntegration::Rule.create!(channel: chan1,filter: "watch",@@ -111,7 +111,7 @@ RSpec.describe DiscourseChatIntegration::Manager doexpect(provider.sent_to_channel_ids).to contain_exactly(chan1.id)end- it "should respect wildcard category settings" do+ it "applies wildcard category rules" doDiscourseChatIntegration::Rule.create!(channel: chan1, filter: "watch", category_id: nil)manager.trigger_notifications(first_post.id)@@ -119,7 +119,7 @@ RSpec.describe DiscourseChatIntegration::Manager doexpect(provider.sent_to_channel_ids).to contain_exactly(chan1.id)end- it "should respect mute over watch" do+ it "gives mute rules precedence over watch rules" doDiscourseChatIntegration::Rule.create!(channel: chan1, filter: "watch", category_id: nil) # Wildcard watchDiscourseChatIntegration::Rule.create!(channel: chan1,@@ -132,7 +132,7 @@ RSpec.describe DiscourseChatIntegration::Manager doexpect(provider.sent_to_channel_ids).to contain_exactlyend- it "should respect watch over follow" do+ it "gives watch rules precedence over follow rules" doDiscourseChatIntegration::Rule.create!(channel: chan1, filter: "follow", category_id: nil) # Wildcard followDiscourseChatIntegration::Rule.create!(channel: chan1,@@ -145,7 +145,7 @@ RSpec.describe DiscourseChatIntegration::Manager doexpect(provider.sent_to_channel_ids).to contain_exactly(chan1.id)end- it "should respect thread over watch" do+ it "gives thread rules precedence over watch rules" doDiscourseChatIntegration::Rule.create!(channel: chan1, filter: "watch", category_id: nil) # Wildcard watchDiscourseChatIntegration::Rule.create!(channel: chan1,@@ -158,7 +158,7 @@ RSpec.describe DiscourseChatIntegration::Manager doexpect(provider.sent_to_channel_ids).to contain_exactly(chan1.id)end- it "should not notify about private messages" do+ it "does not notify about private messages" doDiscourseChatIntegration::Rule.create!(channel: chan1, filter: "follow", category_id: nil) # Wildcard watchprivate_post = Fabricate(:private_message_post)@@ -168,7 +168,7 @@ RSpec.describe DiscourseChatIntegration::Manager doexpect(provider.sent_to_channel_ids).to contain_exactlyend- it "should work for group pms" do+ it "notifies eligible group private messages" doDiscourseChatIntegration::Rule.create!(channel: chan1, filter: "watch") # Wildcard watchDiscourseChatIntegration::Rule.create!(channel: chan2,@@ -185,7 +185,7 @@ RSpec.describe DiscourseChatIntegration::Manager doexpect(provider.sent_to_channel_ids).to contain_exactly(chan2.id)end- it "should work for pms with multiple groups" do+ it "notifies private messages shared with multiple groups" doDiscourseChatIntegration::Rule.create!(channel: chan1,type: "group_message",@@ -208,7 +208,7 @@ RSpec.describe DiscourseChatIntegration::Manager doexpect(provider.sent_to_channel_ids).to contain_exactly(chan1.id, chan2.id)end- it "should work for group mentions" do+ it "notifies group mentions" dothird_post =Fabricate(:post, topic: topic, post_number: 3, raw: "let's mention @#{group.name}")@@ -230,7 +230,7 @@ RSpec.describe DiscourseChatIntegration::Manager doexpect(provider.sent_to_channel_ids).to contain_exactly(chan1.id, chan3.id)end- it "should give group rule precedence over normal rules" do+ it "gives group rules precedence over normal rules" dothird_post =Fabricate(:post, topic: topic, post_number: 3, raw: "let's mention @#{group.name}")@@ -252,7 +252,7 @@ RSpec.describe DiscourseChatIntegration::Manager doexpect(provider.sent_to_channel_ids).to contain_exactly(chan1.id)end- it "should not notify about mentions in private messages" do+ it "does not notify about mentions in private messages" do# Group 1 watching for messages on channel 1DiscourseChatIntegration::Rule.create!(channel: chan1,@@ -286,7 +286,7 @@ RSpec.describe DiscourseChatIntegration::Manager doexpect(provider.sent_to_channel_ids).to contain_exactly(chan1.id)end- it "should not notify about posts the chat_user cannot see" do+ it "does not notify about posts hidden from the chat user" doDiscourseChatIntegration::Rule.create!(channel: chan1, filter: "follow", category_id: nil) # Wildcard watch# Create a group & user@@ -326,7 +326,7 @@ RSpec.describe DiscourseChatIntegration::Manager dobefore(:each) { SiteSetting.tagging_enabled = true }- it "should still work for rules without any tags specified" do+ it "matches rules without specified tags" doDiscourseChatIntegration::Rule.create!(channel: chan1, filter: "follow", category_id: nil) # Wildcard watchmanager.trigger_notifications(first_post.id)@@ -335,7 +335,7 @@ RSpec.describe DiscourseChatIntegration::Manager doexpect(provider.sent_to_channel_ids).to contain_exactly(chan1.id, chan1.id)end- it "should only match tagged topics when rule has tags" do+ it "only matches tagged topics when a rule specifies tags" doDiscourseChatIntegration::Rule.create!(channel: chan1,filter: "follow",@@ -356,7 +356,7 @@ RSpec.describe DiscourseChatIntegration::Manager doSiteSetting.whispers_allowed_groups = "#{Group::AUTO_GROUPS[:staff]}"end- it "should notify about category changes" do+ it "notifies about category changes" doDiscourseChatIntegration::Rule.create!(channel: chan1,filter: "watch",diff --git a/plugins/discourse-data-explorer/spec/data_explorer_spec.rb b/plugins/discourse-data-explorer/spec/data_explorer_spec.rbindex 4068091b940..6ea489e9868 100644--- a/plugins/discourse-data-explorer/spec/data_explorer_spec.rb+++ b/plugins/discourse-data-explorer/spec/data_explorer_spec.rb@@ -76,7 +76,7 @@ describe DiscourseDataExplorer::DataExplorer dodescribe ".run_query" dofab!(:topic)- it "should run a query that includes PG template patterns" do+ it "runs a query that includes PostgreSQL template patterns" dosql = <<~SQLWITH query AS (SELECT TO_CHAR(created_at, 'yyyy:mm:dd') AS date FROM topics@@ -91,7 +91,7 @@ describe DiscourseDataExplorer::DataExplorer doexpect(result[:pg_result][0]["date"]).to eq(topic.created_at.strftime("%Y:%m:%d"))end- it "should run a query containing a question mark in the comment" do+ it "runs a query containing a question mark in a comment" dosql = <<~SQLWITH query AS (SELECT id FROM topics -- some SQL ? comment ?diff --git a/plugins/discourse-data-explorer/spec/jobs/scheduled/delete_hidden_queries_spec.rb b/plugins/discourse-data-explorer/spec/jobs/scheduled/delete_hidden_queries_spec.rbindex fe99faf7c91..f06e5e3f0e1 100644--- a/plugins/discourse-data-explorer/spec/jobs/scheduled/delete_hidden_queries_spec.rb+++ b/plugins/discourse-data-explorer/spec/jobs/scheduled/delete_hidden_queries_spec.rb@@ -6,7 +6,7 @@ describe Jobs::DeleteHiddenQueries doSiteSetting.data_explorer_enabled = trueend- it "will correctly destroy old hidden queries" do+ it "destroys old hidden queries" doDiscourseDataExplorer::Query.create!(id: 1,name: "A",diff --git a/plugins/discourse-data-explorer/spec/lib/parameter_spec.rb b/plugins/discourse-data-explorer/spec/lib/parameter_spec.rbindex 89e049134bd..6fc7bd72fff 100644--- a/plugins/discourse-data-explorer/spec/lib/parameter_spec.rb+++ b/plugins/discourse-data-explorer/spec/lib/parameter_spec.rb@@ -138,7 +138,7 @@ RSpec.describe DiscourseDataExplorer::Parameter doenddescribe ".create_from_sql" do- it "should not validate default value" do+ it "does not validate the default value" doTEST_SQL = <<~SQL-- [params]-- user_id :user_id = user_not_existsdiff --git a/plugins/discourse-data-explorer/spec/lib/query_runner_spec.rb b/plugins/discourse-data-explorer/spec/lib/query_runner_spec.rbindex ae3665cba83..7798a4a1c09 100644--- a/plugins/discourse-data-explorer/spec/lib/query_runner_spec.rb+++ b/plugins/discourse-data-explorer/spec/lib/query_runner_spec.rb@@ -27,7 +27,7 @@ describe DiscourseDataExplorer::QueryRunner dodescribed_class.invalidate(query_with_internal_params.id)end- describe ".run" do+ describe ".run caching behavior" doit "runs the query and returns results" doresult = described_class.run(query, nil, current_user: admin)@@ -110,7 +110,7 @@ describe DiscourseDataExplorer::QueryRunner doendend- describe ".run" do+ describe ".run limit handling" doit "does not cache when a non-default limit is used" dodescribed_class.run(query, nil, current_user: admin, limit: 1)diff --git a/plugins/discourse-data-explorer/spec/requests/query_controller_spec.rb b/plugins/discourse-data-explorer/spec/requests/query_controller_spec.rbindex a8465f89fa8..89c19ce0dbb 100644--- a/plugins/discourse-data-explorer/spec/requests/query_controller_spec.rb+++ b/plugins/discourse-data-explorer/spec/requests/query_controller_spec.rb@@ -518,7 +518,7 @@ describe DiscourseDataExplorer::QueryController docreate_postend- it "should limit the results in JSON response" do+ it "limits the results in the JSON response" doSiteSetting.data_explorer_query_result_limit = 2query = make_query <<~SQLSELECT id FROM posts@@ -540,7 +540,7 @@ describe DiscourseDataExplorer::QueryController doexpect(response.status).to eq(400)end- it "should limit the results in CSV download" do+ it "limits the results in the CSV download" doquery = make_query <<~SQLSELECT id FROM postsSQL@@ -1187,7 +1187,7 @@ describe DiscourseDataExplorer::QueryController doendend- describe "Admin" do+ describe "Admin AI query generation" dofab!(:admin)before dodiff --git a/plugins/discourse-data-explorer/spec/system/query_editor_resize_spec.rb b/plugins/discourse-data-explorer/spec/system/query_editor_resize_spec.rbindex 16ab5b6cc19..7946391c128 100644--- a/plugins/discourse-data-explorer/spec/system/query_editor_resize_spec.rb+++ b/plugins/discourse-data-explorer/spec/system/query_editor_resize_spec.rb@@ -23,7 +23,7 @@ RSpec.describe "Data explorer query editor resizing" dotry_until_success { expect(query_runner.pane_overflow).to eq(0) }end- it "will not shrink the panes past the content they clip" do+ it "does not shrink the panes past the content they clip" doin_the_stacked_layout doquery_runner.visit_admin_query(query.id)expect(page).to have_css(".query-editor .panels-flex")@@ -32,7 +32,7 @@ RSpec.describe "Data explorer query editor resizing" doendend- it "will not shrink past the shorter content left when the schema is hidden" do+ it "does not shrink past the shorter content left when the schema is hidden" doin_the_stacked_layout doquery_runner.visit_admin_query(query.id)expect(page).to have_css(".query-editor .panels-flex")diff --git a/plugins/discourse-data-explorer/spec/tasks/data_explorer_spec.rb b/plugins/discourse-data-explorer/spec/tasks/data_explorer_spec.rbindex 27be6319aef..5a7c4e60932 100644--- a/plugins/discourse-data-explorer/spec/tasks/data_explorer_spec.rb+++ b/plugins/discourse-data-explorer/spec/tasks/data_explorer_spec.rb@@ -59,7 +59,7 @@ describe "Data Explorer rake tasks" doendcontext "when query does not exist in PluginStore" do- it "should not hide the query" do+ it "does not hide the query" doDiscourseDataExplorer::Query.destroy_allmake_query("SELECT 1 as value", id: 1, name: "A")make_query("SELECT 1 as value", id: 2, name: "B")@@ -108,7 +108,7 @@ describe "Data Explorer rake tasks" doendcontext "when query does not exist in PluginStore" do- it "should not unhide the query" do+ it "does not unhide the query" doDiscourseDataExplorer::Query.destroy_allmake_query("SELECT 1 as value", id: 1, name: "A", hidden: true)make_query("SELECT 1 as value", id: 2, name: "B", hidden: true)@@ -157,7 +157,7 @@ describe "Data Explorer rake tasks" doendcontext "when query does not exist in PluginStore" do- it "should not hard delete the query" do+ it "does not hard-delete the query" doDiscourseDataExplorer::Query.destroy_allmake_query("SELECT 1 as value", id: 1, name: "A", hidden: true)make_query("SELECT 1 as value", id: 2, name: "B", hidden: true)@@ -172,7 +172,7 @@ describe "Data Explorer rake tasks" doendcontext "when query is not hidden" do- it "should not hard delete the query" do+ it "does not hard-delete the query" doDiscourseDataExplorer::Query.destroy_allmake_query("SELECT 1 as value", id: 1, name: "A")# rake data_explorer:hard_delete[1] => try to hard delete query with ID 1diff --git a/plugins/discourse-events/spec/lib/discourse_events/events/chat_channel_sync_spec.rb b/plugins/discourse-events/spec/lib/discourse_events/events/chat_channel_sync_spec.rbindex a93d590c78f..30dc5370f13 100644--- a/plugins/discourse-events/spec/lib/discourse_events/events/chat_channel_sync_spec.rb+++ b/plugins/discourse-events/spec/lib/discourse_events/events/chat_channel_sync_spec.rb@@ -23,7 +23,7 @@ describe DiscourseEvents::Events::ChatChannelSync doexpect(event.chat_channel.user_chat_channel_memberships.count).to eq(2)end- it "will simply do nothing if user has no permission to create channel" do+ it "does nothing when the user cannot create a channel" dopost = Fabricate(:post, user: user)event = Fabricate(:event, chat_enabled: true, post: post)diff --git a/plugins/discourse-events/spec/requests/events_controller_spec.rb b/plugins/discourse-events/spec/requests/events_controller_spec.rbindex 25f6a7acb7d..d5d7e175d0d 100644--- a/plugins/discourse-events/spec/requests/events_controller_spec.rb+++ b/plugins/discourse-events/spec/requests/events_controller_spec.rb@@ -10,7 +10,7 @@ module DiscourseEvents::Eventsenddescribe "#index" do- it "should not result in N+1 queries problem when multiple events are returned" do+ it "avoids N+1 queries when returning multiple events" do# Warmupget "/discourse-post-event/events.json"@@ -30,7 +30,7 @@ module DiscourseEvents::Eventsexpect(queries_with_3_events.count).to eq(queries_with_1_event.count)end- it "should not show deleted events" do+ it "excludes deleted events" doactive_event1 = Fabricate(:event, original_starts_at: 1.day.from_now)active_event2 = Fabricate(:event, original_starts_at: 2.days.from_now)deleted_event =@@ -45,7 +45,7 @@ module DiscourseEvents::Eventsexpect(event_ids).to match_array([active_event1.id, active_event2.id])end- it "should not show closed events" do+ it "excludes closed events" doactive_event1 = Fabricate(:event, original_starts_at: 1.day.from_now)active_event2 = Fabricate(:event, original_starts_at: 2.days.from_now)closed_event = Fabricate(:event, original_starts_at: 3.days.from_now, closed: true)@@ -160,7 +160,7 @@ module DiscourseEvents::Eventsexpect(response.parsed_body["events"].pluck("id")).to contain_exactly(private_event.id)end- it "should return events in ics format" do+ it "returns events in ICS format" doevent1 = Fabricate(:event, original_starts_at: 1.day.from_now, name: "Test Event 1")event2 = Fabricate(:event, original_starts_at: 2.days.from_now, name: "Test Event 2")@@ -190,7 +190,7 @@ module DiscourseEvents::Eventsexpect(body).to include("SUMMARY:Test Event 2")end- it "should include location and description in ics format" do+ it "includes the location and description in ICS format" doevent =Fabricate(:event,@@ -247,7 +247,7 @@ module DiscourseEvents::Eventsexpect(response.body).not_to match(/^X-INJECTED:evil$/)end- it "should not HTML-encode ampersands in ics format" do+ it "does not HTML-encode ampersands in ICS format" doFabricate(:event,original_starts_at: 1.day.from_now,@@ -263,7 +263,7 @@ module DiscourseEvents::Eventsexpect(response.body).not_to include("&")end- it "should not HTML-encode topic title used as ics summary" do+ it "does not HTML-encode the topic title used as the ICS summary" doevent = Fabricate(:event, original_starts_at: 1.day.from_now)event.post.topic.update!(title: "Rock & Roll Music Festival 2026")@@ -272,7 +272,7 @@ module DiscourseEvents::Eventsexpect(response.body).to include("SUMMARY:Rock & Roll Music Festival 2026")end- it "should handle events without location and description in ics format" do+ it "handles ICS events without a location or description" doevent = Fabricate(:event, original_starts_at: 1.day.from_now, name: "Simple Event")get "/discourse-post-event/events.ics"@@ -285,7 +285,7 @@ module DiscourseEvents::Eventsexpect(body).to include("END:VEVENT")end- it "should include post url in description when no custom description is set" do+ it "includes the post URL when no custom description is set" doevent =Fabricate(:event, original_starts_at: 1.day.from_now, name: "Event Without Description")diff --git a/plugins/discourse-events/spec/system/livestream_calendar_event_spec.rb b/plugins/discourse-events/spec/system/livestream_calendar_event_spec.rbindex d22b20a3ff8..9215cac6275 100644--- a/plugins/discourse-events/spec/system/livestream_calendar_event_spec.rb+++ b/plugins/discourse-events/spec/system/livestream_calendar_event_spec.rb@@ -49,7 +49,7 @@ describe "Discourse Livestream - Topic Livestream with events - Authenticated" dexpect(topic_page).to have_css("body.confirmed-event-assistance", wait: 25)end- it "clicks going to join the chat channel for livestream topics" do+ it "toggles attendance for a normal event" dotopic_livestream.create_normal_event_topic(composer, topic_page)find(".going-button", wait: 25).clickdiff --git a/plugins/discourse-events/spec/system/upcoming_events_spec.rb b/plugins/discourse-events/spec/system/upcoming_events_spec.rbindex 1da58ea866b..4dcb2c66b8d 100644--- a/plugins/discourse-events/spec/system/upcoming_events_spec.rb+++ b/plugins/discourse-events/spec/system/upcoming_events_spec.rb@@ -234,7 +234,7 @@ describe "Upcoming Events" doendend- describe "recurring events" do+ describe "recurring events shown in local time" dodescribe "with local time enabled" doit "displays multiple occurrences with correct local time",timezone: "Australia/Brisbane",@@ -367,7 +367,7 @@ describe "Upcoming Events" doendend- describe "recurring events" do+ describe "recurring events with an end date" doit "displays recurring events until the specified end date",time: Time.utc(2025, 6, 2, 19, 00) dopost =diff --git a/plugins/discourse-gamification/spec/jobs/update_stale_leaderboard_positions_spec.rb b/plugins/discourse-gamification/spec/jobs/update_stale_leaderboard_positions_spec.rbindex cb6091994a5..2ee8d7c6e4e 100644--- a/plugins/discourse-gamification/spec/jobs/update_stale_leaderboard_positions_spec.rb+++ b/plugins/discourse-gamification/spec/jobs/update_stale_leaderboard_positions_spec.rb@@ -11,7 +11,7 @@ describe Jobs::UpdateStaleLeaderboardPositions doendlet(:leaderboard_positions) { DiscourseGamification::LeaderboardCachedView.new(leaderboard) }- it "it updates all stale leaderboard positions" do+ it "updates all stale leaderboard positions" doDiscourseGamification::LeaderboardCachedView.new(leaderboard).createexpect(leaderboard_positions.scores.length).to eq(1)diff --git a/plugins/discourse-gamification/spec/plugin_spec.rb b/plugins/discourse-gamification/spec/plugin_spec.rbindex cccfa02e4f3..a203a2ea35d 100644--- a/plugins/discourse-gamification/spec/plugin_spec.rb+++ b/plugins/discourse-gamification/spec/plugin_spec.rb@@ -1,36 +1,38 @@# frozen_string_literal: truedescribe DiscourseGamification do- fab!(:user)- fab!(:leaderboard, :gamification_leaderboard)+ context "with the user card integration" do+ fab!(:user)+ fab!(:leaderboard, :gamification_leaderboard)- it "adds gamification_score to the UserCardSerializer" do- serializer = UserCardSerializer.new(user)- expect(serializer).to respond_to(:gamification_score)- end+ it "adds gamification_score to the UserCardSerializer" do+ serializer = UserCardSerializer.new(user)+ expect(serializer).to respond_to(:gamification_score)+ end- context "with leaderboard positions" do- before { SiteSetting.discourse_gamification_enabled = true }+ context "with leaderboard positions" do+ before { SiteSetting.discourse_gamification_enabled = true }- it "enqueues job to regenerate leaderboard positions for score ranking strategy changes" do- expect do SiteSetting.score_ranking_strategy = "row_number" end.to change {- Jobs::RegenerateLeaderboardPositions.jobs.size- }.by(1)+ it "enqueues job to regenerate leaderboard positions for score ranking strategy changes" do+ expect do SiteSetting.score_ranking_strategy = "row_number" end.to change {+ Jobs::RegenerateLeaderboardPositions.jobs.size+ }.by(1)+ endendend-end-describe DiscourseGamification do- let(:guardian) { Guardian.new }- let!(:default_gamification_leaderboard) { Fabricate(:gamification_leaderboard) }-- it "adds default_gamification_leaderboard_id to the SiteSettingSerializer" do- site = Site.new(guardian)- serializer = SiteSerializer.new(site)- expect(serializer).to respond_to(:default_gamification_leaderboard_id)- expect(serializer.default_gamification_leaderboard_id).to eq(- default_gamification_leaderboard.id,- )+ context "with the site settings integration" do+ let(:guardian) { Guardian.new }+ let!(:default_gamification_leaderboard) { Fabricate(:gamification_leaderboard) }++ it "adds default_gamification_leaderboard_id to the SiteSettingSerializer" do+ site = Site.new(guardian)+ serializer = SiteSerializer.new(site)+ expect(serializer).to respond_to(:default_gamification_leaderboard_id)+ expect(serializer.default_gamification_leaderboard_id).to eq(+ default_gamification_leaderboard.id,+ )+ endendenddiff --git a/plugins/discourse-github/spec/jobs/create_github_linkback_spec.rb b/plugins/discourse-github/spec/jobs/create_github_linkback_spec.rbindex 5fab4a86ced..912fdb41e60 100644--- a/plugins/discourse-github/spec/jobs/create_github_linkback_spec.rb+++ b/plugins/discourse-github/spec/jobs/create_github_linkback_spec.rb@@ -6,7 +6,7 @@ describe Jobs::CreateGithubLinkback doSiteSetting.github_linkback_enabled = trueend- it "shouldn't raise error if post not found" do+ it "does not raise an error when the post is missing" dopost = Fabricate(:post)post.destroy!expect { Jobs::CreateGithubLinkback.new.execute(post_id: post.id) }.not_to raise_errordiff --git a/plugins/discourse-github/spec/lib/github_linkback_access_token_setting_validator_spec.rb b/plugins/discourse-github/spec/lib/github_linkback_access_token_setting_validator_spec.rbindex 64a98ec1a97..c111fe91977 100644--- a/plugins/discourse-github/spec/lib/github_linkback_access_token_setting_validator_spec.rb+++ b/plugins/discourse-github/spec/lib/github_linkback_access_token_setting_validator_spec.rb@@ -16,7 +16,7 @@ describe GithubLinkbackAccessTokenSettingValidator do)end- it "should fail" do+ it "rejects the token" doexpect(validator.valid_value?(value)).to eq(false)endend@@ -29,13 +29,13 @@ describe GithubLinkbackAccessTokenSettingValidator do)end- it "should fail" do+ it "rejects the token" doexpect(validator.valid_value?(value)).to eq(false)endendcontext "when the token is accepted" do- it "should pass, without repos defined" do+ it "accepts the token when no repositories are defined" doexpect(validator.valid_value?(value)).to eq(true)end@@ -48,7 +48,7 @@ describe GithubLinkbackAccessTokenSettingValidator do)end- it "should pass if all the repos are accessible" do+ it "accepts the token when all repositories are accessible" doexpect(validator.valid_value?(value)).to eq(true)endenddiff --git a/plugins/discourse-github/spec/lib/github_linkback_spec.rb b/plugins/discourse-github/spec/lib/github_linkback_spec.rbindex 783dd46ce25..0a2fcdd5a96 100644--- a/plugins/discourse-github/spec/lib/github_linkback_spec.rb+++ b/plugins/discourse-github/spec/lib/github_linkback_spec.rb@@ -171,7 +171,7 @@ describe GithubLinkback doexpect(links.size).to eq(0)end- it "should return the urls for the selected projects" do+ it "returns the URLs for the selected projects" doSiteSetting.github_linkback_projects ="discourse/discourse|eviltrout/ember-performance|discourse/*"links = GithubLinkback.new(post).github_links@@ -273,21 +273,21 @@ describe GithubLinkback doexpect(post.custom_fields[field]).to be_presentend- it "should create linkback for <= SiteSetting.github_linkback_maximum_links urls" do+ it "creates linkbacks when the URL count is within the limit" doSiteSetting.github_linkback_maximum_links = 2post = Fabricate(:post, raw: "#{github_pr_link} #{github_issue_link}")links = GithubLinkback.new(post).createexpect(links.size).to eq(2)end- it "should skip linkback for > SiteSetting.github_linkback_maximum_links urls" do+ it "skips linkbacks when the URL count exceeds the limit" doSiteSetting.github_linkback_maximum_links = 1post = Fabricate(:post, raw: "#{github_pr_link} #{github_issue_link}")links = GithubLinkback.new(post).createexpect(links.size).to eq(0)end- it "should create linkback for <= SiteSetting.github_linkback_maximum_links unique urls" do+ it "counts unique URLs when applying the linkback limit" doSiteSetting.github_linkback_maximum_links = 1post = Fabricate(:post, raw: "#{github_pr_link} #{github_pr_link} #{github_pr_link}")links = GithubLinkback.new(post).creatediff --git a/plugins/discourse-github/spec/lib/github_permalinks_spec.rb b/plugins/discourse-github/spec/lib/github_permalinks_spec.rbindex 5ac123de673..d12d5db0e51 100644--- a/plugins/discourse-github/spec/lib/github_permalinks_spec.rb+++ b/plugins/discourse-github/spec/lib/github_permalinks_spec.rb@@ -6,7 +6,7 @@ describe GithubPermalinks docontext "when it doesn't contain github link to the file" dolet(:post) { Fabricate(:post, raw: "there is no github link") }- it "it does not run the job" do+ it "does not run the job" doJobs.expects(:cancel_scheduled_job).neverGithubPermalinks.replace_github_non_permalinks(post)enddiff --git a/plugins/discourse-local-dates/spec/integration/local_dates_spec.rb b/plugins/discourse-local-dates/spec/integration/local_dates_spec.rbindex 2549c2f4b3d..da2366d1e3d 100644--- a/plugins/discourse-local-dates/spec/integration/local_dates_spec.rb+++ b/plugins/discourse-local-dates/spec/integration/local_dates_spec.rb@@ -6,7 +6,7 @@ RSpec.describe "Local Dates" dofreeze_time DateTime.parse("2018-11-10 12:00")end- it "should work without timezone" do+ it "renders a local date without a timezone" dopost = Fabricate(:post, raw: <<~MD)[date=2018-05-08 time=22:00 format="L LTS" timezones="Europe/Paris|America/Los_Angeles"]MD@@ -24,7 +24,7 @@ RSpec.describe "Local Dates" doexpect(cooked).to include("05/08/2018 10:00:00 PM")end- it "should work with timezone" do+ it "renders a local date with a timezone" dopost = Fabricate(:post, raw: <<~MD)[date=2018-05-08 time=22:00 format="L LTS" timezone="Asia/Calcutta" timezones="Europe/Paris|America/Los_Angeles"]MD@@ -44,7 +44,7 @@ RSpec.describe "Local Dates" doexpect(cooked).to include("05/08/2018 4:30:00 PM")end- it "requires the right attributes to convert to a local date" do+ it "preserves a date tag without attributes as plain text" dopost = Fabricate(:post, raw: <<~MD)[date]MD@@ -55,7 +55,7 @@ RSpec.describe "Local Dates" doexpect(cooked).to_not include("data-date=")end- it "requires the right attributes to convert to a local date" do+ it "omits date metadata for a date tag without attributes" dopost = Fabricate(:post, raw: <<~MD)[date]MD@@ -66,7 +66,7 @@ RSpec.describe "Local Dates" doexpect(cooked).to_not include("data-date=")end- it "it works with only a date and time" do+ it "renders a local date with only a date and time" doraw = "[date=2018-11-01 time=12:00]"cooked = Fabricate(:post, raw: raw).cookedexpect(cooked).to include('data-date="2018-11-01"')diff --git a/plugins/discourse-local-dates/spec/models/post_spec.rb b/plugins/discourse-local-dates/spec/models/post_spec.rbindex 8a5ae218398..301e6ad9c8d 100644--- a/plugins/discourse-local-dates/spec/models/post_spec.rb+++ b/plugins/discourse-local-dates/spec/models/post_spec.rb@@ -4,7 +4,7 @@ RSpec.describe Post dobefore { Jobs.run_immediately! }describe "#local_dates" do- it "should have correct custom fields" do+ it "stores the parsed dates in custom fields" dopost = Fabricate(:post, raw: <<~SQL)[date=2018-09-17 time=01:39:00 format="LLL" timezone="Europe/Paris" timezones="Europe/Paris|America/Los_Angeles"]SQL@@ -22,7 +22,7 @@ RSpec.describe Post doexpect(post.local_dates).to eq([])end- it "should not contain dates from quotes" do+ it "excludes dates from quotes" dopost = Fabricate(:post, raw: <<~SQL)[quote][date=2018-09-17 time=01:39:00 format="LLL" timezone="Europe/Paris" timezones="Europe/Paris|America/Los_Angeles"]@@ -33,7 +33,7 @@ RSpec.describe Post doexpect(post.local_dates.count).to eq(0)end- it "should not contain dates from examples" do+ it "excludes dates from onebox examples" doOneboxer.stubs(:cached_onebox).with("https://example.com").returns(<<-HTML)<aside class="onebox githubcommit"><span class="discourse-local-date" data-format="ll" data-date="2020-01-20" data-time="15:06:58" data-timezone="UTC">03:06PM - 20 Jan 20 UTC</span>diff --git a/plugins/discourse-login-with-amazon/spec/lib/validators/enable_login_with_amazon_validator_spec.rb b/plugins/discourse-login-with-amazon/spec/lib/validators/enable_login_with_amazon_validator_spec.rbindex 3c62581fb9f..42ea9970125 100644--- a/plugins/discourse-login-with-amazon/spec/lib/validators/enable_login_with_amazon_validator_spec.rb+++ b/plugins/discourse-login-with-amazon/spec/lib/validators/enable_login_with_amazon_validator_spec.rb@@ -5,11 +5,11 @@ RSpec.describe EnableLoginWithAmazonValidator dodescribe "#valid_value?" dodescribe "when login_with_amazon_client_id and login_with_amazon_client_secret has not been set" do- it "should return true when value is false" do+ it "returns true when value is false" doexpect(validator.valid_value?("f")).to eq(true)end- it "should return false when value is true" do+ it "returns false when value is true" doexpect(validator.valid_value?("t")).to eq(false)expect(validator.error_message).to eq(@@ -32,11 +32,11 @@ RSpec.describe EnableLoginWithAmazonValidator doSiteSetting.login_with_amazon_client_secret = "somesecretkey"end- it "should return true when value is false" do+ it "returns true when value is false" doexpect(validator.valid_value?("f")).to eq(true)end- it "should return true when value is true" do+ it "returns true when value is true" doexpect(validator.valid_value?("t")).to eq(true)endenddiff --git a/plugins/discourse-microsoft-auth/spec/lib/microsoft_auth_revoker_spec.rb b/plugins/discourse-microsoft-auth/spec/lib/microsoft_auth_revoker_spec.rbindex 3ab2a3137b6..52bb8ecd535 100644--- a/plugins/discourse-microsoft-auth/spec/lib/microsoft_auth_revoker_spec.rb+++ b/plugins/discourse-microsoft-auth/spec/lib/microsoft_auth_revoker_spec.rb@@ -48,26 +48,26 @@ RSpec.describe MicrosoftAuthRevoker dofab!(:api_key_for_user_2) { Fabricate(:api_key, created_by_id: user_2.id) }fab!(:api_key_for_user_3) { Fabricate(:api_key, created_by_id: user_3.id) }- it "should delete all microsoft provider `UserAssociatedAccount` records" do+ it "deletes all Microsoft provider `UserAssociatedAccount` records" doexpect do MicrosoftAuthRevoker.revoke end.to change { UserAssociatedAccount.count }.by(-2)expect(UserAssociatedAccount.where(provider_name: "microsoft_office365").count).to eq(0)end- it "should deactivate all users with microsoft provider `UserAssociatedAccount` records" do+ it "deactivates all users with Microsoft provider `UserAssociatedAccount` records" doexpect do MicrosoftAuthRevoker.revoke end.to change { User.where(active: true).count }.by(-2)expect(user_1.reload.active).to eq(false)expect(user_2.reload.active).to eq(false)expect(user_3.reload.active).to eq(true)end- it "should delete all `UserAuthToken` records for users with microsoft provider `UserAssociatedAccount` records" do+ it "deletes all `UserAuthToken` records for users with Microsoft provider `UserAssociatedAccount` records" doexpect do MicrosoftAuthRevoker.revoke end.to change { UserAuthToken.count }.by(-2)expect(UserAuthToken.where(user_id: user_1.id).count).to eq(0)expect(UserAuthToken.where(user_id: user_2.id).count).to eq(0)expect(UserAuthToken.where(user_id: user_3.id).count).to eq(1)end- it "should revoke all `UserApiKey` records for users with microsoft provider `UserAssociatedAccount` records" do+ it "revokes all `UserApiKey` records for users with Microsoft provider `UserAssociatedAccount` records" doexpect do MicrosoftAuthRevoker.revoke end.to change {UserApiKey.where(revoked_at: nil).count}.by(-2)@@ -77,7 +77,7 @@ RSpec.describe MicrosoftAuthRevoker doexpect(user_api_key_for_user_3.reload.revoked_at).to be_nilend- it "should revoke all `ApiKey` records created by users with microsoft provider `UserAssociatedAccount` records" do+ it "revokes all `ApiKey` records created by users with Microsoft provider `UserAssociatedAccount` records" doexpect do MicrosoftAuthRevoker.revoke end.to change {ApiKey.where(revoked_at: nil).count}.by(-2)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.rbindex ffd935df4b3..a23c77353f1 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@@ -37,7 +37,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative donarrative.set_data(user, state: :tutorial_poll, topic_id: topic.id, last_post_id: post.id)end- it "should create the right message" do+ it "posts the timeout reminder" doexpect { narrative.notify_timeout(user) }.to change { Post.count }.by(1)expect(Post.last.raw).to eq(@@ -66,7 +66,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative dolet(:post) { Fabricate(:post, topic: topic) }- it "should reset the bot" do+ it "resets the bot to the editing tutorial" donarrative.reset_bot(user, post)expected_raw =@@ -100,7 +100,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when trigger is not initiated in a PM" do- it "should start the new track in a PM" do+ it "starts the new track in a PM" donarrative.reset_bot(user, other_post)expected_raw =@@ -132,7 +132,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doexpect(new_post.topic.id).to_not eq(topic.id)end- it "should not explode if title emojis are disabled" do+ it "creates the tutorial topic when title emojis are disabled" doSiteSetting.max_emojis_in_title = 0narrative.reset_bot(user, other_post)@@ -158,7 +158,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when post is not in the right topic" do- it "should not do anything" do+ it "leaves the editing tutorial unchanged" doother_postnarrative.expects(:enqueue_timeout_job).with(user).never@@ -168,7 +168,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when user replies to the post" do- it "should create the right reply" do+ it "reminds the user to edit the post" dopostnarrative.expects(:enqueue_timeout_job).with(user).once@@ -184,7 +184,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when reply contains the skip trigger" do- it "should create the right reply" do+ it "posts the deletion tutorial instructions" dopost.update!(raw: "@#{discobot_username} #{skip_trigger.upcase}")described_class.any_instance.expects(:enqueue_timeout_job).with(user)@@ -207,7 +207,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative docontext "when user edits the right post" dolet(:post_2) { Fabricate(:post, user: post.user, topic: post.topic) }- it "should create the right reply" do+ it "acknowledges the edit and starts the deletion tutorial" dopost_2expect do@@ -237,7 +237,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when user replies to the topic" do- it "should create the right reply" do+ it "reminds the user to delete a post" donarrative.expects(:enqueue_timeout_job).with(user).oncenarrative.input(:reply, user, post: post)@@ -254,7 +254,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when reply contains the skip trigger" do- it "should create the right reply" do+ it "posts the recovery tutorial instructions" dopost.update!(raw: skip_trigger.upcase)described_class.any_instance.expects(:enqueue_timeout_job).with(user)@@ -275,7 +275,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when user destroys a post in a different topic" do- it "should not do anything" do+ it "leaves the deletion tutorial unchanged" doother_postnarrative.expects(:enqueue_timeout_job).with(user).never@@ -286,7 +286,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when user deletes a post in the right topic" do- it "should create the right reply" do+ it "acknowledges the deletion and starts the recovery tutorial" dopostexpect { PostDestroyer.new(user, post).destroy }.to change { Post.count }.by(2)@@ -302,7 +302,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when user is an admin" do- it "should create the right reply" do+ it "reuses the last post to start the recovery tutorial" dopostuser.update!(admin: true)@@ -334,7 +334,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative docontext "when posts are configured to be deleted immediately" dobefore { SiteSetting.delete_removed_posts_after = 0 }- it "should set up the tutorial correctly" do+ it "preserves the deleted post stub for the recovery tutorial" donarrative.set_data(user,state: :tutorial_delete,@@ -355,7 +355,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when user replies to the topic" do- it "should create the right reply" do+ it "reminds the user to recover a post" donarrative.set_data(user,narrative.get_data(user).merge(tutorial_recover: { post_id: "1" }),@@ -377,7 +377,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when reply contains the skip trigger" do- it "should create the right reply" do+ it "posts the category hashtag tutorial instructions" doparent_category = Fabricate(:category, name: "a")_category = Fabricate(:category, parent_category: parent_category, name: "b")@@ -402,7 +402,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when user recovers a post in a different topic" do- it "should not do anything" do+ it "leaves the recovery tutorial unchanged" doother_postnarrative.expects(:enqueue_timeout_job).with(user).never@@ -414,7 +414,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when user recovers a post in the right topic" do- it "should create the right reply" do+ it "acknowledges recovery and starts the category hashtag tutorial" doparent_category = Fabricate(:category, name: "a")_category = Fabricate(:category, parent_category: parent_category, name: "b")post@@ -446,7 +446,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when post is not in the right topic" do- it "should not do anything" do+ it "leaves the category hashtag tutorial unchanged" doother_postnarrative.expects(:enqueue_timeout_job).with(user).never@@ -457,7 +457,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when user replies to the topic" do- it "should create the right reply" do+ it "reminds the user to include a category hashtag" donarrative.input(:reply, user, post: post)new_post = Post.last@@ -472,7 +472,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when reply contains the skip trigger" do- it "should create the right reply" do+ it "posts the topic notification tutorial instructions" dopost.update!(raw: skip_trigger)described_class.any_instance.expects(:enqueue_timeout_job).with(user)@@ -494,7 +494,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendend- it "should create the right reply" do+ it "acknowledges the hashtag and starts the topic notification tutorial" docategory = Fabricate(:category)post.update!(raw: "Check out this ##{category.slug}")@@ -524,7 +524,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when notification level is changed for another topic" do- it "should not do anything" do+ it "leaves the topic notification tutorial unchanged" doother_topicusernarrative.expects(:enqueue_timeout_job).with(user).never@@ -544,7 +544,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when user replies to the topic" do- it "should create the right reply" do+ it "reminds the user to change the topic notification level" donarrative.input(:reply, user, post: post)new_post = Post.last@@ -561,7 +561,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when reply contains the skip trigger" do- it "should create the right reply" do+ it "posts the poll tutorial instructions" dopost.update!(raw: skip_trigger)described_class.any_instance.expects(:enqueue_timeout_job).with(user)@@ -582,7 +582,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when user changed the topic notification level" do- it "should create the right reply" do+ it "acknowledges the notification change and starts the poll tutorial" doTopicUser.change(user.id,topic.id,@@ -601,7 +601,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when user cannot create polls" do- it "should create the right reply (polls disabled)" do+ it "starts the details tutorial when polls are disabled" doSiteSetting.poll_enabled = falseTopicUser.change(@@ -620,7 +620,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doexpect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_details)end- it "should create the right reply (insufficient trust level)" do+ it "starts the details tutorial when the user's trust level is insufficient" douser.change_trust_level!(TrustLevel[0])TopicUser.change(@@ -665,7 +665,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when post is not in the right topic" do- it "should not do anything" do+ it "leaves the poll tutorial unchanged" doother_postnarrative.expects(:enqueue_timeout_job).with(user).never@@ -675,7 +675,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when user replies to the topic" do- it "should create the right reply" do+ it "reminds the user to create a poll" donarrative.input(:reply, user, post: post)new_post = Post.last@@ -686,7 +686,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when reply contains the skip trigger" do- it "should create the right reply" do+ it "posts the details tutorial instructions" dopost.update!(raw: skip_trigger)described_class.any_instance.expects(:enqueue_timeout_job).with(user)@@ -706,7 +706,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendend- it "should create the right reply" do+ it "acknowledges the poll and starts the details tutorial" dopost.update!(raw: "[poll]\n* 1\n* 2\n[/poll]\n")narrative.input(:reply, user, post: post)@@ -732,7 +732,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when post is not in the right topic" do- it "should not do anything" do+ it "leaves the details tutorial unchanged" doother_postnarrative.expects(:enqueue_timeout_job).with(user).never@@ -742,7 +742,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when user replies to the topic" do- it "should create the right reply" do+ it "reminds the user to include details" donarrative.input(:reply, user, post: post)expect(Post.last.raw).to eq(@@ -755,7 +755,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendcontext "when reply contains the skip trigger" do- it "should create the right reply" do+ it "posts the final reply and ends the tutorial" dopost.update!(raw: skip_trigger)expect do@@ -767,7 +767,7 @@ RSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative doendend- it "should create the right reply and issue the discobot certificate" do+ it "acknowledges the details and issues the discobot certificate" dopost.update!(raw: "[details=\"This is a test\"]\nwooohoo\n[/details]")narrative.input(:reply, user, post: post)diff --git a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rbindex a298c691925..83e49916c2d 100644--- a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb+++ b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb@@ -39,7 +39,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative donarrative.set_data(user, state: :tutorial_images, topic_id: topic.id, last_post_id: post.id)end- it "should create the right message" do+ it "posts and emails the timeout reminder" doNotificationEmailer.enableNotificationEmailer.expects(:process_notification).once@@ -71,7 +71,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dolet(:post) { Fabricate(:post, topic: topic) }- it "should reset the bot" do+ it "resets the bot to the bookmark tutorial" donarrative.reset_bot(user, post)expected_raw =@@ -103,7 +103,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doendcontext "when trigger is not initiated in a PM" do- it "should start the new track in a PM" do+ it "starts the new track in a PM" donarrative.reset_bot(user, other_post)expected_raw =@@ -144,7 +144,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dodescribe "when an error occurs" dobefore { narrative.set_data(user, state: :tutorial_flag, topic_id: topic.id) }- it "should revert to the previous state" do+ it "reverts to the previous state" donarrative.expects(:send).with("init_tutorial_search")@@ -162,14 +162,14 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dodescribe "when input does not have a valid transition from current state" dobefore { narrative.set_data(user, state: :begin) }- it "should raise the right error" do+ it "returns nil and preserves the current state" doexpect(narrative.input(:something, user, post: post)).to eq(nil)expect(narrative.get_data(user)[:state].to_sym).to eq(:begin)endenddescribe "when [:begin, :init]" do- it "should create the right post" do+ it "posts the welcome message and bookmark instructions" donarrative.expects(:enqueue_timeout_job).nevernarrative.input(:init, user, post: nil)@@ -199,7 +199,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dobefore { narrative.set_data(user, state: :tutorial_bookmark, topic_id: topic.id) }describe "when post is not in the right topic" do- it "should not do anything" do+ it "ignores bookmarks outside the tutorial topic" doother_post.update!(user_id: -2)narrative.expects(:enqueue_timeout_job).with(user).never@@ -209,7 +209,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when bookmark is not on bot's post" do- it "should not do anything" do+ it "ignores bookmarks on other users' posts" donarrative.expects(:enqueue_timeout_job).with(user).neverpost@@ -219,7 +219,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when user replies to the topic" do- it "should create the right reply" do+ it "reminds the user to bookmark the post" donarrative.expects(:enqueue_timeout_job).with(user).oncenarrative.input(:reply, user, post: post)@@ -234,7 +234,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dodescribe "when rate_limit_new_user_create_post site setting is disabled" dobefore { SiteSetting.rate_limit_new_user_create_post = 0 }- it "should create the right reply" do+ it "posts the bookmark reminder" donarrative.input(:reply, user, post: post)new_post = Post.last@@ -245,7 +245,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when reply contains the skip trigger" do- it "should create the right reply" do+ it "posts the onebox tutorial instructions" dopost.update!(raw: "@#{discobot_username} #{skip_trigger.upcase}")described_class.any_instance.expects(:enqueue_timeout_job).with(user)@@ -326,7 +326,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doendend- it "should skip tutorials in SiteSetting.discourse_narrative_bot_skip_tutorials" do+ it "skips tutorials configured in discourse_narrative_bot_skip_tutorials" doSiteSetting.discourse_narrative_bot_skip_tutorials = "tutorial_onebox"post.update!(raw: "@#{discobot_username} #{skip_trigger.upcase}")@@ -341,7 +341,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dobefore { narrative.set_data(user, state: :tutorial_onebox, topic_id: topic.id) }describe "when post is not in the right topic" do- it "should not do anything" do+ it "leaves the onebox tutorial unchanged" doother_postnarrative.expects(:enqueue_timeout_job).with(user).never@@ -351,7 +351,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when post does not contain onebox" do- it "should create the right reply" do+ it "reminds the user to include a onebox" donarrative.expects(:enqueue_timeout_job).with(user)narrative.input(:reply, user, post: post)new_post = Post.last@@ -364,7 +364,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when user has not liked bot's post" do- it "should create the right reply" do+ it "posts the missing onebox reminder" donarrative.expects(:enqueue_timeout_job).with(user)narrative.input(:reply, user, post: post)new_post = Post.last@@ -378,7 +378,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dodescribe "when user replies to the topic" dodescribe "when reply contains the skip trigger" do- it "should create the right reply" do+ it "posts the emoji tutorial instructions" dopost.update!(raw: skip_trigger.upcase)described_class.any_instance.expects(:enqueue_timeout_job).with(user)@@ -397,7 +397,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dodescribe "when emoji is disabled" dobefore { SiteSetting.enable_emoji = false }- it "should create the right reply" do+ it "acknowledges the onebox and starts the mention tutorial" dopost.update!(raw: "https://en.wikipedia.org/wiki/Death_by_coconut")narrative.input(:reply, user, post: post)@@ -420,7 +420,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doendend- it "should create the right reply" do+ it "acknowledges the onebox and starts the emoji tutorial" dopost.update!(raw: "https://en.wikipedia.org/wiki/Death_by_coconut")narrative.expects(:enqueue_timeout_job).with(user)@@ -453,7 +453,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when post is not in the right topic" do- it "should not do anything" do+ it "leaves the images tutorial unchanged" doother_postnarrative.expects(:enqueue_timeout_job).with(user).never@@ -464,7 +464,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dodescribe "when user replies to the topic" dodescribe "when reply contains the skip trigger" do- it "should create the right reply" do+ it "posts the flag tutorial instructions" dopost.update!(raw: skip_trigger)described_class.any_instance.expects(:enqueue_timeout_job).with(user)@@ -485,7 +485,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when allow_flagging_staff is false" do- it "should go to the right state" do+ it "skips to the search tutorial" doSiteSetting.allow_flagging_staff = falsepost.update!(raw: skip_trigger)@@ -498,7 +498,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doendcontext "when image is not found" do- it "should create the right replies" do+ it "prompts for an image and advances after receiving an image URL" doPostActionCreator.like(user, post_2)described_class.any_instance.expects(:enqueue_timeout_job).with(user)@@ -551,7 +551,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doendend- it "should create the right replies" do+ it "prompts for an image and a like before advancing to flagging" dodescribed_class.any_instance.expects(:enqueue_timeout_job).with(user)DiscourseNarrativeBot::TrackSelector.new(:reply, user, post_id: post.id).select@@ -629,7 +629,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when post is not in the right topic" do- it "should not do anything" do+ it "leaves the likes tutorial unchanged" doother_postnarrative.expects(:enqueue_timeout_job).with(user).never@@ -640,7 +640,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dodescribe "when user replies to the topic" dodescribe "when reply contains the skip trigger" do- it "should create the right reply" do+ it "posts the flag tutorial instructions" dopost.update!(raw: skip_trigger)described_class.any_instance.expects(:enqueue_timeout_job).with(user)@@ -661,7 +661,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when allow_flagging_staff is false" do- it "should go to the right state" do+ it "skips to the search tutorial" doSiteSetting.allow_flagging_staff = falsepost.update!(raw: skip_trigger)@@ -672,7 +672,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doendend- it "should create the right reply" do+ it "reminds the user to like the post" donarrative.expects(:enqueue_timeout_job).with(user).oncenarrative.input(:reply, user, post: post)@@ -691,7 +691,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when the post is liked" do- it "should create the right reply" do+ it "acknowledges the like and starts the flag tutorial" doPostActionCreator.like(user, post_2)expected_raw = <<~RAW@@ -717,7 +717,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dobefore { narrative.set_data(user, state: :tutorial_formatting, topic_id: topic.id) }describe "when post is not in the right topic" do- it "should not do anything" do+ it "leaves the formatting tutorial unchanged" doother_postnarrative.expects(:enqueue_timeout_job).with(user).never@@ -727,7 +727,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when post does not contain any formatting" do- it "should create the right reply" do+ it "reminds the user to format their reply" donarrative.expects(:enqueue_timeout_job).with(user)narrative.input(:reply, user, post: post)@@ -740,7 +740,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dodescribe "when user replies to the topic" dodescribe "when reply contains the skip trigger" do- it "should create the right reply" do+ it "posts the quoting tutorial instructions" dopost.update!(raw: skip_trigger)described_class.any_instance.expects(:enqueue_timeout_job).with(user)@@ -761,7 +761,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doend["**bold**", "__italic__", "[b]bold[/b]", "[i]italic[/i]"].each do |raw|- it "should create the right reply" do+ it "acknowledges the formatting and starts the quoting tutorial" dopost.update!(raw: raw)narrative.expects(:enqueue_timeout_job).with(user)@@ -784,7 +784,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dobefore { narrative.set_data(user, state: :tutorial_quote, topic_id: topic.id) }describe "when post is not in the right topic" do- it "should not do anything" do+ it "leaves the quoting tutorial unchanged" doother_postnarrative.expects(:enqueue_timeout_job).with(user).never@@ -794,7 +794,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when post does not contain any quotes" do- it "should create the right reply" do+ it "reminds the user to include a quote" donarrative.expects(:enqueue_timeout_job).with(user)narrative.input(:reply, user, post: post)@@ -807,7 +807,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dodescribe "when user replies to the topic" dodescribe "when reply contains the skip trigger" do- it "should create the right reply" do+ it "posts the images tutorial instructions" dopost.update!(raw: skip_trigger)described_class.any_instance.expects(:enqueue_timeout_job).with(user)@@ -825,7 +825,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doexpect(narrative.get_data(user)[:state].to_sym).to eq(:tutorial_images)end- it "should use correct path to images on subfolder installs" do+ it "includes the subfolder in image paths" doGlobalSetting.stubs(:relative_url_root).returns("/forum")Discourse.stubs(:base_path).returns("/forum")@@ -845,7 +845,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doGroup.refresh_automatic_groups!end- it "should skip the images tutorial step" do+ it "skips the images tutorial step" dopost.update!(raw:"[quote=\"#{post.user}, post:#{post.post_number}, topic:#{topic.id}\"]\n:monkey: :fries:\n[/quote]",@@ -858,7 +858,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doendend- it "should create the right reply" do+ it "acknowledges the quote and starts the images tutorial" dopost.update!(raw:"[quote=\"#{post.user}, post:#{post.post_number}, topic:#{topic.id}\"]\n:monkey: :fries:\n[/quote]",@@ -884,7 +884,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dobefore { narrative.set_data(user, state: :tutorial_emoji, topic_id: topic.id) }describe "when post is not in the right topic" do- it "should not do anything" do+ it "leaves the emoji tutorial unchanged" doother_postnarrative.expects(:enqueue_timeout_job).with(user).never@@ -894,7 +894,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when post does not contain any emoji" do- it "should create the right reply" do+ it "reminds the user to include an emoji" donarrative.expects(:enqueue_timeout_job).with(user)narrative.input(:reply, user, post: post)@@ -907,7 +907,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dodescribe "when user replies to the topic" dodescribe "when reply contains the skip trigger" do- it "should create the right reply" do+ it "posts the mention tutorial instructions" dopost.update!(raw: skip_trigger)described_class.any_instance.expects(:enqueue_timeout_job).with(user)@@ -931,7 +931,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dodescribe "when user mentions is disabled" dobefore { SiteSetting.enable_mentions = false }- it "should skip the mention tutorial step" do+ it "skips the mention tutorial step" dopost.update!(raw: ":monkey: :fries:")narrative.expects(:enqueue_timeout_job).with(user)@@ -941,7 +941,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doendend- it "should create the right reply" do+ it "acknowledges the emoji and starts the mention tutorial" dopost.update!(raw: ":monkey: :fries:")narrative.expects(:enqueue_timeout_job).with(user)@@ -969,7 +969,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dobefore { narrative.set_data(user, state: :tutorial_mention, topic_id: topic.id) }describe "when post is not in the right topic" do- it "should not do anything" do+ it "leaves the mention tutorial unchanged" doother_postnarrative.expects(:enqueue_timeout_job).with(user).never@@ -979,7 +979,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when post does not contain any mentions" do- it "should create the right reply" do+ it "reminds the user to mention discobot" donarrative.expects(:enqueue_timeout_job).with(user)narrative.input(:reply, user, post: post)@@ -997,7 +997,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when reply contains the skip trigger" do- it "should create the right reply" do+ it "posts the formatting tutorial instructions" dopost.update!(raw: skip_trigger)described_class.any_instance.expects(:enqueue_timeout_job).with(user)@@ -1017,7 +1017,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doendend- it "should create the right reply" do+ it "acknowledges the mention and starts the formatting tutorial" dopost.update!(raw: "@disCoBot hello how are you doing today?")narrative.expects(:enqueue_timeout_job).with(user)@@ -1064,7 +1064,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when post flagged is not for the right topic" do- it "should not do anything" do+ it "leaves the flag tutorial unchanged" donarrative.expects(:enqueue_timeout_job).with(user).neverflag.update!(post: other_post)@@ -1074,7 +1074,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when post is flagged incorrectly" do- it "should create the right reply and stay on the same step" do+ it "posts the flag reminder and stays on the same step" donarrative.expects(:enqueue_timeout_job).with(user).neverother_flag.update!(post: another_post)new_post = Post.last@@ -1087,7 +1087,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when post being flagged does not belong to discobot " do- it "should not do anything" do+ it "ignores flags on posts that do not belong to discobot" donarrative.expects(:enqueue_timeout_job).with(user).neverflag.update!(post: other_post)@@ -1097,7 +1097,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when user replies to the topic" do- it "should create the right reply" do+ it "reminds the user to flag the post" donarrative.input(:reply, user, post: other_post)new_post = Post.last@@ -1108,7 +1108,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when reply contains the skip trigger" do- it "should create the right reply" do+ it "posts the search tutorial instructions" doother_post.update!(raw: skip_trigger)described_class.any_instance.expects(:enqueue_timeout_job).with(user)@@ -1128,7 +1128,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doendend- it "should create the right reply" do+ it "acknowledges and removes the flag before starting the search tutorial" donarrative.expects(:enqueue_timeout_job).with(user)expect { narrative.input(:flag, user, post: flag.post) }.to change { PostAction.count }.by(@@ -1158,7 +1158,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative dobefore { narrative.set_data(user, state: :tutorial_search, topic_id: topic.id) }describe "when post is not in the right topic" do- it "should not do anything" do+ it "leaves the search tutorial unchanged" doother_postnarrative.expects(:enqueue_timeout_job).with(user).never@@ -1168,7 +1168,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doenddescribe "when post does not contain the right answer" do- it "should create the right reply" do+ it "reminds the user to find the search answer" donarrative.expects(:enqueue_timeout_job).with(user)narrative.input(:reply, user, post: post)@@ -1200,7 +1200,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative do)end- it "should clean up if the tutorial is skipped" do+ it "cleans up if the tutorial is skipped" dopost.update!(raw: skip_trigger)expect do@@ -1211,7 +1211,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative doexpect(narrative.get_data(user)[:state].to_sym).to eq(:end)end- it "should create the right reply" do+ it "acknowledges the answer and awards the tutorial badge" dopost.update!(raw: "#{described_class.search_answer} this is a capybara")expect do@@ -1241,7 +1241,7 @@ RSpec.describe DiscourseNarrativeBot::NewUserNarrative do).to eq(true)end- it "should accept a raw emoji" do+ it "accepts a raw emoji" dopost.update!(raw: "#{described_class.search_answer_emoji} this is the emoji you mentioned",)diff --git a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/store_spec.rb b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/store_spec.rbindex 874af6ad672..acd78150dcd 100644--- a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/store_spec.rb+++ b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/store_spec.rb@@ -2,7 +2,7 @@RSpec.describe DiscourseNarrativeBot::Store dodescribe ".set" do- it "should set the right value in the plugin store" do+ it "sets the expected value in the plugin store" dokey = "somekey"described_class.set(key, "yay")plugin_store_row = PluginStoreRow.last@@ -14,7 +14,7 @@ RSpec.describe DiscourseNarrativeBot::Store doenddescribe ".get" do- it "should get the right value from the plugin store" do+ it "gets the expected value from the plugin store" doPluginStoreRow.create!(plugin_name: DiscourseNarrativeBot::PLUGIN_NAME,key: "somekey",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.rbindex 8306f8bc938..519d8f20d4f 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@@ -83,7 +83,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when bot is mentioned" do- it "should select the right track" do+ it "selects the expected track" dopost.update!(raw: "@discobot show me what you can do")described_class.new(:reply, user, post_id: post.id).selectnew_post = Post.last@@ -95,7 +95,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when bot is replied to" do- it "should select the right track" do+ it "selects the expected track" dopost.update!(raw: "show me what you can do",reply_to_post_number: first_post.post_number,@@ -131,7 +131,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doexpect(Post.last.raw).to eq(expected_raw.chomp)end- it "should not enqueue any user email" do+ it "does not enqueue any user email" doNotificationEmailer.enableuser.user_option.update!(email_level: UserOption.email_level_types[:always])@@ -151,7 +151,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when a non regular post is created" do- it "should not do anything" do+ it "does nothing" domoderator_post = Fabricate(:moderator_post, user: user, topic: topic)expect do@@ -161,7 +161,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when user thank the bot" do- it "should like the post" do+ it "likes the post" dopost.update!(raw: "thanks!")expect { described_class.new(:reply, user, post_id: post.id).select }.to change {@@ -179,7 +179,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when reply contains a reset trigger" do- it "should reset the track" do+ it "resets the track" dopost.update!(raw:"#{described_class.reset_trigger} #{DiscourseNarrativeBot::NewUserNarrative.reset_trigger}",@@ -193,7 +193,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when reset trigger in surrounded by quotes" do- it "should reset the track" do+ it "resets the track" dopost.update!(raw:"'#{described_class.reset_trigger} #{DiscourseNarrativeBot::NewUserNarrative.reset_trigger}'",@@ -209,7 +209,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector docontext "when reset trigger in a middle of a sentence" docontext "when post is less than reset trigger exact match limit" do- it "should reset the track" do+ it "resets the track" dopost.update!(raw:"I would like to #{described_class.reset_trigger} #{DiscourseNarrativeBot::NewUserNarrative.reset_trigger} now",@@ -224,7 +224,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when post exceeds reset trigger exact match limit" do- it "should not reset the track" do+ it "does not reset the track" dopost.update!(raw:"I would like to #{described_class.reset_trigger} #{DiscourseNarrativeBot::NewUserNarrative.reset_trigger} now #{"a" * described_class::RESET_TRIGGER_EXACT_MATCH_LENGTH}",@@ -245,7 +245,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector docontext "when a new user is added into the topic" dobefore { topic.allowed_users << Fabricate(:user) }- it "should stop the new user track" do+ it "stops the new user track" dopostexpect { described_class.new(:reply, user, post_id: post.id).select }.to_not change {@@ -270,7 +270,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doDiscourse.redis.del("#{described_class::GENERIC_REPLIES_COUNT_PREFIX}#{user.id}")end- it "should create the right generic do not understand responses" do+ it "creates the expected generic misunderstanding responses" dodescribed_class.new(:reply, user, post_id: post.id).selectnew_post = Post.last@@ -320,7 +320,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when discobot is mentioned at the end of a track" do- it "should create the right reply" do+ it "creates the expected reply" dopost.update!(raw: "Show me what you can do @discobot")described_class.new(:reply, user, post_id: post.id).selectnew_post = Post.last@@ -329,7 +329,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when asking discobot for help" do- it "should create the right reply" do+ it "creates the expected reply" dopost.update!(raw: "show me what you can do @discobot display help")described_class.new(:reply, user, post_id: post.id).select@@ -337,7 +337,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "as an admin or moderator" do- it "should include the commands to start the advanced user track" do+ it "includes the commands that start the advanced user track" douser.update!(moderator: true)post.update!(raw: "Show me what you can do @discobot display help")described_class.new(:reply, user, post_id: post.id).select@@ -350,7 +350,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "as a user that has completed the new user track" do- it "should include the commands to start the advanced user track" do+ it "includes the commands that start the advanced user track" donarrative.set_data(user,state: :end,@@ -377,7 +377,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector docontext "when discobot is asked to roll dice" dobefore { narrative.set_data(user, state: :end, topic_id: topic.id) }- it "should create the right reply" do+ it "creates the expected reply" dopost.update!(raw: "roll 2d1")described_class.new(:reply, user, post_id: post.id).selectnew_post = Post.last@@ -390,7 +390,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector docontext "when range of dice request is too high" dobefore { srand(1) }- it "should create the right reply" do+ it "creates the expected reply" dostub_request(:get,"https://www.wired.com/2016/05/mathematical-challenge-of-designing-the-worlds-most-complex-120-sided-dice",@@ -413,7 +413,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when number of dice to roll is too high" do- it "should create the right reply" do+ it "creates the expected reply" dopost.update!(raw: "roll #{DiscourseNarrativeBot::Dice::MAXIMUM_NUM_OF_DICE + 1}d1")described_class.new(:reply, user, post_id: post.id).selectnew_post = Post.last@@ -429,7 +429,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when dice combination is invalid" do- it "should create the right reply" do+ it "creates the expected reply" dopost.update!(raw: "roll 0d1")described_class.new(:reply, user, post_id: post.id).select@@ -442,7 +442,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector docontext "when in a normal PM with discobot" docontext "when discobot is replied to" do- it "should create the right reply" do+ it "creates the expected reply" doSiteSetting.discourse_narrative_bot_disable_public_replies = truepost.update!(raw: "Show me what you can do @discobot")described_class.new(:reply, user, post_id: post.id).select@@ -462,7 +462,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendend- it "should not rate limit help message" do+ it "does not rate-limit the help message" dopost.update!(raw: "@discobot")other_post = Fabricate(:post, raw: "discobot", topic: post.topic)@@ -483,7 +483,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector dobefore { SiteSetting.discourse_narrative_bot_disable_public_replies = true }context "when discobot is mentioned" do- it "should not reply" do+ it "does not reply" dopost.update!(raw: "Show me what you can do @discobot")expect do described_class.new(:reply, user, post_id: post.id).select end.to_not change {@@ -494,7 +494,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when discobot is mentioned" do- it "should create the right reply" do+ it "creates the expected reply" dopost.update!(raw: "Show me what you can do @discobot")described_class.new(:reply, user, post_id: post.id).selectnew_post = Post.last@@ -513,7 +513,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do)end- it "should be case insensitive towards discobot's username" do+ it "matches discobot's username case-insensitively" dodiscobot_user.update!(username: "DisCoBot")post.update!(raw: "Show me what you can do @discobot")@@ -522,7 +522,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doexpect(new_post.raw).to eq(random_mention_reply)end- it "should not like the public post" do+ it "does not like the public post" dopost.update!(raw: "thanks @discobot!")expect { described_class.new(:reply, user, post_id: post.id).select }.not_to change {@@ -541,7 +541,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doafter { Discourse.redis.flushdb }context "when random reply massage has been displayed in the last 6 hours" do- it "should not do anything" do+ it "does nothing" doDiscourse.redis.set("#{described_class::PUBLIC_DISPLAY_BOT_HELP_KEY}:#{other_post.topic_id}",post.post_number - 11,@@ -559,7 +559,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when random reply message has not been displayed in the last 6 hours" do- it "should create the right reply" do+ it "creates the expected reply" doDiscourse.redis.set("#{described_class::PUBLIC_DISPLAY_BOT_HELP_KEY}:#{other_post.topic_id}",post.post_number - 11,@@ -577,7 +577,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when random reply message has been displayed in the last 10 replies" do- it "should not do anything" do+ it "does nothing" dodescribed_class.new(:reply, user, post_id: other_post.id).selectexpect(Post.last.raw).to eq(random_mention_reply)@@ -599,7 +599,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when asking discobot for help" do- it "should create the right reply" do+ it "creates the expected reply" dopost.update!(raw: "@discobot display help")described_class.new(:reply, user, post_id: post.id).select@@ -609,7 +609,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector docontext "when asking discobot to start new user track" docontext "with invalid text" do- it "should not trigger the bot" do+ it "does not trigger the bot" dopost.update!(raw:"`@discobot #{I18n.t("discourse_narrative_bot.track_selector.reset_trigger")} #{DiscourseNarrativeBot::NewUserNarrative.reset_trigger}`",@@ -623,7 +623,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when discobot is asked to roll dice" do- it "should create the right reply" do+ it "creates the expected reply" dopost.update!(raw: "@discobot roll 2d1")described_class.new(:reply, user, post_id: post.id).selectnew_post = Post.last@@ -633,7 +633,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector do)end- it "should ignore extra whitespace proceeding the mention" do+ it "ignores extra whitespace preceding the mention" dopost.update!(raw: "@discobot roll 2d1")described_class.new(:reply, user, post_id: post.id).selectnew_post = Post.last@@ -644,7 +644,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when dice roll is requested incorrectly" do- it "should create the right reply" do+ it "creates the expected reply" dopost.update!(raw: "roll 2d1 @discobot")described_class.new(:reply, user, post_id: post.id).select@@ -653,7 +653,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when roll dice command is present inside a quote" do- it "should ignore the command" do+ it "ignores the command" douserpost.update!(raw: "[quote=\"Donkey, post:6, topic:1\"]\n@discobot roll 2d1\n[/quote]")@@ -665,7 +665,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when a quote is requested" do- it "should create the right reply" do+ it "creates the expected reply" dopost.update!(raw: "@discobot quote")described_class.new(:reply, user, post_id: post.id).selectnew_post = Post.last@@ -674,7 +674,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when quote is requested incorrectly" do- it "should create the right reply" do+ it "creates the expected reply" dopost.update!(raw: "quote @discobot")described_class.new(:reply, user, post_id: post.id).select@@ -683,7 +683,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when quote command is present inside a onebox or quote" do- it "should ignore the command" do+ it "ignores the command" douserpost.update!(raw: "[quote=\"Donkey, post:6, topic:1\"]\n@discobot quote\n[/quote]")@@ -697,7 +697,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector docontext "when magic 8 ball is requested" dobefore { srand(1) }- it "should create the right reply" do+ it "creates the expected reply" dopost.update!(raw: "@discobot fortune")described_class.new(:reply, user, post_id: post.id).select@@ -712,7 +712,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector docontext "when bot is asked to reset/start a track" docontext "when user likes a post containing a reset trigger" do- it "should not start the track" do+ it "does not start the track" doanother_post =Fabricate(:post,@@ -747,7 +747,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doafter { @overrides.each(&:destroy!) }- it "should start the right track" do+ it "starts the expected track" dopost.update!(raw:"@discobot #{I18n.t("discourse_narrative_bot.track_selector.reset_trigger")} #{DiscourseNarrativeBot::AdvancedUserNarrative.reset_trigger}",@@ -771,7 +771,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector dolet(:other_post) { Fabricate(:post, topic: other_topic) }context "when a new message is made" do- it "should not do anything" do+ it "does nothing" doother_postexpect {@@ -791,7 +791,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector dolet(:other_post) { Fabricate(:post, topic: other_topic) }context "when a new like is made" do- it "should not do anything" do+ it "does nothing" doother_postexpect { described_class.new(:like, user, post_id: other_post.id).select }.to_not change {Post.count@@ -800,7 +800,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when a new message is made" do- it "should create the right reply" do+ it "creates the expected reply" dodescribed_class.new(:reply, user, post_id: other_post.id).selectexpect(Post.last.raw).to eq(random_mention_reply)@@ -808,7 +808,7 @@ RSpec.describe DiscourseNarrativeBot::TrackSelector doendcontext "when user thanks the bot" do- it "should like the post" do+ it "likes the post" doother_post.update!(raw: "thanks!")expect { described_class.new(:reply, user, post_id: other_post.id).select }.to change {diff --git a/plugins/discourse-narrative-bot/spec/jobs/send_default_welcome_message_spec.rb b/plugins/discourse-narrative-bot/spec/jobs/send_default_welcome_message_spec.rbindex bc5263b5db8..c7b0cb2e13f 100644--- a/plugins/discourse-narrative-bot/spec/jobs/send_default_welcome_message_spec.rb+++ b/plugins/discourse-narrative-bot/spec/jobs/send_default_welcome_message_spec.rb@@ -3,7 +3,7 @@RSpec.describe Jobs::SendDefaultWelcomeMessage dolet(:user) { Fabricate(:user) }- it "should send the right welcome message" do+ it "sends the default welcome message in a closed topic" dodescribed_class.new.execute(user_id: user.id)topic = Topic.last@@ -33,7 +33,7 @@ RSpec.describe Jobs::SendDefaultWelcomeMessage do)end- it "should send the right welcome message" do+ it "sends the invited user welcome message in a closed topic" dodescribed_class.new.execute(user_id: invited_user.user_id)topic = Topic.lastdiff --git a/plugins/discourse-narrative-bot/spec/lib/certificate_generator_spec.rb b/plugins/discourse-narrative-bot/spec/lib/certificate_generator_spec.rbindex 564ed44bfb4..2c99f1b981a 100644--- a/plugins/discourse-narrative-bot/spec/lib/certificate_generator_spec.rb+++ b/plugins/discourse-narrative-bot/spec/lib/certificate_generator_spec.rb@@ -6,7 +6,7 @@ RSpec.describe DiscourseNarrativeBot::CertificateGenerator dolet(:date) { "2017-00-10" }describe "when an invalid date is given" do- it "should default to the current date" do+ it "defaults to the current date" doexpect { described_class.new(user, date, avatar_url) }.to_not raise_errorendend@@ -15,7 +15,7 @@ RSpec.describe DiscourseNarrativeBot::CertificateGenerator dodescribe "when SiteSetting.site_logo_small_url is blank" dobefore { SiteSetting.logo_small = "" }- it "should not try to fetch a image" do+ it "does not fetch an image" doexpect(described_class.new(user, date, avatar_url).send(:logo_group, 1, 1, 1)).to eq(nil)endenddiff --git a/plugins/discourse-narrative-bot/spec/lib/site_setting_spec.rb b/plugins/discourse-narrative-bot/spec/lib/site_setting_spec.rbindex 691ee1a2da2..549998671dc 100644--- a/plugins/discourse-narrative-bot/spec/lib/site_setting_spec.rb+++ b/plugins/discourse-narrative-bot/spec/lib/site_setting_spec.rb@@ -6,7 +6,7 @@ RSpec.describe SiteSetting dobefore { SiteSetting.discourse_narrative_bot_enabled = true }- it "should update bot's `UserProfile#bio_raw` when `default_locale` site setting is changed" do+ it "updates the bot profile biography when default_locale changes" doexpect(discobot_user.user_profile.bio_raw).to eq(I18n.with_locale(:en) { I18n.t("discourse_narrative_bot.bio") },)diff --git a/plugins/discourse-narrative-bot/spec/requests/discobot_certificate_spec.rb b/plugins/discourse-narrative-bot/spec/requests/discobot_certificate_spec.rbindex 8d3f0908d93..17c3ff536c9 100644--- a/plugins/discourse-narrative-bot/spec/requests/discobot_certificate_spec.rb+++ b/plugins/discourse-narrative-bot/spec/requests/discobot_certificate_spec.rb@@ -8,7 +8,7 @@ RSpec.describe "Discobot Certificate" dodescribe "when viewing the certificate" dodescribe "when no logged in" do- it "should return the right response" do+ it "returns the expected response" doget "/discobot/certificate.svg", params: paramsexpect(response.status).to eq(404)@@ -18,7 +18,7 @@ RSpec.describe "Discobot Certificate" dodescribe "when logged in" dobefore { sign_in(user) }- it "should return the right text" do+ it "returns the expected text" dostub_request(:get, /letter_avatar_proxy/).to_return(status: 200,body: "http://test.localhost/cdn/avatar.png",@@ -36,7 +36,7 @@ RSpec.describe "Discobot Certificate" doenddescribe "when params are missing" do- it "should raise the right errors" do+ it "raises the expected errors" doparams.each do |key, _|get "/discobot/certificate.svg", params: params.except(key)expect(response.status).to eq(400)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.rbindex 8b73087375c..d6ccc21db98 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@@ -9,7 +9,7 @@ RSpec.describe "Discobot welcome post" doendcontext "when discourse_narrative_bot_welcome_post_delay is 0" do- it "should not delay the welcome post" do+ it "sends the welcome post immediately" douserexpect { sign_in(user) }.to_not change { Jobs::NarrativeInit.jobs.count }end@@ -19,7 +19,7 @@ RSpec.describe "Discobot welcome post" dobefore { SiteSetting.discourse_narrative_bot_welcome_post_delay = 5 }context "when user logs in normally" do- it "should delay the welcome post until user logs in" do+ it "delays the welcome post until the user logs in" doexpect { sign_in(user) }.to change { Jobs::NarrativeInit.jobs.count }.by(1)expect(Jobs::NarrativeInit.jobs.first["args"].first["user_id"]).to eq(user.id)end@@ -30,7 +30,7 @@ RSpec.describe "Discobot welcome post" doFabricate(:invite, invited_by: Fabricate(:admin), email: "[email protected]")end- it "should delay the welcome post until the user logs in" do+ it "delays the welcome post until the user logs in" doexpect doput "/invites/show/#{invite.invite_key}.json",params: {@@ -51,7 +51,7 @@ RSpec.describe "Discobot welcome post" dobefore { SiteSetting.discourse_narrative_bot_welcome_post_type = "welcome_message" }- it "should not send welcome message" do+ it "does not send a welcome message" doexpect { staged_user }.to_not change { Jobs::SendDefaultWelcomeMessage.jobs.count }endenddiff --git a/plugins/discourse-narrative-bot/spec/user_spec.rb b/plugins/discourse-narrative-bot/spec/user_spec.rbindex 6f001f01a38..fadbca794b3 100644--- a/plugins/discourse-narrative-bot/spec/user_spec.rb+++ b/plugins/discourse-narrative-bot/spec/user_spec.rb@@ -13,7 +13,7 @@ RSpec.describe User doenddescribe "when a user is created" do- it "should initiate the bot" do+ it "starts the bot tutorial" doNotificationEmailer.expects(:process_notification).neveruser@@ -33,7 +33,7 @@ RSpec.describe User docontext "when disabled" dobefore { SiteSetting.disable_discourse_narrative_bot_welcome_post = true }- it "should not initiate the bot" do+ it "does not start the bot tutorial" doexpect { user }.to_not change { Post.count }endend@@ -70,7 +70,7 @@ RSpec.describe User dodescribe "when send welcome message is selected" dobefore { SiteSetting.discourse_narrative_bot_welcome_post_type = "welcome_message" }- it "should send the right welcome message" do+ it "sends the configured welcome message" doexpect { user }.to change { Topic.count }.by(1)expect(Topic.last.title).to eq(@@ -86,7 +86,7 @@ RSpec.describe User dodescribe "when welcome message is configured to be delayed" dobefore { SiteSetting.discourse_narrative_bot_welcome_post_delay = 100 }- it "should delay the welcome post until user logs in" do+ it "delays the welcome post until the user logs in" douserexpect(Jobs::NarrativeInit.jobs.count).to eq(0)@@ -98,7 +98,7 @@ RSpec.describe User docontext "when user is staged" dolet(:user) { Fabricate(:user, staged: true) }- it "should not initiate the bot" do+ it "does not start the bot tutorial" doexpect { user }.to_not change { Post.count }endend@@ -106,7 +106,7 @@ RSpec.describe User docontext "when user skipped the new user tips" dolet(:user) { Fabricate(:user) }- it "should not initiate the bot" do+ it "does not start the bot tutorial" doSiteSetting.default_other_skip_new_user_tips = trueexpect { user }.to_not change { Post.count }end@@ -115,7 +115,7 @@ RSpec.describe User docontext "when user is anonymous?" dobefore { SiteSetting.allow_anonymous_mode = true }- it "should initiate bot for real user only" do+ it "starts the bot only for the real user" douser = Fabricate(:user, trust_level: 1)Group.refresh_automatic_groups!shadow = AnonymousShadowCreator.get(user)@@ -131,7 +131,7 @@ RSpec.describe User dobefore { SiteSetting.discourse_narrative_bot_ignored_usernames = "discourse|test" }%w[discourse test].each do |username|- it "should not initiate the bot" do+ it "does not start the bot tutorial" doexpect { user.update!(username: username) }.to_not change { Post.count }endend@@ -139,7 +139,7 @@ RSpec.describe User doenddescribe "when a user has been destroyed" do- it "should clean up plugin's store" do+ it "removes the user's plugin-store data" doDiscourseNarrativeBot::Store.set(user.id, "test")user.destroy!diff --git a/plugins/discourse-oauth2-basic/spec/plugin_spec.rb b/plugins/discourse-oauth2-basic/spec/plugin_spec.rbindex 7ac0f9f768a..1dbff39858a 100644--- a/plugins/discourse-oauth2-basic/spec/plugin_spec.rb+++ b/plugins/discourse-oauth2-basic/spec/plugin_spec.rb@@ -92,7 +92,7 @@ describe OAuth2BasicAuthenticator dolet(:fail_response) { { status: 403 } }- it "works" do+ it "supports GET and POST requests" dostub_request(:get, SiteSetting.oauth2_user_json_url).to_return(success_response)result = authenticator.after_authenticate(auth)expect(result.email).to eq("[email protected]")diff --git a/plugins/discourse-patreon/spec/integration/patreon_spec.rb b/plugins/discourse-patreon/spec/integration/patreon_spec.rbindex 7e702cc6378..43bba193c29 100644--- a/plugins/discourse-patreon/spec/integration/patreon_spec.rb+++ b/plugins/discourse-patreon/spec/integration/patreon_spec.rb@@ -14,11 +14,11 @@ RSpec.describe Patreon docontext "with donation prompt enabled" dobefore { SiteSetting.patreon_donation_prompt_enabled = true }- it "should not show donation prompt to patrons" do+ it "does not show the donation prompt to patrons" doexpect(described_class.show_donation_prompt_to_user?(user1)).to eq(false)end- it "should show donation prompt to non-patrons" do+ it "shows the donation prompt to non-patrons" doexpect(described_class.show_donation_prompt_to_user?(user2)).to eq(true)endend@@ -26,7 +26,7 @@ RSpec.describe Patreon docontext "with donation prompt disabled" dobefore { SiteSetting.patreon_donation_prompt_enabled = false }- it "should show donation prompt to non-patrons" do+ it "shows the donation prompt to non-patrons" doexpect(described_class.show_donation_prompt_to_user?(user2)).to eq(false)endenddiff --git a/plugins/discourse-patreon/spec/jobs/patreon_update_tokens_spec.rb b/plugins/discourse-patreon/spec/jobs/patreon_update_tokens_spec.rbindex 29ccafce90a..f546d06dec3 100644--- a/plugins/discourse-patreon/spec/jobs/patreon_update_tokens_spec.rb+++ b/plugins/discourse-patreon/spec/jobs/patreon_update_tokens_spec.rb@@ -6,7 +6,7 @@ RSpec.describe Jobs::PatreonUpdateTokens dobefore { SiteSetting.patreon_enabled = true }shared_examples "token refresh" do- it "should update both access and refresh tokens from Patreon" do+ it "updates both access and refresh tokens from Patreon" dodescribed_class.new.execute({})expect(SiteSetting.patreon_creator_access_token).to eq("ACCESS TOKEN")diff --git a/plugins/discourse-patreon/spec/lib/api_spec.rb b/plugins/discourse-patreon/spec/lib/api_spec.rbindex 1b7e82cf517..b7b5057db97 100644--- a/plugins/discourse-patreon/spec/lib/api_spec.rb+++ b/plugins/discourse-patreon/spec/lib/api_spec.rb@@ -15,13 +15,13 @@ RSpec.describe Patreon::Api dobefore { SiteSetting.patreon_api_version = "1" }- it "should add admin warning message for invalid api response" do+ it "adds an admin warning for an invalid API response" dostub_url(401, url)described_class.campaign_dataexpect(ProblemCheckTracker[:access_token_invalid].blips).to eq(1)end- it "should add warning log" do+ it "logs a warning" dostub_url(500, url)Discourse.expects(:warn_exception).oncedescribed_class.campaign_data@@ -45,7 +45,7 @@ RSpec.describe Patreon::Api dobefore { SiteSetting.patreon_api_version = "2" }- it "should add admin warning message for invalid api response" do+ it "adds an admin warning for an invalid API response" dostub_url(401, url)described_class.campaign_dataexpect(ProblemCheckTracker[:access_token_invalid].blips).to eq(1)@@ -54,7 +54,7 @@ RSpec.describe Patreon::Api do)end- it "should not add admin warning message for valid api response" do+ it "does not add an admin warning for a valid API response" dostub_url(200, url)described_class.campaign_data@@ -62,7 +62,7 @@ RSpec.describe Patreon::Api doexpect(AdminNotice.find_by(identifier: :access_token_invalid)).to eq(nil)end- it "should clear an existing admin warning message once the api responds again" do+ it "clears the admin warning when the API responds again" dostub_url(401, url)described_class.campaign_dataexpect(AdminNotice.find_by(identifier: :access_token_invalid)).to be_present@@ -75,7 +75,7 @@ RSpec.describe Patreon::Api doexpect(AdminNotice.find_by(identifier: :access_token_invalid)).to eq(nil)end- it "should add warning log" do+ it "logs a warning" dostub_url(500, url)Discourse.expects(:warn_exception).onceexpect(described_class.campaign_data).to eq(error: I18n.t(described_class::INVALID_RESPONSE))diff --git a/plugins/discourse-patreon/spec/lib/campaign_spec.rb b/plugins/discourse-patreon/spec/lib/campaign_spec.rbindex a9bd59e1dd0..191a12810d4 100644--- a/plugins/discourse-patreon/spec/lib/campaign_spec.rb+++ b/plugins/discourse-patreon/spec/lib/campaign_spec.rb@@ -4,7 +4,7 @@ require_relative "../spec_helper"RSpec.describe Patreon::Campaign doshared_examples "campaign sync" do- it "should update campaigns and group users data" do+ it "updates campaigns and group membership data" doexpect { described_class.update! }.to change { Group.count }.by(1)expect(Group.find_by(name: "patrons")).to be_presentdiff --git a/plugins/discourse-patreon/spec/lib/patron_spec.rb b/plugins/discourse-patreon/spec/lib/patron_spec.rbindex fa369c62430..b9ec918acce 100644--- a/plugins/discourse-patreon/spec/lib/patron_spec.rb+++ b/plugins/discourse-patreon/spec/lib/patron_spec.rb@@ -32,7 +32,7 @@ RSpec.describe Patreon::Patron doPatreon.set("reward-users", reward_users)end- it "should find local users matching Patreon user info" do+ it "finds local users matching Patreon user information" doFabricate(:user, email: "[email protected]")Fabricate(:patreon_user_info, provider_uid: "111112")@@ -47,7 +47,7 @@ RSpec.describe Patreon::Patron doendend- it "should find local users matching email address without case-sensitivity" do+ it "finds local users matching the email address case-insensitively" dopatrons["111111"] = "[email protected]"Patreon.set("users", patrons)Fabricate(:user, email: "[email protected]")@@ -66,14 +66,14 @@ RSpec.describe Patreon::Patron doPatreon.set("filters", filters)end- it "should sync all Patreon users" do+ it "syncs all Patreon users" douser = Fabricate(:user, email: "[email protected]")described_class.sync_groupsexpect(group1.users.to_a - [patreon_user_info.user, user]).to eq([])expect(group2.users.to_a - [patreon_user_info.user]).to eq([])end- it "should sync by Patreon id" do+ it "syncs by Patreon ID" dodescribed_class.sync_groups_by(patreon_id: patreon_user_info.provider_uid)expect(group1.users.to_a).to eq([patreon_user_info.user])expect(group2.users.to_a).to eq([patreon_user_info.user])diff --git a/plugins/discourse-patreon/spec/lib/seed_spec.rb b/plugins/discourse-patreon/spec/lib/seed_spec.rbindex 44aa3d09b98..c1c83fe3c91 100644--- a/plugins/discourse-patreon/spec/lib/seed_spec.rb+++ b/plugins/discourse-patreon/spec/lib/seed_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe Patreon::Seed do- it "should seed contents correctly" do+ it "seeds the expected contents" dodescribed_class.seed_content!group = Group.find_by(name: "patrons")expect(group).to be_present@@ -10,13 +10,13 @@ RSpec.describe Patreon::Seed doexpect(Patreon.get("filters")).to eq(group.id.to_s => ["0"])end- it "should not raise error if group already exists" do+ it "does not raise an error when the group already exists" dogroup = Fabricate(:group, name: "patrons")described_class.seed_content!expect(Patreon.get("filters")).to eq(group.id.to_s => ["0"])end- it "should not raise error if badge already exists" do+ it "does not raise an error when the badge already exists" doBadge.where(name: "Patron").first_or_create!(badge_type_id: 1,description: "test",diff --git a/plugins/discourse-patreon/spec/requests/patreon_admin_controller_spec.rb b/plugins/discourse-patreon/spec/requests/patreon_admin_controller_spec.rbindex 7f0ba8a422e..abb42945851 100644--- a/plugins/discourse-patreon/spec/requests/patreon_admin_controller_spec.rb+++ b/plugins/discourse-patreon/spec/requests/patreon_admin_controller_spec.rb@@ -17,7 +17,7 @@ describe Patreon::PatreonAdminController doPatreon.set("rewards", rewards)end- it "should display list of patreon groups" do+ it "returns the Patreon groups" doget "/patreon/list.json"result = JSON.parse(response.body)@@ -34,14 +34,14 @@ describe Patreon::PatreonAdminController doexpect(response.parsed_body).to eq("unconfigured" => true)end- it "should display list of rewards" do+ it "returns the Patreon rewards" doget "/patreon/rewards.json"rewards = JSON.parse(response.body)expect(rewards.count).to eq(2)end- it "should update existing filter" do+ it "updates an existing filter" doids = %w[1 2]post "/patreon/list.json", params: { rewards_ids: ids, group_id: group1.id }@@ -49,19 +49,19 @@ describe Patreon::PatreonAdminController doexpect(Patreon.get("filters")[group1.id.to_s]).to eq(ids)end- it "should delete an filter" do+ it "deletes a filter" doexpect { delete "/patreon/list.json", params: { group_id: group1.id } }.to change {Patreon.get("filters").count}.by(-1)expect(Patreon.get("filters")[group1.id.to_s]).to eq(nil)end- it "should sync patreon groups" do+ it "synchronizes Patreon groups" doPatreon::Patron.expects(:sync_groups)post "/patreon/sync_groups.json"end- it "should enqueue job to sync patrons and groups" do+ it "enqueues the patron and group synchronization job" doexpect_enqueued_with(job: :patreon_sync_patrons_to_groups) dopost "/patreon/update_data.json"enddiff --git a/plugins/discourse-policy/spec/lib/check_policy_spec.rb b/plugins/discourse-policy/spec/lib/check_policy_spec.rbindex df0782efc48..037f905f2de 100644--- a/plugins/discourse-policy/spec/lib/check_policy_spec.rb+++ b/plugins/discourse-policy/spec/lib/check_policy_spec.rb@@ -216,7 +216,7 @@ describe Jobs::DiscoursePolicy::CheckPolicy doendend- it "will correctly notify users with high priority notifications" do+ it "sends high-priority notifications to users" doJobs.run_immediately!freeze_time@@ -297,7 +297,7 @@ describe Jobs::DiscoursePolicy::CheckPolicy doendend- it "will delete the existing policy reminder notification before creating a new one" do+ it "replaces the existing policy reminder notification" doJobs.run_immediately!freeze_timediff --git a/plugins/discourse-post-voting/spec/components/post_voting/vote_manager_spec.rb b/plugins/discourse-post-voting/spec/components/post_voting/vote_manager_spec.rbindex 09aa62fa961..8547d914af4 100644--- a/plugins/discourse-post-voting/spec/components/post_voting/vote_manager_spec.rb+++ b/plugins/discourse-post-voting/spec/components/post_voting/vote_manager_spec.rb@@ -70,7 +70,7 @@ describe PostVoting::VoteManager doenddescribe ".remove_vote" do- it "should remove a user's upvote" do+ it "removes a user's upvote" dovote = PostVoting::VoteManager.vote(post, user, direction: up)message =@@ -90,7 +90,7 @@ describe PostVoting::VoteManager doexpect(message.data[:post_voting_has_votes]).to eq(false)end- it "should remove a user's downvote" do+ it "removes a user's downvote" dovote = PostVoting::VoteManager.vote(post, Fabricate(:user), direction: up)vote_2 = PostVoting::VoteManager.vote(post, Fabricate(:user), direction: up)vote_3 = PostVoting::VoteManager.vote(post, user, direction: down)diff --git a/plugins/discourse-post-voting/spec/lib/topic_view_spec.rb b/plugins/discourse-post-voting/spec/lib/topic_view_spec.rbindex c753e5ba7e4..5649fe51c60 100644--- a/plugins/discourse-post-voting/spec/lib/topic_view_spec.rb+++ b/plugins/discourse-post-voting/spec/lib/topic_view_spec.rb@@ -43,7 +43,7 @@ describe TopicView doexpect(topic_view.posts_user_voted).to eq(nil)end- it "should preload comments, comments count, user voted status for a given topic" do+ it "preloads comments, comment count, and user vote status for a topic" doPostVoting::VoteManager.vote(comment, user)PostVoting::VoteManager.vote(comment_2, comment_3.user)@@ -65,7 +65,7 @@ describe TopicView doexpect(topic_view.comments_user_voted).to eq({ comment.id => true })end- it "should respect Topic::PRELOAD_COMMENTS_COUNT when loading initial comments" do+ it "respects Topic::PRELOAD_COMMENTS_COUNT when loading initial comments" dostub_const(TopicView, "PRELOAD_COMMENTS_COUNT", 1) dotopic_view = TopicView.new(topic, user)@@ -74,7 +74,7 @@ describe TopicView doendend- it "should preload the right comments even if comments have been deleted" do+ it "preloads the expected comments even when comments have been deleted" docomment_4 = Fabricate(:post_voting_comment, post: answer)comment.trash!diff --git a/plugins/discourse-post-voting/spec/models/post_spec.rb b/plugins/discourse-post-voting/spec/models/post_spec.rbindex 64be20f0010..a99d48f1074 100644--- a/plugins/discourse-post-voting/spec/models/post_spec.rb+++ b/plugins/discourse-post-voting/spec/models/post_spec.rb@@ -24,9 +24,9 @@ describe Post doendend- it("should ignore vote_count") { expect(Post.ignored_columns.include?("vote_count")).to eq(true) }+ it("ignores vote_count") { expect(Post.ignored_columns.include?("vote_count")).to eq(true) }- it "should return last voted correctly" do+ it "returns the last vote correctly" dofreeze_time doexpect(post.post_voting_last_voted(user1.id)).to eq(nil)@@ -36,7 +36,7 @@ describe Post doendend- it "should return post_voting_can_vote correctly" do+ it "returns post_voting_can_vote correctly" doexpect(post.post_voting_can_vote(user1.id, PostVotingVote.directions[:up])).to eq(true)PostVoting::VoteManager.vote(post, user1)diff --git a/plugins/discourse-post-voting/spec/models/topic_spec.rb b/plugins/discourse-post-voting/spec/models/topic_spec.rbindex 9bc29f486d3..39274338d68 100644--- a/plugins/discourse-post-voting/spec/models/topic_spec.rb+++ b/plugins/discourse-post-voting/spec/models/topic_spec.rb@@ -18,7 +18,7 @@ describe Topic dodescribe "validations" dodescribe "#subtype" do- it "should not allow Post Voting formatted topics to be created when post_voting_enabled site setting is not enabled" do+ it "rejects Post Voting topics when post_voting_enabled is disabled" doSiteSetting.post_voting_enabled = falsetopic =@@ -30,7 +30,7 @@ describe Topic do)end- it "should not allow topic to change to Post Voting subtype once it has been created" do+ it "rejects changing an existing topic to the Post Voting subtype" dotopic_2 = Fabricate(:topic)topic_2.subtype = Topic::POST_VOTING_SUBTYPE@@ -40,7 +40,7 @@ describe Topic do)end- it "should only allow Post Voting subtype to be set on regular topics" do+ it "allows the Post Voting subtype only on regular topics" dotopic =Fabricate.build(:topic, archetype: Archetype.default, subtype: Topic::POST_VOTING_SUBTYPE)@@ -56,43 +56,43 @@ describe Topic doendend- it "should return correct comments" do+ it "returns the topic's comments" docomment_ids = comments.map(&:id)topic_comment_ids = topic.comments.pluck(:id)expect(comment_ids).to eq(topic_comment_ids)end- it "should return correct answers" do+ it "returns the topic's answers" doanswer_ids = answers.map(&:id)topic_answer_ids = topic.answers.pluck(:id)expect(answer_ids).to eq(topic_answer_ids)end- it "should return correct answer_count" do+ it "returns the answer count" doexpect(topic.answers.size).to eq(answers.size)end- it "should return correct last_answered_at" do+ it "returns the last answer's timestamp" doexpected = answers.last.created_atexpect(topic.last_answered_at).to eq_time(expected)end- it "should return correct last_commented_on" do+ it "returns the last comment's timestamp" doexpected = comments.last.created_atexpect(topic.last_commented_on).to eq_time(expected)end- it "should return correct last_answer_post_number" do+ it "returns the last answer's post number" doexpected = answers.last.post_numberexpect(topic.last_answer_post_number).to eq(expected)end- it "should return correct last_answerer" do+ it "returns the last answer's author" doexpected = answers.last.user.idexpect(topic.last_answerer.id).to eq(expected)@@ -110,17 +110,17 @@ describe Topic doenddescribe ".post_voting_votes" do- it "should return nil if user is blank" do+ it "returns nil if user is blank" doexpect(Topic.post_voting_votes(topic, nil)).to eq(nil)end- it "should return nil if disabled" do+ it "returns nil if disabled" doSiteSetting.post_voting_enabled = falseexpect(Topic.post_voting_votes(topic, user)).to eq(nil)end- it "should return voted post IDs" do+ it "returns voted post IDs" doexpected =answers.first(3)diff --git a/plugins/discourse-post-voting/spec/requests/list_controller_spec.rb b/plugins/discourse-post-voting/spec/requests/list_controller_spec.rbindex c2d85b5f255..88144f2f10b 100644--- a/plugins/discourse-post-voting/spec/requests/list_controller_spec.rb+++ b/plugins/discourse-post-voting/spec/requests/list_controller_spec.rb@@ -15,7 +15,7 @@ describe ListController dosign_in(user)end- it "should return the right attributes for Post Voting topics" do+ it "returns the expected attributes for Post Voting topics" doTopicUser.create!(user: user, topic: post_voting_topic, last_read_post_number: 2)TopicUser.create!(user: user, topic: topic, last_read_post_number: 2)@@ -31,7 +31,7 @@ describe ListController doexpect(non_post_voting["is_post_voting"]).to eq(nil)end- it "should return the right attributes when Post Voting is disabled" do+ it "returns the expected attributes when Post Voting is disabled" doSiteSetting.post_voting_enabled = falseTopicUser.create!(user: user, topic: post_voting_topic, last_read_post_number: 2)diff --git a/plugins/discourse-post-voting/spec/requests/post_voting/comments_controller_spec.rb b/plugins/discourse-post-voting/spec/requests/post_voting/comments_controller_spec.rbindex 9c0b3935ba3..2639f607391 100644--- a/plugins/discourse-post-voting/spec/requests/post_voting/comments_controller_spec.rb+++ b/plugins/discourse-post-voting/spec/requests/post_voting/comments_controller_spec.rb@@ -187,7 +187,7 @@ RSpec.describe PostVoting::CommentsController doenddescribe "#update" do- it "should return 403 for an anon user" do+ it "returns 403 for an anonymous user" doput "/post_voting/comments.json",params: {comment_id: comment.id,@@ -197,7 +197,7 @@ RSpec.describe PostVoting::CommentsController doexpect(response.status).to eq(403)end- it "should return 404 when comment_id is not associated to a valid record" do+ it "returns 404 when comment_id does not identify a comment" dosign_in(comment.user)put "/post_voting/comments.json",@@ -209,7 +209,7 @@ RSpec.describe PostVoting::CommentsController doexpect(response.status).to eq(404)end- it "should return 403 when trying to update a comment on a post the user cannot see" do+ it "returns 403 when updating a comment on an inaccessible post" dosign_in(comment.user)category.set_permissions(group => :readonly)@@ -224,7 +224,7 @@ RSpec.describe PostVoting::CommentsController doexpect(response.status).to eq(403)end- it "should return 403 when a user is trying to update the comment of another user" do+ it "returns 403 when updating another user's comment" dosign_in(Fabricate(:user))put "/post_voting/comments.json",@@ -236,7 +236,7 @@ RSpec.describe PostVoting::CommentsController doexpect(response.status).to eq(403)end- it "should allow an admin to update the comment" do+ it "allows an admin to update the comment" dosign_in(admin)put "/post_voting/comments.json",@@ -253,7 +253,7 @@ RSpec.describe PostVoting::CommentsController doexpect(body["cooked"]).to eq("<p>this is some new raw</p>")end- it "should allow a moderator to update the comment" do+ it "allows a moderator to update the comment" dosign_in(moderator)put "/post_voting/comments.json",@@ -270,7 +270,7 @@ RSpec.describe PostVoting::CommentsController doexpect(body["cooked"]).to eq("<p>this is some new raw</p>")end- it "should allow users to update their own comment and publishes a MessageBus message" do+ it "updates the user's own comment and publishes the change" dosign_in(comment.user)message =@@ -298,8 +298,8 @@ RSpec.describe PostVoting::CommentsController doendend- describe "#flag" do- it "should return 403 with not_logged_in error for an anon user" do+ describe "#flag authentication" do+ it "returns 403 with not_logged_in for an anonymous user" doput "/post_voting/comments/flag.json",params: {comment_id: comment.id,@@ -312,13 +312,13 @@ RSpec.describe PostVoting::CommentsController doenddescribe "#destroy" do- it "should return 403 for an anon user" do+ it "returns 403 for an anonymous user" dodelete "/post_voting/comments.json", params: { comment_id: comment.id }expect(response.status).to eq(403)end- it "should return 404 when comment_id param given does not exist" do+ it "returns 404 when comment_id does not exist" dosign_in(comment.user)delete "/post_voting/comments.json", params: { comment_id: -99_999 }@@ -326,7 +326,7 @@ RSpec.describe PostVoting::CommentsController doexpect(response.status).to eq(404)end- it "should return 403 when trying to delete a comment on a post the user cannot see" do+ it "returns 403 when deleting a comment on an inaccessible post" dosign_in(comment.user)category.set_permissions(group => :readonly)@@ -337,7 +337,7 @@ RSpec.describe PostVoting::CommentsController doexpect(response.status).to eq(403)end- it "should return 403 when a user is trying to delete another user's comment" do+ it "returns 403 when deleting another user's comment" dosign_in(Fabricate(:user))delete "/post_voting/comments.json", params: { comment_id: comment.id }@@ -345,7 +345,7 @@ RSpec.describe PostVoting::CommentsController doexpect(response.status).to eq(403)end- it "should allow an admin to delete a comment of another user" do+ it "allows an admin to delete another user's comment" dosign_in(admin)delete "/post_voting/comments.json", params: { comment_id: comment.id }@@ -359,7 +359,7 @@ RSpec.describe PostVoting::CommentsController do).to eq(true)end- it "should allow a moderator to delete a comment of another user" do+ it "allows a moderator to delete another user's comment" dosign_in(moderator)delete "/post_voting/comments.json", params: { comment_id: comment.id }@@ -373,7 +373,7 @@ RSpec.describe PostVoting::CommentsController do).to eq(true)end- it "should allow users to delete their own comment and publishes a message bus message" do+ it "deletes the user's own comment and publishes the change" dosign_in(comment.user)message =@@ -403,7 +403,7 @@ RSpec.describe PostVoting::CommentsController dobefore { sign_in(flagger) }- it "should return 403 when trying to flag a comment on a post the user cannot see" do+ it "returns 403 when flagging a comment on an inaccessible post" docategory.set_permissions(group => :full)category.save!diff --git a/plugins/discourse-post-voting/spec/requests/post_voting/votes_controller_spec.rb b/plugins/discourse-post-voting/spec/requests/post_voting/votes_controller_spec.rbindex 1be7ccdcf23..11bf61623c9 100644--- a/plugins/discourse-post-voting/spec/requests/post_voting/votes_controller_spec.rb+++ b/plugins/discourse-post-voting/spec/requests/post_voting/votes_controller_spec.rb@@ -25,7 +25,7 @@ RSpec.describe PostVoting::VotesController doexpect(response.status).to eq(403)end- it "should be successful if post has never been voted" do+ it "creates a vote when the user has not voted on the post" dopost "/post_voting/vote.json", params: { post_id: answer.id }expect(response.status).to eq(200)@@ -37,7 +37,7 @@ RSpec.describe PostVoting::VotesController doexpect(vote.user_id).to eq(user.id)end- it "should error if already voted" do+ it "rejects a duplicate vote" dopost "/post_voting/vote.json", params: { post_id: answer.id }expect(response.status).to eq(200)@@ -71,13 +71,13 @@ RSpec.describe PostVoting::VotesController doendend- it "should return 403 if user votes on a post by self" do+ it "returns 403 when voting on the user's own post" dopost "/post_voting/vote.json", params: { post_id: answer_3.id }expect(response.status).to eq(403)end- it "should return 403 after post_voting_undo_vote_action_window" do+ it "returns 403 after the vote undo window expires" doSiteSetting.post_voting_undo_vote_action_window = 1post "/post_voting/vote.json", params: { post_id: answer.id }@@ -102,7 +102,7 @@ RSpec.describe PostVoting::VotesController dodescribe "#destroy" dobefore { sign_in(user) }- it "should success if has voted" do+ it "removes an existing vote" dopost "/post_voting/vote.json", params: { post_id: answer.id }expect(response.status).to eq(200)@@ -118,13 +118,13 @@ RSpec.describe PostVoting::VotesController doexpect(PostVotingVote.exists?(id: vote.id)).to eq(false)end- it "should return the right response if user has never voted on post" do+ it "returns 403 when the user has never voted on the post" dodelete "/post_voting/vote.json", params: { post_id: answer.id }expect(response.status).to eq(403)end- it "should cant undo vote" do+ it "rejects undoing a vote after the undo window expires" doSiteSetting.post_voting_undo_vote_action_window = 1post "/post_voting/vote.json", params: { post_id: answer.id }@@ -145,13 +145,13 @@ RSpec.describe PostVoting::VotesController dodescribe "#voters" dofab!(:user)- it "should return the right response for an anon user" do+ it "returns 403 for an anonymous user" doget "/post_voting/voters.json", params: { post_id: answer.id }expect(response.status).to eq(403)end- it "should return the right response if post does not exist" do+ it "returns 404 if the post does not exist" dosign_in(user)get "/post_voting/voters.json", params: { post_id: -1 }@@ -184,7 +184,7 @@ RSpec.describe PostVoting::VotesController doexpect(voter_payload["direction"]).to eq(PostVotingVote.directions[:up])end- it "should return correct users respecting limits" do+ it "returns voters within the requested limit" dosign_in(user)user_2 = Fabricate(:user)@@ -220,7 +220,7 @@ RSpec.describe PostVoting::VotesController doexpect(parsed["total_voters_count"]).to eq(2)end- it "should return total_voters_count so the client can compute remaining voters correctly" do+ it "returns total_voters_count for computing the remaining voters" dosign_in(user)user_2 = Fabricate(:user)@@ -258,13 +258,13 @@ RSpec.describe PostVoting::VotesController dolet(:comment) { Fabricate(:post_voting_comment, post: answer) }let(:comment_2) { Fabricate(:post_voting_comment, post: answer, user: user) }- it "should return 403 for an anon user" do+ it "returns 403 for an anonymous user" dopost "/post_voting/vote/comment.json", params: { comment_id: comment.id }expect(response.status).to eq(403)end- it "should return 404 if comment_id param is not valid" do+ it "returns 404 if comment_id is invalid" dosign_in(user)post "/post_voting/vote/comment.json", params: { comment_id: -999 }@@ -272,7 +272,7 @@ RSpec.describe PostVoting::VotesController doexpect(response.status).to eq(404)end- it "should return 403 if user is not allowed to see comment" do+ it "returns 403 if the user cannot see the comment" dosign_in(user)topic.update!(category: category)@@ -283,7 +283,7 @@ RSpec.describe PostVoting::VotesController doexpect(response.status).to eq(403)end- it "should return 403 if user votes on a comment by self" do+ it "returns 403 when voting on the user's own comment" dosign_in(user)post "/post_voting/vote/comment.json", params: { comment_id: comment_2.id }@@ -307,13 +307,13 @@ RSpec.describe PostVoting::VotesController dodescribe "#destroy_comment_vote" dolet(:comment) { Fabricate(:post_voting_comment, post: answer) }- it "should return 403 for an anon user" do+ it "returns 403 for an anonymous user" dodelete "/post_voting/vote/comment.json", params: { comment_id: comment.id }expect(response.status).to eq(403)end- it "should return 404 if comment_id param is not valid" do+ it "returns 404 if comment_id is invalid" dosign_in(user)delete "/post_voting/vote/comment.json", params: { comment_id: -999 }@@ -321,7 +321,7 @@ RSpec.describe PostVoting::VotesController doexpect(response.status).to eq(404)end- it "should return 403 if user has not voted on comment" do+ it "returns 403 if the user has not voted on the comment" dosign_in(user)delete "/post_voting/vote/comment.json", params: { comment_id: comment.id }@@ -329,7 +329,7 @@ RSpec.describe PostVoting::VotesController doexpect(response.status).to eq(403)end- it "should be able to remove a user's vote from a comment" do+ it "removes the user's vote from the comment" doPostVoting::VoteManager.vote(comment, user, direction: PostVotingVote.directions[:up])sign_in(user)diff --git a/plugins/discourse-post-voting/spec/serializers/basic_category_serializer_spec.rb b/plugins/discourse-post-voting/spec/serializers/basic_category_serializer_spec.rbindex 989154055bb..4b2afca4304 100644--- a/plugins/discourse-post-voting/spec/serializers/basic_category_serializer_spec.rb+++ b/plugins/discourse-post-voting/spec/serializers/basic_category_serializer_spec.rb@@ -16,7 +16,7 @@ describe BasicCategorySerializer docontext "with qa enabled" dobefore { SiteSetting.post_voting_enabled = true }- it "should return post_voting category attributes" do+ it "returns post_voting category attributes" doexpect(serialized[:create_as_post_voting_default]).to eq(true)endend@@ -24,7 +24,7 @@ describe BasicCategorySerializer docontext "with qa disabled" dobefore { SiteSetting.post_voting_enabled = false }- it "should not return qa category attributes" do+ it "omits QA category attributes" doexpect(serialized.key?(:create_as_post_voting_default)).to eq(false)endenddiff --git a/plugins/discourse-post-voting/spec/serializers/post_voting/post_serializer_spec.rb b/plugins/discourse-post-voting/spec/serializers/post_voting/post_serializer_spec.rbindex 06d0af647d6..a1b7d9be2e8 100644--- a/plugins/discourse-post-voting/spec/serializers/post_voting/post_serializer_spec.rb+++ b/plugins/discourse-post-voting/spec/serializers/post_voting/post_serializer_spec.rb@@ -19,7 +19,7 @@ describe PostVoting::PostSerializerExtension docontext "with qa enabled" dobefore { SiteSetting.post_voting_enabled = true }- it "should return the right attributes" do+ it "returns the post-voting attributes" doPostVoting::VoteManager.vote(answer, user, direction: up)expect(serialized[:post_voting_vote_count]).to eq(1)@@ -32,7 +32,7 @@ describe PostVoting::PostSerializerExtension docontext "with qa disabled" dobefore { SiteSetting.post_voting_enabled = false }- it "should not include dependent_keys" do+ it "does not include dependent_keys" doexpect(serialized[:qa_vote_count]).to eq(nil)expect(serialized[:qa_user_voted_direction]).to eq(nil)expect(serialized[:comments_count]).to eq(nil)diff --git a/plugins/discourse-post-voting/spec/serializers/post_voting/topic_view_serializer_spec.rb b/plugins/discourse-post-voting/spec/serializers/post_voting/topic_view_serializer_spec.rbindex 6cc8774f49f..a54a477788d 100644--- a/plugins/discourse-post-voting/spec/serializers/post_voting/topic_view_serializer_spec.rb+++ b/plugins/discourse-post-voting/spec/serializers/post_voting/topic_view_serializer_spec.rb@@ -12,7 +12,7 @@ describe PostVoting::TopicViewSerializerExtension dobefore { SiteSetting.post_voting_enabled = true }- it "should return correct values" do+ it "returns the topic's post-voting values" doPostVoting::VoteManager.vote(topic_post, user)PostVoting::VoteManager.vote(answer, user)PostVoting::VoteManager.vote(answer, Fabricate(:user))@@ -44,7 +44,7 @@ describe PostVoting::TopicViewSerializerExtension doexpect(posts.last[:comments_count]).to eq(1)end- it "should not include dependent_attrs when plugin is disabled" do+ it "omits dependent_attrs when the plugin is disabled" doSiteSetting.post_voting_enabled = falsepayload = TopicViewSerializer.new(topic_view, scope: guardian, root: false).as_jsondiff --git a/plugins/discourse-reactions/spec/models/post_mover_spec.rb b/plugins/discourse-reactions/spec/models/post_mover_spec.rbindex 645d3fb0fc7..1a8a5e3d7d7 100644--- a/plugins/discourse-reactions/spec/models/post_mover_spec.rb+++ b/plugins/discourse-reactions/spec/models/post_mover_spec.rb@@ -18,7 +18,7 @@ describe PostMover dobefore { enable_current_plugin }- it "should create new post when topic's first post has no reactions" do+ it "creates a new post when the topic's first post has no reactions" doold_topic = Fabricate(:topic)new_topic = Fabricate(:topic)post = Fabricate(:post, topic: old_topic)@@ -27,7 +27,7 @@ describe PostMover doexpect { post_mover.to_topic(new_topic) }.to change { new_topic.posts.count }.by(1)end- it "should create new post when first post has likes but no emoji reaction user" do+ it "creates a new post when the first post has likes but no emoji reactions" doold_topic = Fabricate(:topic)new_topic = Fabricate(:topic)post = Fabricate(:post, topic: old_topic)@@ -46,7 +46,7 @@ describe PostMover doexpect(new_post.reactions_user.count).to eq(0)end- it "should add old post's reactions to new post when a topic's first post is moved" do+ it "moves the first post's reactions to the new post" doexpect(post_1.reactions).to contain_exactly(reaction_1, reaction_2)expect(topic_2.posts.count).to eq(0)@@ -66,7 +66,7 @@ describe PostMover doexpect(reaction_user_ids).to match_array([user_reaction_1.user_id, user_reaction_2.user_id])end- it "should retain existing reactions after moving a post" do+ it "retains existing reactions after moving a post" doexpect(post_2.reactions).to contain_exactly(reaction_3, reaction_4)expect(topic_3.posts.count).to eq(0)diff --git a/plugins/discourse-solved/spec/integration/solved_spec.rb b/plugins/discourse-solved/spec/integration/solved_spec.rbindex a6279479baf..90360751e5e 100644--- a/plugins/discourse-solved/spec/integration/solved_spec.rb+++ b/plugins/discourse-solved/spec/integration/solved_spec.rb@@ -619,7 +619,7 @@ RSpec.describe "Managing Posts solved status" dotopic.reloadend- it "should unmark the post as solved" do+ it "unmarks the post as solved" doexpect do post "/solution/unaccept.json", params: { id: p1.id } end.to change {topic.reload.public_topic_timer}.to(nil)@@ -657,7 +657,7 @@ RSpec.describe "Managing Posts solved status" dotopic.reloadend- it "should unmark the post as solved only when last solution unaccepted" do+ it "unmarks the post as solved only when the last solution is unaccepted" doexpect do post "/solution/unaccept.json", params: { id: p1.id } end.not_to change {topic.reload.public_topic_timer}diff --git a/plugins/discourse-solved/spec/lib/guardian_extensions_spec.rb b/plugins/discourse-solved/spec/lib/guardian_extensions_spec.rbindex 0025d12857f..d70c1cb4533 100644--- a/plugins/discourse-solved/spec/lib/guardian_extensions_spec.rb+++ b/plugins/discourse-solved/spec/lib/guardian_extensions_spec.rb@@ -10,7 +10,7 @@ describe DiscourseSolved::GuardianExtensions dobefore { SiteSetting.allow_solved_on_all_topics = true }- describe ".can_unaccept_answer?" do+ describe ".can_unaccept_answer? with a missing topic" doit "returns false when topic is nil" doadmin = Fabricate(:admin, refresh_auto_groups: true)expect(Guardian.new(admin).can_unaccept_answer?(nil, post)).to be_falseydiff --git a/plugins/discourse-solved/spec/requests/topics_controller_spec.rb b/plugins/discourse-solved/spec/requests/topics_controller_spec.rbindex e3de6b186b9..80f6003813f 100644--- a/plugins/discourse-solved/spec/requests/topics_controller_spec.rb+++ b/plugins/discourse-solved/spec/requests/topics_controller_spec.rb@@ -39,13 +39,13 @@ RSpec.describe TopicsController docontext "with solved enabled on every topic" dobefore { SiteSetting.allow_solved_on_all_topics = true }- it "should not include schema information for single-post topics without answers" do+ it "omits schema information for single-post topics without answers" doget "/t/#{topic.slug}/#{topic.id}"expect(response.body).not_to include("QAPage")end- it "should include correct schema information when topic has an accepted answer" do+ it "includes schema information for the accepted answer" doFabricate(:solved_topic, topic:, answer_post: p2)get "/t/#{topic.slug}/#{topic.id}"@@ -74,7 +74,7 @@ RSpec.describe TopicsController doexpect(schema_json).not_to include(hidden_text)end- it "should include quoted content in schema information" do+ it "includes quoted content in schema information" doFabricate(:solved_topic, topic:, answer_post: p2)post = topic.first_post@@ -87,7 +87,7 @@ RSpec.describe TopicsController doexpect(response.body).to include('"text":"This is a quoted text."')end- it "should include user name in output with the corresponding site setting" do+ it "includes the user name when enabled in site settings" doSiteSetting.display_name_on_posts = trueSiteSetting.show_who_marked_solved = trueaccepter = Fabricate(:user)@@ -114,7 +114,7 @@ RSpec.describe TopicsController doexpect(response.parsed_body["accepted_answers"][0]["accepter_name"]).to eq(nil)end- it "should not include user name when site setting is disabled" do+ it "omits the user name when disabled in site settings" doSiteSetting.display_name_on_posts = falseFabricate(:solved_topic, topic:, answer_post: p2)@@ -166,7 +166,7 @@ RSpec.describe TopicsController dolet!(:second_topic_answer) { Fabricate(:topic_answer, solved_topic:, post: p3) }let!(:unaccepted_post) { p4 }- it "should include correct schema information " do+ it "includes the expected schema information" doget "/t/#{topic.slug}/#{topic.id}"two_accepted_answers_json =@@ -302,7 +302,7 @@ RSpec.describe TopicsController dobefore { SiteSetting.solved_allow_multiple_solutions = true }- it "should include two acceptedAnswers and a suggestedAnswer in qaschema" do+ it "includes two acceptedAnswers and a suggestedAnswer in qaschema" doget "/t/#{topic.slug}/#{topic.id}", env: crawler_envdoc = parsed_crawler_bodydiff --git a/plugins/discourse-solved/spec/serializers/topic_answer_mixin_spec.rb b/plugins/discourse-solved/spec/serializers/topic_answer_mixin_spec.rbindex 4f436e5b03d..81568e7734d 100644--- a/plugins/discourse-solved/spec/serializers/topic_answer_mixin_spec.rb+++ b/plugins/discourse-solved/spec/serializers/topic_answer_mixin_spec.rb@@ -7,7 +7,7 @@ describe DiscourseSolved::TopicAnswerMixin dobefore { Fabricate(:solved_topic, topic: topic, answer_post: post) }- it "should have true for `has_accepted_answer` field in each serializer" do+ it "sets has_accepted_answer in each serializer" do[TopicListItemSerializer,SearchTopicListItemSerializer,diff --git a/plugins/discourse-solved/spec/system/solved_spec.rb b/plugins/discourse-solved/spec/system/solved_spec.rbindex 134d1163a29..fb224c91948 100644--- a/plugins/discourse-solved/spec/system/solved_spec.rb+++ b/plugins/discourse-solved/spec/system/solved_spec.rb@@ -111,7 +111,7 @@ describe "Solved" doendend- it "should collapse/expand the solution when clicking the toggle" do+ it "collapses and expands the solution when clicking the toggle" dosolved_topic = Fabricate(:solved_topic, topic:)Fabricate(:topic_answer, solved_topic:, post: solver_post, accepter:)diff --git a/plugins/discourse-subscriptions/spec/jobs/refresh_subscriptions_campaign_data_spec.rb b/plugins/discourse-subscriptions/spec/jobs/refresh_subscriptions_campaign_data_spec.rbindex d2373df8105..999faca75d2 100644--- a/plugins/discourse-subscriptions/spec/jobs/refresh_subscriptions_campaign_data_spec.rb+++ b/plugins/discourse-subscriptions/spec/jobs/refresh_subscriptions_campaign_data_spec.rb@@ -3,7 +3,7 @@RSpec.describe Jobs::RefreshSubscriptionsCampaignData dobefore { SiteSetting.discourse_subscriptions_campaign_enabled = true }- it "should execute the job only if stripe is configured" do+ it "executes the job only when Stripe is configured" doDiscourseSubscriptions::Campaign.any_instance.expects(:refresh_data).oncedescribed_class.new.execute({})diff --git a/plugins/discourse-subscriptions/spec/requests/hooks_controller_spec.rb b/plugins/discourse-subscriptions/spec/requests/hooks_controller_spec.rbindex c9c6ef33f29..3d078c43ff0 100644--- a/plugins/discourse-subscriptions/spec/requests/hooks_controller_spec.rb+++ b/plugins/discourse-subscriptions/spec/requests/hooks_controller_spec.rb@@ -475,7 +475,7 @@ RSpec.describe DiscourseSubscriptions::HooksController doenddescribe "completing the subscription" do- it "does not add the user to the group" do+ it "does not add the user to the group when the status remains incomplete" doevent_data[:object][:status] = "incomplete"event_data[:previous_attributes] = { status: "incomplete" }@@ -484,7 +484,7 @@ RSpec.describe DiscourseSubscriptions::HooksController doexpect(response.status).to eq 200end- it "does not add the user to the group" do+ it "does not add the user to the group when the status becomes incomplete" doevent_data[:object][:status] = "incomplete"event_data[:previous_attributes] = { status: "something-else" }diff --git a/plugins/discourse-templates/spec/lib/topic_extension_spec.rb b/plugins/discourse-templates/spec/lib/topic_extension_spec.rbindex 34c77e1af4c..3f388702d5a 100644--- a/plugins/discourse-templates/spec/lib/topic_extension_spec.rb+++ b/plugins/discourse-templates/spec/lib/topic_extension_spec.rb@@ -110,7 +110,7 @@ describe DiscourseTemplates::TopicExtension doendend- it "won't leak state into the Category.subcategory_ids cache" do+ it "does not leak state into the Category.subcategory_ids cache" docategory = Fabricate(:category_with_definition)subcategory = Fabricate(:category_with_definition, parent_category: category)topic = Fabricate(:template_item, category: subcategory)diff --git a/plugins/discourse-templates/spec/lib/topic_query_extension_spec.rb b/plugins/discourse-templates/spec/lib/topic_query_extension_spec.rbindex 423526a27ac..996de870670 100644--- a/plugins/discourse-templates/spec/lib/topic_query_extension_spec.rb+++ b/plugins/discourse-templates/spec/lib/topic_query_extension_spec.rb@@ -186,7 +186,7 @@ describe DiscourseTemplates::TopicQueryExtension doexpect(topics.size).to eq(0)end- it "won't list private messages received as templates" do+ it "does not list received private messages as templates" dotopics = topic_query.list_private_templates.topicsexpect((topics.map(&:id) & private_messages_from_user_a.map(&:id)).any?).to eq(false)enddiff --git a/plugins/discourse-templates/spec/requests/templates_controller_spec.rb b/plugins/discourse-templates/spec/requests/templates_controller_spec.rbindex a2cc6cb2c98..ab446414054 100644--- a/plugins/discourse-templates/spec/requests/templates_controller_spec.rb+++ b/plugins/discourse-templates/spec/requests/templates_controller_spec.rb@@ -85,7 +85,7 @@ describe DiscourseTemplates::TemplatesController docontext "when a regular user is logged" dobefore { sign_in(user) }- it "should list topics in the category assigned as templates" do+ it "lists topics in the templates category" doSiteSetting.discourse_templates_categories = templates_sub_category_everyone.id.to_sget "/discourse_templates"@@ -116,7 +116,7 @@ describe DiscourseTemplates::TemplatesController doexpect(template["tags"]).to contain_exactly(everyone_tag.name)end- it "should list topics from multiple parent categories" do+ it "lists topics from multiple parent categories" doSiteSetting.discourse_templates_categories = [templates_sub_category_everyone,templates_other_parent_category,@@ -135,7 +135,7 @@ describe DiscourseTemplates::TemplatesController doexpect(parsed["templates"]).to eq(expected_response)end- it "should list topics in the parent category and subcategories that the user can see" do+ it "lists visible topics in the parent category and subcategories" doSiteSetting.discourse_templates_categories = templates_parent_category.id.to_sget "/discourse_templates"@@ -157,7 +157,7 @@ describe DiscourseTemplates::TemplatesController doexpect(parsed["templates"]).to eq(expected_response)end- it "should not be able to use templates if can't see topics in the category" do+ it "rejects templates when the user cannot see topics in the category" doSiteSetting.discourse_templates_categories = templates_sub_category_moderators.id.to_sget "/discourse_templates"@@ -181,7 +181,7 @@ describe DiscourseTemplates::TemplatesController dosign_in(moderator)end- it "should list topics in the parent category and subcategories that the moderator can see" do+ it "lists topics in the parent category and subcategories visible to the moderator" doSiteSetting.discourse_templates_categories = [templates_parent_category,templates_other_parent_category,@@ -210,7 +210,7 @@ describe DiscourseTemplates::TemplatesController doendcontext "when an user belonging to a group is logged" do- it "should list topics in the parent category and subcategories that the user can see" do+ it "lists visible topics in the parent category and subcategories" doSiteSetting.discourse_templates_categories = [templates_parent_category,templates_other_parent_category,@@ -273,7 +273,7 @@ describe DiscourseTemplates::TemplatesController doGroup.refresh_automatic_groups!end- it "should list topics in the parent category and subcategories that the admin can see" do+ it "lists topics in the parent category and subcategories visible to the admin" doget "/discourse_templates"expect(response.status).to eq(200)@@ -297,7 +297,7 @@ describe DiscourseTemplates::TemplatesController doexpect(parsed["templates"]).to eq(expected_response)end- it "should not list delete, archived and unlisted topics" do+ it "excludes deleted, archived, and unlisted topics" dotemplate_item0.trash!(admin)expect(template_item0.deleted_at).not_to eq(nil)@@ -330,7 +330,7 @@ describe DiscourseTemplates::TemplatesController doendcontext "when no user is signed in" do- it "should return 404" do+ it "returns 404" doSiteSetting.discourse_templates_categories = templates_sub_category_everyone.id.to_sget "/discourse_templates"@@ -348,7 +348,7 @@ describe DiscourseTemplates::TemplatesController doGroup.refresh_automatic_groups!end- it "should return 422 when id does not belong to a valid topic" do+ it "returns 422 when id does not identify a topic" do# to avoid flaky testing we create a topic and immediately destroy it to obtain# an invalid topic idinvalid_topic_id = Fabricate(:template_item).tap(&:destroy!).id@@ -357,17 +357,17 @@ describe DiscourseTemplates::TemplatesController doexpect(response.status).to eq(422)end- it "should return 422 when topic does not belong to template category or its subcategories" do+ it "returns 422 for topics outside the templates category and its subcategories" dopost "/discourse_templates/#{other_topic1.id}/use"expect(response.status).to eq(422)end- it "should return 200 if the topic belongs to the templates category" do+ it "returns 200 for a topic in the templates category" dopost "/discourse_templates/#{template_item0.id}/use"expect(response.status).to eq(200)end- it "should return 200 if the topic belongs to the templates subcategories" do+ it "returns 200 for a topic in a templates subcategory" dopost "/discourse_templates/#{template_item3.id}/use"expect(response.status).to eq(200)@@ -390,7 +390,7 @@ describe DiscourseTemplates::TemplatesController dosign_in(moderator)end- it "should increment usage count" do+ it "increments the usage count" doget "/discourse_templates"expect(response.status).to eq(200)diff --git a/plugins/discourse-topic-voting/spec/serializers/basic_category_serializer_spec.rb b/plugins/discourse-topic-voting/spec/serializers/basic_category_serializer_spec.rbindex 6f8daec66ff..dced506001b 100644--- a/plugins/discourse-topic-voting/spec/serializers/basic_category_serializer_spec.rb+++ b/plugins/discourse-topic-voting/spec/serializers/basic_category_serializer_spec.rb@@ -3,7 +3,7 @@describe BasicCategorySerializer dofab!(:category)- it "does not return can_vote when voting disabled" do+ it "omits can_vote when topic voting is globally disabled" doSiteSetting.topic_voting_enabled = falsejson = BasicCategorySerializer.new(category, root: false).as_json@@ -11,7 +11,7 @@ describe BasicCategorySerializer doexpect(json[:can_vote]).to eq(nil)end- it "does not return can_vote when voting disabled" do+ it "returns can_vote when voting is enabled for the category" doSiteSetting.topic_voting_enabled = trueDiscourseTopicVoting::CategorySetting.create!(category: category)diff --git a/plugins/discourse-user-notes/spec/user_warning_spec.rb b/plugins/discourse-user-notes/spec/user_warning_spec.rbindex 52a8126e011..a0a7bd86cb1 100644--- a/plugins/discourse-user-notes/spec/user_warning_spec.rb+++ b/plugins/discourse-user-notes/spec/user_warning_spec.rb@@ -10,13 +10,13 @@ describe UserWarning docontext "when staff notes plugin is enabled" dobefore { SiteSetting.user_notes_enabled = true }- it "should create staff note for warning" do+ it "creates a staff note for the warning" doUserWarning.create(topic_id: topic.id, user_id: user.id, created_by_id: admin.id)expect(PluginStore.get("user_notes", "notes:#{user.id}")).to be_presentend- it "should use system language" do+ it "uses the system language" dofreeze_timewarning = UserWarning.create!(topic_id: topic.id, user_id: user.id, created_by_id: admin.id)@@ -30,7 +30,7 @@ describe UserWarning doexpect(notes[0]["raw"]).to eq(notes[1]["raw"])end- it "should trigger user_warning_created event" do+ it "triggers the user_warning_created event" docallback_called = falseevent_handler = Proc.new { |warning| callback_called = true }diff --git a/plugins/discourse-workflows/spec/lib/discourse_workflows/executor/node_execution_context_spec.rb b/plugins/discourse-workflows/spec/lib/discourse_workflows/executor/node_execution_context_spec.rbindex 1fdcfb9caef..02196ced2fe 100644--- a/plugins/discourse-workflows/spec/lib/discourse_workflows/executor/node_execution_context_spec.rb+++ b/plugins/discourse-workflows/spec/lib/discourse_workflows/executor/node_execution_context_spec.rb@@ -140,7 +140,7 @@ RSpec.describe DiscourseWorkflows::Executor::NodeExecutionContext doendend- describe "#helpers" do+ describe "#helpers item normalization" doit "normalizes runtime-compatible items through execution helpers" doctx = described_class.new(input_items: [], resolver: nil)@@ -495,7 +495,7 @@ RSpec.describe DiscourseWorkflows::Executor::NodeExecutionContext doendend- describe "#helpers" do+ describe "#helpers data table access" dofab!(:admin)fab!(:data_table, :discourse_workflows_data_table)@@ -770,7 +770,7 @@ RSpec.describe DiscourseWorkflows::Executor::NodeExecutionContext doendend- describe "#create_post" do+ describe "#create_post authorization" dofab!(:admin)fab!(:user)fab!(:first_post) { Fabricate(:post, user: user, raw: "First post", post_number: 1) }@@ -1021,7 +1021,7 @@ RSpec.describe DiscourseWorkflows::Executor::NodeExecutionContext doendend- describe "#create_post" do+ describe "#create_post provenance" doit "records bypass provenance custom fields on the created post" doauthor = Fabricate(:user, trust_level: 0, refresh_auto_groups: true)workflow = Fabricate(:discourse_workflows_workflow, published: true)diff --git a/plugins/discourse-zendesk-plugin/spec/jobs/onceoff/migrate_zendesk_autogenerate_categories_site_settings_spec.rb b/plugins/discourse-zendesk-plugin/spec/jobs/onceoff/migrate_zendesk_autogenerate_categories_site_settings_spec.rbindex 7cea9d45921..6b00256d6e5 100644--- a/plugins/discourse-zendesk-plugin/spec/jobs/onceoff/migrate_zendesk_autogenerate_categories_site_settings_spec.rb+++ b/plugins/discourse-zendesk-plugin/spec/jobs/onceoff/migrate_zendesk_autogenerate_categories_site_settings_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe Jobs::MigrateZendeskAutogenerateCategoriesSiteSettings do- it "should migrate the site settings correctly" do+ it "migrates the category site settings" docategory = Fabricate(:category)category_2 = Fabricate(:category)diff --git a/plugins/discourse-zendesk-plugin/spec/lib/discourse_zendesk_plugin/helper_spec.rb b/plugins/discourse-zendesk-plugin/spec/lib/discourse_zendesk_plugin/helper_spec.rbindex 5686f29af90..311a4a74d85 100644--- a/plugins/discourse-zendesk-plugin/spec/lib/discourse_zendesk_plugin/helper_spec.rb+++ b/plugins/discourse-zendesk-plugin/spec/lib/discourse_zendesk_plugin/helper_spec.rb@@ -154,7 +154,7 @@ RSpec.describe DiscourseZendeskPlugin::Helper dolet(:zendesk_job_push_only_author_posts) { false }context "with same author" do- it "should be true" do+ it "marks the post as eligible" doexpect(eligible).to be_truthyendend@@ -162,7 +162,7 @@ RSpec.describe DiscourseZendeskPlugin::Helper docontext "with different author" dolet(:post_user) { other_user }- it "should be true" do+ it "marks the post as eligible" doexpect(eligible).to be_truthyendend@@ -172,7 +172,7 @@ RSpec.describe DiscourseZendeskPlugin::Helper dolet(:zendesk_job_push_only_author_posts) { true }context "with same author" do- it "should be true" do+ it "marks the post as eligible" doexpect(eligible).to be_truthyendend@@ -180,7 +180,7 @@ RSpec.describe DiscourseZendeskPlugin::Helper docontext "with different author" dolet(:post_user) { other_user }- it "should be false" do+ it "marks the post as ineligible" doexpect(eligible).to be_falseyendenddiff --git a/plugins/poll/spec/controllers/polls_controller_spec.rb b/plugins/poll/spec/controllers/polls_controller_spec.rbindex 8c9fd21779a..d3db1b6da7f 100644--- a/plugins/poll/spec/controllers/polls_controller_spec.rb+++ b/plugins/poll/spec/controllers/polls_controller_spec.rb@@ -34,7 +34,7 @@ RSpec.describe DiscoursePoll::PollsController dobefore { Group.refresh_automatic_groups! }describe "#vote" do- it "works" do+ it "publishes the updated poll vote" dochannel = "/polls/#{poll.topic_id}"message =diff --git a/plugins/poll/spec/controllers/posts_controller_spec.rb b/plugins/poll/spec/controllers/posts_controller_spec.rbindex 21cbecfd8fc..dc160e062ae 100644--- a/plugins/poll/spec/controllers/posts_controller_spec.rb+++ b/plugins/poll/spec/controllers/posts_controller_spec.rb@@ -10,7 +10,7 @@ RSpec.describe PostsController doenddescribe "polls" do- it "works" do+ it "creates the post and its poll" doGroup.refresh_automatic_groups!post :create, params: { title: title, raw: "[poll]\n- A\n- B\n[/poll]" }, format: :json@@ -63,7 +63,7 @@ RSpec.describe PostsController doexpect(job_args["poll_name"]).to eq(name)end- it "should have different options" do+ it "requires different options" dopost :create, params: { title: title, raw: "[poll]\n- A\n- A\n[/poll]" }, format: :jsonexpect(response).not_to be_successful@@ -84,7 +84,7 @@ RSpec.describe PostsController doexpect(response).to be_successfulend- it "should have at least 1 options" do+ it "requires at least one option" dopost :create, params: { title: title, raw: "[poll]\n[/poll]" }, format: :jsonexpect(response).not_to be_successful@@ -92,7 +92,7 @@ RSpec.describe PostsController doexpect(json["errors"][0]).to eq(I18n.t("poll.default_poll_must_have_at_least_1_option"))end- it "should have at most 'SiteSetting.poll_maximum_options' options" do+ it "allows at most SiteSetting.poll_maximum_options options" doraw = +"[poll]\n"(SiteSetting.poll_maximum_options + 1).times { |n| raw << "\n- #{n}" }raw << "\n[/poll]"@@ -106,7 +106,7 @@ RSpec.describe PostsController do)end- it "should have valid parameters" do+ it "requires valid parameters" dopost :create,params: {title: title,@@ -304,7 +304,7 @@ RSpec.describe PostsController doenddescribe "named polls" do- it "should have different options" do+ it "requires different options" dopost :create,params: {title: title,@@ -322,7 +322,7 @@ RSpec.describe PostsController do)end- it "should have at least 1 option" do+ it "requires at least one option" dopost :create, params: { title: title, raw: "[poll name='foo']\n[/poll]" }, format: :jsonexpect(response).not_to be_successful@@ -334,7 +334,7 @@ RSpec.describe PostsController doenddescribe "multiple polls" do- it "works" do+ it "creates a post with multiple polls" dopost :create,params: {title: title,@@ -348,7 +348,7 @@ RSpec.describe PostsController doexpect(Poll.where(post_id: json["id"]).count).to eq(2)end- it "should have a name" do+ it "requires a name" dopost :create,params: {title: title,@@ -361,7 +361,7 @@ RSpec.describe PostsController doexpect(json["errors"][0]).to eq(I18n.t("poll.multiple_polls_without_name"))end- it "should have unique name" do+ it "requires a unique name" dopost :create,params: {title: title,diff --git a/plugins/poll/spec/integration/poll_endpoints_spec.rb b/plugins/poll/spec/integration/poll_endpoints_spec.rbindex 9b82ff35919..ff2f5f2ef02 100644--- a/plugins/poll/spec/integration/poll_endpoints_spec.rb+++ b/plugins/poll/spec/integration/poll_endpoints_spec.rb@@ -28,7 +28,7 @@ RSpec.describe "DiscoursePoll endpoints" dolet(:ranked_choice_option_b) { { id: "e89dec30bbd9bf50fabf6a05b4324edf", rank: 1 } }let(:ranked_choice_option_c) { { id: "a1a6e2779b52caadb93579c0c3db7c0c", rank: 0 } }- it "should return the right response" do+ it "returns the expected voters" doDiscoursePoll::Poll.vote(user, post.id, DiscoursePoll::DEFAULT_POLL_NAME, [option_a])get "/polls/voters.json",@@ -47,7 +47,7 @@ RSpec.describe "DiscoursePoll endpoints" doexpect(option.first["username"]).to eq(user.username)end- it "should return the right response for a single option" do+ it "returns voters for a single option" doDiscoursePoll::Poll.vote(user,post_with_multiple_poll.id,@@ -75,7 +75,7 @@ RSpec.describe "DiscoursePoll endpoints" doexpect(option.first["username"]).to eq(user.username)end- it "should return valid response for a ranked choice option" do+ it "returns voters for a ranked-choice option" doranked_choice_poll = post_with_ranked_choice_poll.polls.firstranked_choice_poll_options = ranked_choice_poll.poll_optionsranked_choice_votes = {@@ -113,14 +113,14 @@ RSpec.describe "DiscoursePoll endpoints" doenddescribe "when post_id is blank" do- it "should raise the right error" do+ it "returns a bad request response" doget "/polls/voters.json", params: { poll_name: DiscoursePoll::DEFAULT_POLL_NAME }expect(response.status).to eq(400)endenddescribe "when post_id is not valid" do- it "should raise the right error" do+ it "returns a bad request response" doget "/polls/voters.json",params: {post_id: -1,@@ -132,14 +132,14 @@ RSpec.describe "DiscoursePoll endpoints" doenddescribe "when poll_name is blank" do- it "should raise the right error" do+ it "returns a bad request response" doget "/polls/voters.json", params: { post_id: post.id }expect(response.status).to eq(400)endenddescribe "when poll_name is not valid" do- it "should raise the right error" do+ it "returns a bad request response" doget "/polls/voters.json", params: { post_id: post.id, poll_name: "wrongpoll" }expect(response.status).to eq(400)expect(response.body).to include("poll_name")@@ -151,7 +151,7 @@ RSpec.describe "DiscoursePoll endpoints" doFabricate(:post, raw: "[poll type=number min=1 max=20 step=1 public=true]\n[/poll]")end- it "should return the right response" do+ it "returns voters for the number poll" dopostDiscoursePoll::Poll.vote(diff --git a/plugins/poll/spec/integration/user_merger_spec.rb b/plugins/poll/spec/integration/user_merger_spec.rbindex c649886ed83..1d49f127ee3 100644--- a/plugins/poll/spec/integration/user_merger_spec.rb+++ b/plugins/poll/spec/integration/user_merger_spec.rb@@ -24,7 +24,7 @@ RSpec.describe UserMerger doFabricate(:poll_option, poll: poll_ranked_choice, html: "Option C")end- it "will end up with no votes from source user" do+ it "leaves no votes from the source user" doFabricate(:poll_vote, poll: poll_regular, user: source_user, poll_option: poll_regular_option2)Fabricate(:poll_vote,@@ -38,7 +38,7 @@ RSpec.describe UserMerger doexpect(PollVote.where(user: source_user).count).to eq(0)end- it "will not use source user's vote if target_user already voted in the same poll" do+ it "keeps the target user's vote when both users voted in the same poll" doFabricate(:poll_vote, poll: poll_regular, user: target_user, poll_option: poll_regular_option1)Fabricate(:poll_vote, poll: poll_regular, user: source_user, poll_option: poll_regular_option2)@@ -69,7 +69,7 @@ RSpec.describe UserMerger do)end- it "will use source user's vote if poll was the ranked choice type" do+ it "uses the source user's vote for a ranked-choice poll" doFabricate(:poll_vote,poll: poll_ranked_choice,diff --git a/plugins/poll/spec/jobs/regular/close_poll_spec.rb b/plugins/poll/spec/jobs/regular/close_poll_spec.rbindex 9f47cefca7a..395ab22ef9c 100644--- a/plugins/poll/spec/jobs/regular/close_poll_spec.rb+++ b/plugins/poll/spec/jobs/regular/close_poll_spec.rb@@ -4,7 +4,7 @@ RSpec.describe Jobs::ClosePoll dolet(:post) { Fabricate(:post, raw: "[poll]\n- A\n- B\n[/poll]") }describe "missing arguments" do- it "should raise the right error" do+ it "raises InvalidParameters for missing poll_name or post_id" doexpect do Jobs::ClosePoll.new.execute(post_id: post.id) end.to raise_error(Discourse::InvalidParameters,"poll_name",diff --git a/plugins/poll/spec/lib/new_post_manager_spec.rb b/plugins/poll/spec/lib/new_post_manager_spec.rbindex 940aa1fda66..a41998f541f 100644--- a/plugins/poll/spec/lib/new_post_manager_spec.rb+++ b/plugins/poll/spec/lib/new_post_manager_spec.rb@@ -26,7 +26,7 @@ RSpec.describe NewPostManager do}end- it "should render the poll upon approval" do+ it "renders the poll upon approval" doresult = NewPostManager.new(user, params).performexpect(result.action).to eq(:enqueued)expect(result.reviewable).to be_presentdiff --git a/plugins/poll/spec/lib/poll_spec.rb b/plugins/poll/spec/lib/poll_spec.rbindex fb3c1d29ffd..6910e86bc8c 100644--- a/plugins/poll/spec/lib/poll_spec.rb+++ b/plugins/poll/spec/lib/poll_spec.rb@@ -54,7 +54,7 @@ RSpec.describe DiscoursePoll::Poll doendend- it "should only allow one vote per user for a regular poll" do+ it "allows one vote per user for a regular poll" dopoll = post_with_regular_poll.polls.firstexpect do@@ -67,7 +67,7 @@ RSpec.describe DiscoursePoll::Poll doend.to raise_error(DiscoursePoll::Error, I18n.t("poll.one_vote_per_user"))end- it "should not allow a ranked vote with all abstentions" do+ it "rejects a ranked vote with all abstentions" dopoll = post_with_ranked_choice_poll.polls.firstpoll_options = poll.poll_options@@ -97,7 +97,7 @@ RSpec.describe DiscoursePoll::Poll do)end- it "should clean up bad votes for a regular poll" do+ it "removes invalid votes from a regular poll" dopoll = post_with_regular_poll.polls.firstPollVote.create!(poll: poll, poll_option: poll.poll_options.first, user: user)@@ -149,7 +149,7 @@ RSpec.describe DiscoursePoll::Poll do)end- it "should respect the min/max votes per user for a multiple poll" do+ it "enforces the minimum and maximum votes for a multiple poll" dopoll = post_with_multiple_poll.polls.firstexpect do@@ -171,7 +171,7 @@ RSpec.describe DiscoursePoll::Poll doend.to raise_error(DiscoursePoll::Error, I18n.t("poll.min_vote_per_user", count: poll.min))end- it "should allow user to vote on a multiple poll even if min option is not configured" do+ it "allows voting on a multiple poll without a minimum" dopost_with_multiple_poll = Fabricate(:post, raw: <<~RAW)[poll type=multiple max=3]* 1@@ -196,7 +196,7 @@ RSpec.describe DiscoursePoll::Poll do)end- it "should allow user to vote on a multiple poll even if max option is not configured" do+ it "allows voting on a multiple poll without a maximum" dopost_with_multiple_poll = Fabricate(:post, raw: <<~RAW)[poll type=multiple min=1]* 1diff --git a/plugins/spoiler-alert/spec/topic_excerpt_spec.rb b/plugins/spoiler-alert/spec/topic_excerpt_spec.rbindex 39ba1c86039..54d37d834a8 100644--- a/plugins/spoiler-alert/spec/topic_excerpt_spec.rb+++ b/plugins/spoiler-alert/spec/topic_excerpt_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: truedescribe PrettyText do- it "should remove spoilers from excerpts" do+ it "removes spoilers from excerpts" doexpect(PrettyText.excerpt("<div class='spoiler'><img src='http://cnn.com/a.gif'></div>", 100),).to match_html ""diff --git a/spec/db/migrate/20250714010001_backfill_themeable_site_settings_spec.rb b/spec/db/migrate/20250714010001_backfill_themeable_site_settings_spec.rbindex 7c3b9dde0a2..3c5daedc263 100644--- a/spec/db/migrate/20250714010001_backfill_themeable_site_settings_spec.rb+++ b/spec/db/migrate/20250714010001_backfill_themeable_site_settings_spec.rb@@ -14,7 +14,7 @@ RSpec.describe BackfillThemeableSiteSettings doafter { ActiveRecord::Migration.verbose = @original_verbose }- it "works" do+ it "backfills themeable site settings" doDB.exec("INSERT INTO site_settings (name, data_type, value, created_at, updated_at)VALUES ('enable_welcome_banner', :data_type, :value, NOW(), NOW())",diff --git a/spec/db/migrate/20250902072941_sync_timerable_id_topic_id_spec.rb b/spec/db/migrate/20250902072941_sync_timerable_id_topic_id_spec.rbindex 24174efc3c2..5de5c9e676f 100644--- a/spec/db/migrate/20250902072941_sync_timerable_id_topic_id_spec.rb+++ b/spec/db/migrate/20250902072941_sync_timerable_id_topic_id_spec.rb@@ -10,7 +10,7 @@ RSpec.describe SyncTimerableIdTopicId doafter { ActiveRecord::Migration.verbose = @original_verbose }- it "works" do+ it "syncs timerable_id to topic_id" doDB.exec("DROP TRIGGER IF EXISTS topic_timers_topic_id_trigger ON topic_timers")Migration::ColumnDropper.drop_readonly(:topic_timers, :topic_id)DB.exec("ALTER TABLE topic_timers ALTER COLUMN timerable_id DROP NOT NULL")diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rbindex 58562b61320..41332df2b57 100644--- a/spec/helpers/application_helper_spec.rb+++ b/spec/helpers/application_helper_spec.rb@@ -262,7 +262,7 @@ RSpec.describe ApplicationHelper dodescribe "render_sitelinks_search_tag" docontext "for non-subfolder install" docontext "when on homepage" do- it "will return sitelinks search tag" do+ it "returns the sitelinks search tag" dohelper.stubs(:current_page?).returns(false)helper.stubs(:current_page?).with("/").returns(true)@@ -290,7 +290,7 @@ RSpec.describe ApplicationHelper doendcontext "when not on homepage" do- it "will not return sitelinks search tag" do+ it "omits the sitelinks search tag" dohelper.stubs(:current_page?).returns(true)helper.stubs(:current_page?).with("/").returns(false)helper.stubs(:current_page?).with(Discourse.base_path).returns(false)@@ -301,7 +301,7 @@ RSpec.describe ApplicationHelper docontext "for subfolder install" docontext "when on homepage" do- it "will return sitelinks search tag" do+ it "returns the sitelinks search tag" doDiscourse.stubs(:base_path).returns("/subfolder-base-path/")helper.stubs(:current_page?).returns(false)helper.stubs(:current_page?).with(Discourse.base_path).returns(true)@@ -311,7 +311,7 @@ RSpec.describe ApplicationHelper doendcontext "when not on homepage" do- it "will not return sitelinks search tag" do+ it "omits the sitelinks search tag" doDiscourse.stubs(:base_path).returns("/subfolder-base-path/")helper.stubs(:current_page?).returns(true)helper.stubs(:current_page?).with("/").returns(false)@@ -339,7 +339,7 @@ RSpec.describe ApplicationHelper dobefore { helper.stubs(:mobile_device?).returns(false) }context "when logo_dark is not set" do- it "will return site_logo_url instead" do+ it "returns site_logo_url" doexpect(helper.application_logo_url).to eq(SiteSetting.site_logo_url)endend@@ -347,7 +347,7 @@ RSpec.describe ApplicationHelper docontext "when logo_dark is set" dobefore { SiteSetting.logo_dark = Fabricate(:upload, url: "/images/logo-dark.png") }- it "will return site_logo_dark_url" do+ it "returns site_logo_dark_url" doexpect(helper.application_logo_url).to eq(SiteSetting.site_logo_dark_url)endend@@ -357,7 +357,7 @@ RSpec.describe ApplicationHelper dobefore { helper.stubs(:mobile_device?).returns(true) }context "when mobile_logo_dark is not set" do- it "will return site_mobile_logo_url instead" do+ it "returns site_mobile_logo_url" doexpect(helper.application_logo_url).to eq(SiteSetting.site_mobile_logo_url)endend@@ -367,7 +367,7 @@ RSpec.describe ApplicationHelper doSiteSetting.mobile_logo_dark = Fabricate(:upload, url: "/images/mobile-logo-dark.png")end- it "will return site_mobile_logo_dark_url" do+ it "returns site_mobile_logo_dark_url" doexpect(helper.application_logo_url).to eq(SiteSetting.site_mobile_logo_dark_url)endend@@ -378,7 +378,7 @@ RSpec.describe ApplicationHelper dodescribe "application_logo_dark_url" docontext "when dark theme is not present" docontext "when dark logo is not present" do- it "should return nothing" do+ it "returns no dark logo URL" doexpect(helper.application_logo_dark_url.present?).to eq(false)endend@@ -396,7 +396,7 @@ RSpec.describe ApplicationHelper doendcontext "when dark logo is not present" do- it "should return nothing" do+ it "returns no dark logo URL" doexpect(helper.application_logo_dark_url.present?).to eq(false)endend@@ -404,7 +404,7 @@ RSpec.describe ApplicationHelper docontext "when dark logo is present" dobefore { SiteSetting.logo_dark = Fabricate(:upload, url: "/images/logo-dark.png") }- it "should return correct url" do+ it "returns site_logo_dark_url" doexpect(helper.application_logo_dark_url).to eq(SiteSetting.site_logo_dark_url)endend@@ -423,7 +423,7 @@ RSpec.describe ApplicationHelper doSiteSetting.logo_dark = Fabricate(:upload, url: "/images/logo-dark.png")end- it "should return nothing" do+ it "returns no separate dark logo URL" doexpect(helper.application_logo_url).to eq(SiteSetting.site_logo_dark_url)expect(helper.application_logo_dark_url.present?).to eq(false)enddiff --git a/spec/helpers/user_notifications_helper_spec.rb b/spec/helpers/user_notifications_helper_spec.rbindex 94ef066d9ab..756b6509ce8 100644--- a/spec/helpers/user_notifications_helper_spec.rb+++ b/spec/helpers/user_notifications_helper_spec.rb@@ -126,7 +126,7 @@ RSpec.describe UserNotificationsHelper dobefore { SiteSetting.logo = upload }- it "should return the right URL" do+ it "returns the local upload URL" doexpect(helper.logo_url).to eq("http://test.localhost/#{upload_path}/original/1X/somesha1.png",)@@ -137,7 +137,7 @@ RSpec.describe UserNotificationsHelper doGlobalSetting.expects(:cdn_url).returns("https://some.localcdn.com").at_least_onceend- it "should return the right URL" do+ it "returns the local CDN upload URL" doexpect(helper.logo_url).to eq("https://some.localcdn.com/#{upload_path}/original/1X/somesha1.png",)@@ -147,7 +147,7 @@ RSpec.describe UserNotificationsHelper dodescribe "when logo is an SVG" dolet(:upload) { Fabricate(:upload, extension: "svg") }- it "should return nil" do+ it "returns nil" doexpect(helper.logo_url).to eq(nil)endend@@ -161,14 +161,14 @@ RSpec.describe UserNotificationsHelper doSiteSetting.logo = uploadend- it "should return the right URL" do+ it "returns the S3 upload URL" doexpect(helper.logo_url).to eq("http://s3-upload-bucket.s3.dualstack.#{SiteSetting.s3_region}.amazonaws.com/original/1X/somesha1.png",)enddescribe "when global cdn path is configured" do- it "should return the right url" do+ it "preserves the S3 upload URL when a global CDN is configured" doGlobalSetting.stubs(:cdn_url).returns("https://some.cdn.com/cluster")expect(helper.logo_url).to eq(@@ -180,7 +180,7 @@ RSpec.describe UserNotificationsHelper dodescribe "when cdn path is configured" dobefore { SiteSetting.s3_cdn_url = "https://some.cdn.com" }- it "should return the right url" do+ it "returns the S3 CDN upload URL" doexpect(helper.logo_url).to eq("https://some.cdn.com/original/1X/somesha1.png")endenddiff --git a/spec/import_export/importer_spec.rb b/spec/import_export/importer_spec.rbindex 00cc89203e6..6076720942a 100644--- a/spec/import_export/importer_spec.rb+++ b/spec/import_export/importer_spec.rb@@ -26,7 +26,7 @@ RSpec.describe ImportExport::Importer doendcontext "with categories and groups" do- it "works" do+ it "imports categories, their topics, and groups without adding users" dodata = import_data.dupdata[:topics] = nildata[:users] = nildiff --git a/spec/integration/activerecord_preventing_writes_spec.rb b/spec/integration/activerecord_preventing_writes_spec.rbindex 3de301a6c09..cc1c024b796 100644--- a/spec/integration/activerecord_preventing_writes_spec.rb+++ b/spec/integration/activerecord_preventing_writes_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe "When ActiveRecord is preventing writes" do- it "should not result in an error response when there is a theme field that needs to be baked" do+ it "does not return an error when a theme field needs baking" dotheme_field =Fabricate(:theme_field,diff --git a/spec/integration/multisite_cookies_spec.rb b/spec/integration/multisite_cookies_spec.rbindex 9a24b4d0e2d..dc3ee3d0617 100644--- a/spec/integration/multisite_cookies_spec.rb+++ b/spec/integration/multisite_cookies_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe "multisite", type: %i[multisite request] do- it "works" do+ it "keeps cookies isolated between sites" doget "http://test.localhost/session/csrf.json"expect(response.status).to eq(200)cookie = CGI.escape(response.cookies["_forum_session"])diff --git a/spec/integration/multisite_spec.rb b/spec/integration/multisite_spec.rbindex a1f27013f6d..919b48e2645 100644--- a/spec/integration/multisite_spec.rb+++ b/spec/integration/multisite_spec.rb@@ -1,18 +1,18 @@# frozen_string_literal: trueRSpec.describe "multisite", type: %i[multisite request] do- it "should always allow /srv/status through" do+ it "allows /srv/status for an unknown host" doget "http://unknown.com/srv/status"expect(response.status).to eq(200)expect(request.env["HTTP_HOST"]).to eq("test.localhost") # Rewritten by EnforceHostname middlewareend- it "should 404 for unknown domains" do+ it "returns 404 for unknown domains" doget "http://unknown.com/about.json"expect(response.status).to eq(404)end- it "should hit correct site otherwise" do+ it "routes known hosts to the corresponding site" dosite_1_url =Fabricate(:topic, title: "Site 1 Topic Title", user: Discourse.system_user).relative_urldiff --git a/spec/integration/rate_limiting_spec.rb b/spec/integration/rate_limiting_spec.rbindex 20b2dc21604..b3c601c4682 100644--- a/spec/integration/rate_limiting_spec.rb+++ b/spec/integration/rate_limiting_spec.rb@@ -4,7 +4,7 @@RSpec.describe "rate limiter integration" dobefore { RateLimiter.enable }- it "will rate limit message bus requests once queueing" do+ it "rate-limits queued MessageBus requests" dofreeze_timeglobal_setting :reject_message_bus_queue_seconds, 0.1@@ -18,7 +18,7 @@ RSpec.describe "rate limiter integration" doexpect(response.headers["Retry-After"].to_i).to be > 29end- it "will not rate limit when all is good" do+ it "does not rate-limit valid requests" dofreeze_timeglobal_setting :reject_message_bus_queue_seconds, 0.1@@ -31,7 +31,7 @@ RSpec.describe "rate limiter integration" doexpect(response.status).to eq(200)end- it "will clear the token cookie if invalid" do+ it "clears an invalid token cookie" doname = Auth::DefaultCurrentUserProvider::TOKEN_COOKIE# we try 11 times because the rate limit is 10diff --git a/spec/integration/same_ip_spammers_spec.rb b/spec/integration/same_ip_spammers_spec.rbindex 0e1aac03eab..4d3a74a3ab8 100644--- a/spec/integration/same_ip_spammers_spec.rb+++ b/spec/integration/same_ip_spammers_spec.rb@@ -11,7 +11,7 @@ RSpec.describe "spammers on same IP" dolet!(:first_post) { create_post(user: spammer1) }let!(:second_post) { create_post(user: spammer2, topic: first_post.topic) }- it "should not increase spam count" do+ it "does not increase the spam count" doexpect(first_post.reload.spam_count).to eq(0)expect(second_post.reload.spam_count).to eq(0)end@@ -28,7 +28,7 @@ RSpec.describe "spammers on same IP" docontext "when second spammer replies" dolet!(:second_post) { create_post(user: spammer2, topic: first_post.topic) }- it "should increase spam count" do+ it "increases the spam count" doexpect(first_post.reload.spam_count).to eq(1)expect(second_post.reload.spam_count).to eq(1)end@@ -36,7 +36,7 @@ RSpec.describe "spammers on same IP" docontext "with third spam post" dolet!(:third_post) { create_post(user: spammer3, topic: first_post.topic) }- it "should increase spam count" do+ it "increases the spam count" doexpect(first_post.reload.spam_count).to eq(1)expect(second_post.reload.spam_count).to eq(1)expect(third_post.reload.spam_count).to eq(1)@@ -56,7 +56,7 @@ RSpec.describe "spammers on same IP" docontext "with a reply by a new user at the same IP address" dolet!(:second_post) { create_post(user: spammer2, topic: first_post.topic) }- it "should increase the spam count correctly" do+ it "increases the spam count correctly" doexpect(first_post.reload.spam_count).to eq(0)expect(second_post.reload.spam_count).to eq(1)enddiff --git a/spec/integration/smtp_spec.rb b/spec/integration/smtp_spec.rbindex 62f81c74cf7..f5a52c45287 100644--- a/spec/integration/smtp_spec.rb+++ b/spec/integration/smtp_spec.rb@@ -12,7 +12,7 @@ RSpec.describe "SMTP Settings Integration" doActionMailer::Base.delivery_method = @original_action_mailer_delivery_methodend- it "should disable starttls_auto when tls is enabled" do+ it "disables starttls_auto when TLS is enabled" doglobal_setting :smtp_address, "localhost"global_setting :smtp_port, 465global_setting :smtp_force_tls, true@@ -20,7 +20,7 @@ RSpec.describe "SMTP Settings Integration" doexpect(GlobalSetting.smtp_settings[:enable_starttls_auto]).to be_falseyend- it "should leave starttls_auto enabled when tls is not enabled" do+ it "leaves starttls_auto enabled when TLS is disabled" doglobal_setting :smtp_address, "localhost"global_setting :smtp_port, 587global_setting :smtp_force_tls, false@@ -28,7 +28,7 @@ RSpec.describe "SMTP Settings Integration" doexpect(GlobalSetting.smtp_settings[:enable_starttls_auto]).to be_truthyend- it "should attempt to send out an email without raising any SMTP argument errors" do+ it "attempts to send an email without SMTP argument errors" doglobal_setting :smtp_address, "192.0.2.1"global_setting :smtp_port, 12_345global_setting :smtp_open_timeout, 0.00001diff --git a/spec/integration/spam_rules_spec.rb b/spec/integration/spam_rules_spec.rbindex f666b15aded..02f8e85df45 100644--- a/spec/integration/spam_rules_spec.rb+++ b/spec/integration/spam_rules_spec.rb@@ -24,12 +24,12 @@ RSpec.describe "spam rules for users" dobefore { PostActionCreator.create(user1, spam_post, :spam) }- it "should not hide the post" do+ it "does not hide the post" doexpect(spam_post.reload).to_not be_hiddenendcontext "when spam posts are flagged enough times, but not by enough users" do- it "should not hide the post" do+ it "does not hide the post" doPostActionCreator.create(user1, spam_post2, :spam)expect(spam_post.reload).to_not be_hidden@@ -44,7 +44,7 @@ RSpec.describe "spam rules for users" dolet!(:mod_pm_count) { moderator.private_topics_count }let!(:reviewable) { PostActionCreator.spam(user2, spam_post).reviewable }- it "should hide the posts" do+ it "hides the posts" doexpect(Guardian.new(spammer).can_create_topic?(nil)).to be(false)expect {PostCreator.create(@@ -69,7 +69,7 @@ RSpec.describe "spam rules for users" doendcontext "when a post is deleted" do- it "should silence the spammer" do+ it "silences the spammer" dospam_post.trash!(moderator)spammer.reloadexpect(spammer.reload).to be_silenced@@ -77,7 +77,7 @@ RSpec.describe "spam rules for users" doendcontext "when spammer becomes trust level 1" do- it "should silence the spammer" do+ it "silences the spammer" dospammer.change_trust_level!(TrustLevel[1])spammer.reloadexpect(spammer.reload).to be_silenced@@ -86,7 +86,7 @@ RSpec.describe "spam rules for users" doendcontext "with hide_post_sensitivity" do- it "should silence the spammer" do+ it "silences the spammer" doReviewable.set_priorities(high: 2.0)SiteSetting.hide_post_sensitivity = Reviewable.sensitivities[:low]PostActionCreator.create(user2, spam_post, :spam)@@ -104,7 +104,7 @@ RSpec.describe "spam rules for users" dolet!(:spam_post) { Fabricate(:post, user: spammer) }let!(:private_messages_count) { spammer.private_topics_count }- it "should not allow spammer to create new posts" do+ it "prevents the spammer from creating new posts" doPostActionCreator.create(user1, spam_post, :spam)PostActionCreator.create(user2, spam_post, :spam)@@ -129,7 +129,7 @@ RSpec.describe "spam rules for users" dolet!(:spam_post) { Fabricate(:post, user: spammer) }let!(:private_messages_count) { spammer.private_topics_count }- it "should not hide the post" do+ it "does not hide the post" doPostActionCreator.create(user1, spam_post, :spam)PostActionCreator.create(user2, spam_post, :spam)diff --git a/spec/integration/tag_counts_spec.rb b/spec/integration/tag_counts_spec.rbindex 5c3fb032be0..6b44c406fb4 100644--- a/spec/integration/tag_counts_spec.rb+++ b/spec/integration/tag_counts_spec.rb@@ -36,19 +36,19 @@ RSpec.describe "Updating tag counts" doexpect(tag2.pm_topic_count).to eq(1)end- it "should decrease Tag#public_topic_count for all tags when topic's category is changed from a public category to a read restricted category" do+ it "decreases tag public topic counts when moving a public topic to a restricted category" doexpect { topic_in_public_category.change_category_to_id(private_category.id) }.to change {tag1.reload.public_topic_count}.by(-1).and change { tag2.reload.public_topic_count }.by(-1)end- it "should increase Tag#public_topic_count for all tags when topic's category is changed from a read restricted category to a public category" do+ it "increases tag public topic counts when moving a restricted topic to a public category" doexpect { topic_in_private_category.change_category_to_id(public_category.id) }.to change {tag1.reload.public_topic_count}.by(1).and change { tag2.reload.public_topic_count }.by(1)end- it "should not change Tag#public_topic_count for all tags when topic's category is changed from a public category to another public category" do+ it "preserves tag public topic counts when moving between public categories" doexpect dotopic_in_public_category.change_category_to_id(public_category2.id)end.to not_change { tag1.reload.public_topic_count }.and not_change {@@ -56,7 +56,7 @@ RSpec.describe "Updating tag counts" do}end- it "should not change Tag#public_topic_count for all tags when topic's category is changed from a read restricted category to another read restricted category" do+ it "preserves tag public topic counts when moving between restricted categories" doexpect dotopic_in_private_category.change_category_to_id(private_category2.id)end.to not_change { tag1.reload.public_topic_count }.and not_change {@@ -75,7 +75,7 @@ RSpec.describe "Updating tag counts" do}.by(1)end- it "should not change Tag#public_topic_count for all tags when topic is converted from private message to a regular topic in a read restricted category" do+ it "preserves tag public topic counts when converting a PM to a restricted topic" doexpect doprivate_message.convert_to_public_topic(Discourse.system_user,@@ -86,7 +86,7 @@ RSpec.describe "Updating tag counts" do}end- it "should decrease Tag#public_topic_count for all tags when regular topic in public category is converted to a private message" do+ it "decreases tag public topic counts when converting a public topic to a PM" doexpect dotopic_in_public_category.convert_to_private_message(Discourse.system_user)end.to change { tag1.reload.public_topic_count }.by(-1).and change {@@ -94,7 +94,7 @@ RSpec.describe "Updating tag counts" do}.by(-1)end- it "should not change Tag#public_topic_count for all tags when regular topic in read restricted category is converted to a private message" do+ it "preserves tag public topic counts when converting a restricted topic to a PM" doexpect dotopic_in_private_category.convert_to_private_message(Discourse.system_user)end.to not_change { tag1.reload.public_topic_count }.and not_change {diff --git a/spec/integration/topic_auto_close_spec.rb b/spec/integration/topic_auto_close_spec.rbindex d4daaa070a6..145cf048fba 100644--- a/spec/integration/topic_auto_close_spec.rb+++ b/spec/integration/topic_auto_close_spec.rb@@ -10,7 +10,7 @@ RSpec.describe Topic docontext "when uncategorized" dolet(:category) { nil }- it "should not schedule the topic to auto-close" do+ it "does not schedule the topic to auto-close" doexpect(topic.public_topic_timer).to eq(nil)expect(job_klass.jobs).to eq([])end@@ -19,7 +19,7 @@ RSpec.describe Topic docontext "with category without default auto-close" dolet(:category) { Fabricate(:category, auto_close_hours: nil) }- it "should not schedule the topic to auto-close" do+ it "does not schedule the topic to auto-close" doexpect(topic.public_topic_timer).to eq(nil)expect(job_klass.jobs).to eq([])end@@ -31,7 +31,7 @@ RSpec.describe Topic docontext "when category has a default auto-close" dolet(:category) { Fabricate(:category, auto_close_hours: 2.0) }- it "should schedule the topic to auto-close" do+ it "schedules the topic to auto-close" dotopictopic_status_update = TopicTimer.last@@ -44,7 +44,7 @@ RSpec.describe Topic dolet(:admin) { Fabricate(:admin) }let(:staff_topic) { Fabricate(:topic, user: admin, category: category) }- it "should schedule the topic to auto-close" do+ it "schedules the topic to auto-close" dostaff_topictopic_status_update = TopicTimer.last@@ -55,7 +55,7 @@ RSpec.describe Topic doendcontext "when topic is closed manually" do- it "should remove the schedule to auto-close the topic" do+ it "removes the topic's auto-close schedule" dotopic_timer_id = staff_topic.public_topic_timer.idstaff_topic.update_status("closed", true, admin)@@ -71,7 +71,7 @@ RSpec.describe Topic dolet(:regular_user) { Fabricate(:user) }let(:regular_user_topic) { Fabricate(:topic, user: regular_user, category: category) }- it "should schedule the topic to auto-close" do+ it "schedules the topic to auto-close" doregular_user_topictopic_status_update = TopicTimer.lastdiff --git a/spec/integration/watched_words_spec.rb b/spec/integration/watched_words_spec.rbindex c4fb2064ec8..decd57d8098 100644--- a/spec/integration/watched_words_spec.rb+++ b/spec/integration/watched_words_spec.rb@@ -44,7 +44,7 @@ RSpec.describe WatchedWord doexpect(result.errors[:base]&.first).to eq(I18n.t("contains_blocked_word", word: "<a>"))end- it "should prevent the post from being created" do+ it "prevents the post from being created" domanager =NewPostManager.new(tl2_user,@@ -65,7 +65,7 @@ RSpec.describe WatchedWord doshould_block_post(manager)end- it "should handle UTF-8 characters" do+ it "matches UTF-8 characters" doblock_word = Fabricate(:watched_word, action: WatchedWord.actions[:block], word: "abc")manager =NewPostManager.new(tl2_user, title: "Hello world", raw: "abcódef", topic_id: topic.id)@@ -73,7 +73,7 @@ RSpec.describe WatchedWord doexpect(manager.perform).to be_successend- it "should block the post from admin" do+ it "blocks posts from an admin" domanager =NewPostManager.new(admin,@@ -83,7 +83,7 @@ RSpec.describe WatchedWord doshould_block_post(manager)end- it "should block the post from moderator" do+ it "blocks posts from a moderator" domanager =NewPostManager.new(moderator,@@ -93,7 +93,7 @@ RSpec.describe WatchedWord doshould_block_post(manager)end- it "should block the post if it contains multiple blocked words" do+ it "blocks posts containing multiple blocked words" domanager =NewPostManager.new(moderator,@@ -112,7 +112,7 @@ RSpec.describe WatchedWord do}.to_not change { Post.count }end- it "should block in a private message too" do+ it "blocks the word in private messages" domanager =NewPostManager.new(tl2_user,@@ -139,7 +139,7 @@ RSpec.describe WatchedWord doendcontext "with require_approval" do- it "should queue the post for approval" do+ it "queues the post for approval" domanager =NewPostManager.new(tl2_user,@@ -163,7 +163,7 @@ RSpec.describe WatchedWord doexpect(result.action).to eq(:enqueued)end- it "should not queue posts from admin" do+ it "does not queue posts from an admin" domanager =NewPostManager.new(admin,@@ -175,7 +175,7 @@ RSpec.describe WatchedWord doexpect(result.action).to eq(:create_post)end- it "should not queue posts from moderator" do+ it "does not queue posts from a moderator" domanager =NewPostManager.new(moderator,@@ -221,7 +221,7 @@ RSpec.describe WatchedWord doexpect { Jobs::ProcessPost.new.execute(post_id: post.id) }.to_not change { PostAction.count }end- it "should flag the post as inappropriate" do+ it "flags the post as inappropriate" dotopic = Fabricate(:topic, user: tl2_user)post = Fabricate(:post, raw: "I said.... #{flag_word.word}", topic: topic, user: tl2_user)Jobs::ProcessPost.new.execute(post_id: post.id)@@ -242,7 +242,7 @@ RSpec.describe WatchedWord do).to be_presentend- it "should flag the post if it contains multiple flagged words" do+ it "flags posts containing multiple flagged words" dotopic = Fabricate(:topic, user: tl2_user)post =Fabricate(@@ -272,7 +272,7 @@ RSpec.describe WatchedWord do).to be_presentend- it "should look at the title too" do+ it "matches flagged words in the title" doshould_flag_post(tl2_user,"I thought the movie was not bad actually.",@@ -280,7 +280,7 @@ RSpec.describe WatchedWord do)end- it "shouldn't flag posts by admin" do+ it "does not flag posts by an admin" doshould_not_flag_post(admin,"I thought the #{flag_word.word} was bad.",@@ -288,7 +288,7 @@ RSpec.describe WatchedWord do)end- it "shouldn't flag posts by moderator" do+ it "does not flag posts by a moderator" doshould_not_flag_post(moderator,"I thought the #{flag_word.word} was bad.",@@ -348,7 +348,7 @@ RSpec.describe WatchedWord do).to eq(true)end- it "should not flag on rebake" do+ it "does not flag a post when rebaking it" dopost =Fabricate(:post,diff --git a/spec/jobs/activation_reminder_emails_spec.rb b/spec/jobs/activation_reminder_emails_spec.rbindex e70cc9abaa9..010b3787ef3 100644--- a/spec/jobs/activation_reminder_emails_spec.rb+++ b/spec/jobs/activation_reminder_emails_spec.rb@@ -6,7 +6,7 @@ RSpec.describe Jobs::ActivationReminderEmails do# should be between 2 and 3 dayslet(:created_at) { 50.hours.ago }- it "should email inactive users" do+ it "emails inactive users" douser = Fabricate(:user, active: false, created_at: created_at)expect { described_class.new.execute({}) }.to change { ActionMailer::Base.deliveries.size }.by(@@ -20,7 +20,7 @@ RSpec.describe Jobs::ActivationReminderEmails doexpect(user.reload.custom_fields["activation_reminder"]).to eq(nil)end- it "should not email active users" do+ it "does not email active users" douser = Fabricate(:user, active: true, created_at: created_at)expect { described_class.new.execute({}) }.to not_change {@@ -28,7 +28,7 @@ RSpec.describe Jobs::ActivationReminderEmails do}.and not_change { user.email_tokens.count }end- it "should not email staged users" do+ it "does not email staged users" douser = Fabricate(:user, active: false, staged: true, created_at: created_at)expect { described_class.new.execute({}) }.to not_change {diff --git a/spec/jobs/backfill_sidebar_site_settings_spec.rb b/spec/jobs/backfill_sidebar_site_settings_spec.rbindex 22efce29cce..e597be3dd86 100644--- a/spec/jobs/backfill_sidebar_site_settings_spec.rb+++ b/spec/jobs/backfill_sidebar_site_settings_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe Jobs::BackfillSidebarSiteSettings do- it "should have a cluster concurrency of 1" do+ it "has a cluster concurrency of 1" doexpect(Jobs::BackfillSidebarSiteSettings.get_cluster_concurrency).to eq(1)endenddiff --git a/spec/jobs/bookmark_reminder_notifications_spec.rb b/spec/jobs/bookmark_reminder_notifications_spec.rbindex 6f50fb51bf0..e03fda95ea3 100644--- a/spec/jobs/bookmark_reminder_notifications_spec.rb+++ b/spec/jobs/bookmark_reminder_notifications_spec.rb@@ -28,7 +28,7 @@ RSpec.describe Jobs::BookmarkReminderNotifications doexpect(bookmark3.reminder_last_sent_at).not_to eq(nil)end- it "will not send a reminder for a bookmark in the future" do+ it "does not remind the user about a future bookmark" dofreeze_timebookmark4 = Fabricate(:bookmark, reminder_at: 1.day.from_now)expect { job.execute }.to change { Notification.where(user: user).count }.by(3)@@ -58,7 +58,7 @@ RSpec.describe Jobs::BookmarkReminderNotifications doendend- it "will not send notification when topic is not available" do+ it "does not notify when the topic is unavailable" dobookmark1.bookmarkable.topic.destroybookmark2.bookmarkable.topic.destroybookmark3.bookmarkable.topic.destroydiff --git a/spec/jobs/clean_up_inactive_users_spec.rb b/spec/jobs/clean_up_inactive_users_spec.rbindex 81f2e7d8ff0..bcbf5e8b1a8 100644--- a/spec/jobs/clean_up_inactive_users_spec.rb+++ b/spec/jobs/clean_up_inactive_users_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe Jobs::CleanUpInactiveUsers do- it "should clean up new users that have been inactive" do+ it "removes new users who have been inactive" doSiteSetting.clean_up_inactive_users_after_days = 0user =@@ -71,7 +71,7 @@ RSpec.describe Jobs::CleanUpInactiveUsers doexpect(User.exists?(moderator.id)).to eq(true)end- it "should clean up a user that has a deleted post" do+ it "removes an inactive user whose post was deleted" doSiteSetting.clean_up_inactive_users_after_days = 1Fabricate(:active_user)@@ -93,7 +93,7 @@ RSpec.describe Jobs::CleanUpInactiveUsers doexpect { described_class.new.execute({}) }.to change { User.count }.by(-1)end- it "should clean up user that has a deleted topic" do+ it "removes an inactive user whose topic was deleted" doSiteSetting.clean_up_inactive_users_after_days = 1Fabricate(:active_user)diff --git a/spec/jobs/clean_up_unused_user_api_keys_spec.rb b/spec/jobs/clean_up_unused_user_api_keys_spec.rbindex 28c24b046a6..bd3d22b771f 100644--- a/spec/jobs/clean_up_unused_user_api_keys_spec.rb+++ b/spec/jobs/clean_up_unused_user_api_keys_spec.rb@@ -8,7 +8,7 @@ RSpec.describe Jobs::CleanUpUnusedUserApiKeys docontext "when user api key is unused in last 1 days" dobefore { SiteSetting.revoke_user_api_keys_unused_days = 1 }- it "should only revoke keys that are active and unused" do+ it "revokes only active unused keys" dofreeze_timekey1.update!(last_used_at: 2.days.ago)diff --git a/spec/jobs/clean_up_uploads_spec.rb b/spec/jobs/clean_up_uploads_spec.rbindex 6a81baa9243..8eff045c103 100644--- a/spec/jobs/clean_up_uploads_spec.rb+++ b/spec/jobs/clean_up_uploads_spec.rb@@ -91,7 +91,7 @@ RSpec.describe Jobs::CleanUpUploads dodescribe "when clean_up_uploads is disabled" dobefore { SiteSetting.clean_up_uploads = false }- it "should still delete invalid upload records" do+ it "still deletes invalid upload records" doupload2 = Fabricate(:upload, created_at: 2.hours.ago, url: "", retain_hours: nil)expect do Jobs::CleanUpUploads.new.execute(nil) end.to change { Upload.count }.by(-1)diff --git a/spec/jobs/clean_up_user_api_keys_max_life_spec.rb b/spec/jobs/clean_up_user_api_keys_max_life_spec.rbindex de60bfc8391..bc20d107543 100644--- a/spec/jobs/clean_up_user_api_keys_max_life_spec.rb+++ b/spec/jobs/clean_up_user_api_keys_max_life_spec.rb@@ -10,7 +10,7 @@ RSpec.describe Jobs::CleanUpUserApiKeysMaxLife docontext "when user api key was created before the max life period" dobefore { SiteSetting.revoke_user_api_keys_maxlife_days = 2 }- it "should revoke active keys" do+ it "revokes active keys past their maximum lifetime" dofreeze_timeexpect { described_class.new.execute({}) }.to change { older_key.reload.revoked_at }.from(diff --git a/spec/jobs/clean_up_user_export_topics_spec.rb b/spec/jobs/clean_up_user_export_topics_spec.rbindex 9bfc94f24dd..c5acf908ca9 100644--- a/spec/jobs/clean_up_user_export_topics_spec.rb+++ b/spec/jobs/clean_up_user_export_topics_spec.rb@@ -3,7 +3,7 @@RSpec.describe Jobs::CleanUpUserExportTopics dofab!(:user)- it "should delete ancient user export system messages" do+ it "deletes old user-export system messages" dopost_en =SystemMessage.create_from_system_user(user,diff --git a/spec/jobs/close_topic_spec.rb b/spec/jobs/close_topic_spec.rbindex d072deea088..e63e1a6ad79 100644--- a/spec/jobs/close_topic_spec.rb+++ b/spec/jobs/close_topic_spec.rb@@ -5,7 +5,7 @@ RSpec.describe Jobs::CloseTopic dofab!(:topic) { Fabricate(:topic_timer, user: admin).topic }- it "should be able to close a topic" do+ it "closes a topic" dofreeze_time(61.minutes.from_now) dodescribed_class.new.execute(topic_timer_id: topic.public_topic_timer.id, state: true)@@ -27,7 +27,7 @@ RSpec.describe Jobs::CloseTopic doenddescribe "when trying to close a topic that has already been closed" do- it "should delete the topic timer" do+ it "deletes the topic timer" dofreeze_time(topic.public_topic_timer.execute_at + 1.minute)topic.update!(closed: true)@@ -39,7 +39,7 @@ RSpec.describe Jobs::CloseTopic doenddescribe "when trying to close a topic that has been deleted" do- it "should delete the topic timer" do+ it "deletes the topic timer" dofreeze_time(topic.public_topic_timer.execute_at + 1.minute)topic.trash!@@ -75,7 +75,7 @@ RSpec.describe Jobs::CloseTopic dofab!(:topic) { Fabricate(:topic_timer, user: user).topic }- it "should destroy the topic timer" do+ it "destroys the topic timer" dofreeze_time(topic.public_topic_timer.execute_at + 1.minute)expect do@@ -85,7 +85,7 @@ RSpec.describe Jobs::CloseTopic doexpect(topic.reload.closed).to eq(false)end- it "should reconfigure topic timer if category's topics are set to autoclose" do+ it "reconfigures the topic timer when the category's topics auto-close" docategory = Fabricate(:category, auto_close_based_on_last_post: true, auto_close_hours: 5)topic = Fabricate(:topic, category: category)diff --git a/spec/jobs/create_recent_post_search_indexes_spec.rb b/spec/jobs/create_recent_post_search_indexes_spec.rbindex 7738b20ad00..7cff2cf17a0 100644--- a/spec/jobs/create_recent_post_search_indexes_spec.rb+++ b/spec/jobs/create_recent_post_search_indexes_spec.rb@@ -9,7 +9,7 @@ RSpec.describe Jobs::CreateRecentPostSearchIndexes dobefore { SearchIndexer.enable }describe "#execute" do- it "should not create the index if required posts size has not been reached" do+ it "does not create the index before the required post count is reached" doSiteSetting.search_recent_posts_size = 1SiteSetting.search_enable_recent_regular_posts_offset_size = 3@@ -18,7 +18,7 @@ RSpec.describe Jobs::CreateRecentPostSearchIndexes do}end- it "should create the right index" do+ it "creates the expected index" doSiteSetting.search_recent_posts_size = 1SiteSetting.search_enable_recent_regular_posts_offset_size = 1diff --git a/spec/jobs/create_user_reviewable_spec.rb b/spec/jobs/create_user_reviewable_spec.rbindex 3c9a2c2b37b..712ea35bf6c 100644--- a/spec/jobs/create_user_reviewable_spec.rb+++ b/spec/jobs/create_user_reviewable_spec.rb@@ -15,7 +15,7 @@ RSpec.describe Jobs::CreateUserReviewable doexpect(reviewable.payload["email"]).to eq(user.email)end- it "should not raise an error if there is a reviewable already" do+ it "does not raise an error when a reviewable already exists" doSiteSetting.must_approve_users = truedescribed_class.new.execute(user_id: user.id)described_class.new.execute(user_id: user.id)diff --git a/spec/jobs/delete_topic_spec.rb b/spec/jobs/delete_topic_spec.rbindex 21f82329987..86e0ab3b84c 100644--- a/spec/jobs/delete_topic_spec.rb+++ b/spec/jobs/delete_topic_spec.rb@@ -18,7 +18,7 @@ RSpec.describe Jobs::DeleteTopic doexpect(topic.reload.public_topic_timer).to eq(nil)end- it "should do nothing if topic is already deleted" do+ it "does nothing when the topic is already deleted" dofirst_posttopic.trash!@@ -28,7 +28,7 @@ RSpec.describe Jobs::DeleteTopic dodescribed_class.new.execute(topic_timer_id: topic.public_topic_timer.id)end- it "should do nothing if it's too early" do+ it "does nothing when run too early" dot = Fabricate(:topic_timer, user: admin, execute_at: 5.hours.from_now).topiccreate_post(topic: t)@@ -41,7 +41,7 @@ RSpec.describe Jobs::DeleteTopic dodescribe "user isn't authorized to delete topics" dolet(:topic) { Fabricate(:topic_timer, user: Fabricate(:user)).topic }- it "shouldn't delete the topic" do+ it "does not delete the topic" docreate_post(topic: topic)freeze_time 2.hours.from_nowdiff --git a/spec/jobs/download_avatar_from_url_spec.rb b/spec/jobs/download_avatar_from_url_spec.rbindex b7da1d5f106..5ec1ba9b5b0 100644--- a/spec/jobs/download_avatar_from_url_spec.rb+++ b/spec/jobs/download_avatar_from_url_spec.rb@@ -4,7 +4,7 @@ RSpec.describe Jobs::DownloadAvatarFromUrl dofab!(:user)describe "when url is invalid" do- it "should not raise any error" do+ it "does not raise an error" doexpect dodescribed_class.new.execute(url: "/assets/something/nice.jpg", user_id: user.id)end.to_not raise_errordiff --git a/spec/jobs/download_backup_email_spec.rb b/spec/jobs/download_backup_email_spec.rbindex 01e58f9ed5d..81f120bbe24 100644--- a/spec/jobs/download_backup_email_spec.rb+++ b/spec/jobs/download_backup_email_spec.rb@@ -5,7 +5,7 @@ RSpec.describe Jobs::DownloadBackupEmail dobefore { SiteSetting.simple_email_subject = true }- it "should work" do+ it "emails a tokenized backup download link" dodescribed_class.new.execute(user_id: user.id, backup_file_path: "http://some.example.test/")email = ActionMailer::Base.deliveries.lastdiff --git a/spec/jobs/download_profile_background_from_url_spec.rb b/spec/jobs/download_profile_background_from_url_spec.rbindex 924d274673d..4f05e52f8b3 100644--- a/spec/jobs/download_profile_background_from_url_spec.rb+++ b/spec/jobs/download_profile_background_from_url_spec.rb@@ -4,7 +4,7 @@ RSpec.describe Jobs::DownloadProfileBackgroundFromUrl dofab!(:user)describe "when url is invalid" do- it "should not raise any error" do+ it "handles a relative image URL without raising an error" doexpect dodescribed_class.new.execute(url: "/assets/something/nice.jpg", user_id: user.id)end.to_not raise_errordiff --git a/spec/jobs/emit_web_hook_event_spec.rb b/spec/jobs/emit_web_hook_event_spec.rbindex 24b08590209..4cbe5f29e97 100644--- a/spec/jobs/emit_web_hook_event_spec.rb+++ b/spec/jobs/emit_web_hook_event_spec.rb@@ -26,7 +26,7 @@ RSpec.describe Jobs::EmitWebHookEvent do)end- it "should not destroy webhook event in case of error" do+ it "retains the webhook event after an error" dostub_request(:post, post_hook.payload_url).to_return(status: 500)job.execute(diff --git a/spec/jobs/ensure_s3_uploads_existence_spec.rb b/spec/jobs/ensure_s3_uploads_existence_spec.rbindex 8a5b116effd..d2aab2870b3 100644--- a/spec/jobs/ensure_s3_uploads_existence_spec.rb+++ b/spec/jobs/ensure_s3_uploads_existence_spec.rb@@ -6,7 +6,7 @@ RSpec.describe Jobs::EnsureS3UploadsExistence docontext "when `s3_inventory_bucket` has been set" dobefore { SiteSetting.s3_inventory_bucket = "some-bucket-name" }- it "works" do+ it "checks that the S3 uploads exist" doS3Inventory.any_instance.expects(:backfill_etags_and_list_missing).oncejob.execute({})enddiff --git a/spec/jobs/export_csv_file_spec.rb b/spec/jobs/export_csv_file_spec.rbindex 57ea2f204b4..d36465a87fd 100644--- a/spec/jobs/export_csv_file_spec.rb+++ b/spec/jobs/export_csv_file_spec.rb@@ -49,7 +49,7 @@ RSpec.describe Jobs::ExportCsvFile doendend- it "works" do+ it "uploads the staff action export and sends the admin a download link" doaction_logbegindiff --git a/spec/jobs/export_user_archive_spec.rb b/spec/jobs/export_user_archive_spec.rbindex 71cf71a4c7d..944afd8e661 100644--- a/spec/jobs/export_user_archive_spec.rb+++ b/spec/jobs/export_user_archive_spec.rb@@ -62,7 +62,7 @@ RSpec.describe Jobs::ExportUserArchive do)end- it "works" do+ it "creates the archive and sends its download link" doexpect do Jobs::ExportUserArchive.new.execute(user_id: user.id) end.to change {Upload.count}.by(1)diff --git a/spec/jobs/feature_topic_users_spec.rb b/spec/jobs/feature_topic_users_spec.rbindex 5b746c08f13..7e8717032bf 100644--- a/spec/jobs/feature_topic_users_spec.rb+++ b/spec/jobs/feature_topic_users_spec.rb@@ -17,7 +17,7 @@ RSpec.describe Jobs::FeatureTopicUsers dolet!(:second_post) { create_post(topic: topic, user: coding_horror) }let!(:third_post) { create_post(topic: topic, user: evil_trout) }- it "won't feature the OP" do+ it "does not feature the original poster" doJobs::FeatureTopicUsers.new.execute(topic_id: topic.id)expect(topic.reload.featured_user_ids.include?(topic.user_id)).to eq(false)end@@ -27,7 +27,7 @@ RSpec.describe Jobs::FeatureTopicUsers doexpect(topic.reload.featured_user_ids.include?(coding_horror.id)).to eq(true)end- it "won't feature the last poster" do+ it "does not feature the last poster" doJobs::FeatureTopicUsers.new.execute(topic_id: topic.id)expect(topic.reload.featured_user_ids.include?(evil_trout.id)).to eq(false)end@@ -37,7 +37,7 @@ RSpec.describe Jobs::FeatureTopicUsers dolet!(:post) { create_post }let(:topic) { post.topic }- it "it works as expected" do+ it "updates the participant count independently of featured users" do# It has 1 participant after creationexpect(topic.participant_count).to eq(1)diff --git a/spec/jobs/fix_out_of_sync_user_uploaded_avatar_spec.rb b/spec/jobs/fix_out_of_sync_user_uploaded_avatar_spec.rbindex bd5a32a7458..dce1e62a8b7 100644--- a/spec/jobs/fix_out_of_sync_user_uploaded_avatar_spec.rb+++ b/spec/jobs/fix_out_of_sync_user_uploaded_avatar_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe Jobs::FixOutOfSyncUserUploadedAvatar do- it "should fix out of sync user uploaded avatars" do+ it "repairs out-of-sync uploaded avatars" douser_with_custom_upload = Fabricate(:user)custom_upload1 = Fabricate(:upload, user: user_with_custom_upload)gravatar_upload1 = Fabricate(:upload, user: user_with_custom_upload)diff --git a/spec/jobs/fix_primary_emails_for_staged_users_spec.rb b/spec/jobs/fix_primary_emails_for_staged_users_spec.rbindex fbf4af96241..d2d175cf2db 100644--- a/spec/jobs/fix_primary_emails_for_staged_users_spec.rb+++ b/spec/jobs/fix_primary_emails_for_staged_users_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe Jobs::FixPrimaryEmailsForStagedUsers do- it "should clean up duplicated staged users" do+ it "cleans up duplicate staged users" docommon_email = "test@reply"staged_user = Fabricate(:user, staged: true, active: false)diff --git a/spec/jobs/fix_s3_etags_spec.rb b/spec/jobs/fix_s3_etags_spec.rbindex 2f72829f089..243c42dc380 100644--- a/spec/jobs/fix_s3_etags_spec.rb+++ b/spec/jobs/fix_s3_etags_spec.rb@@ -4,7 +4,7 @@ RSpec.describe Jobs::FixS3Etags dolet(:etag_with_quotes) { '"ETag"' }let(:etag_without_quotes) { "ETag" }- it "should remove double quotes from etags" do+ it "removes double quotes from ETags" doupload1 = Fabricate(:upload, etag: etag_with_quotes)upload2 = Fabricate(:upload, etag: etag_without_quotes)optimized = Fabricate(:optimized_image, etag: etag_with_quotes)diff --git a/spec/jobs/grant_anniversary_badges_spec.rb b/spec/jobs/grant_anniversary_badges_spec.rbindex 57b54708c9b..ac446045eba 100644--- a/spec/jobs/grant_anniversary_badges_spec.rb+++ b/spec/jobs/grant_anniversary_badges_spec.rb@@ -122,7 +122,7 @@ RSpec.describe Jobs::GrantAnniversaryBadges doendcontext "with repeated grants" do- it "won't award twice in the same year" do+ it "does not award twice in the same year" douser = Fabricate(:user, created_at: 400.days.ago)Fabricate(:post, user: user, created_at: 1.week.ago)@@ -132,7 +132,7 @@ RSpec.describe Jobs::GrantAnniversaryBadges doexpect(badge.count).to eq(1)end- it "will award again if a year has passed" do+ it "awards the badge again after a year has passed" douser = Fabricate(:user, created_at: 800.days.ago)Fabricate(:post, user: user, created_at: 450.days.ago)diff --git a/spec/jobs/jobs_base_spec.rb b/spec/jobs/jobs_base_spec.rbindex 28f11902570..16435a36b24 100644--- a/spec/jobs/jobs_base_spec.rb+++ b/spec/jobs/jobs_base_spec.rb@@ -166,7 +166,7 @@ RSpec.describe ::Jobs::Base doFileUtils.rm(tmp_log_file_path)end- it "should log the job in the sidekiq log file" do+ it "writes the job to the Sidekiq log" dojob = GoodJob.newjob.perform({ some_param: "some_value" })diff --git a/spec/jobs/jobs_spec.rb b/spec/jobs/jobs_spec.rbindex cb20f3b7664..b1da84889ad 100644--- a/spec/jobs/jobs_spec.rb+++ b/spec/jobs/jobs_spec.rb@@ -70,7 +70,7 @@ RSpec.describe Jobs doJobs.enqueue(:process_post, post_id: 1)end- it "should enqueue with the correct database id when the current_site_id option is given" do+ it "enqueues with the specified current_site_id" doSidekiq::Testing.fake! dojobs = Jobs::ProcessPost.jobs@@ -113,7 +113,7 @@ RSpec.describe Jobs doJobs::ProcessPost.any_instance.stubs(:execute).returns(true)end- it "should raise an exception" do+ it "raises ArgumentError without executing the job or changing connections" doJobs::ProcessPost.any_instance.expects(:execute).neverRailsMultisite::ConnectionManagement.expects(:establish_connection).neverdiff --git a/spec/jobs/notify_moved_posts_spec.rb b/spec/jobs/notify_moved_posts_spec.rbindex c60bd1e491c..e5a1f8a2720 100644--- a/spec/jobs/notify_moved_posts_spec.rb+++ b/spec/jobs/notify_moved_posts_spec.rb@@ -23,7 +23,7 @@ RSpec.describe Jobs::NotifyMovedPosts doNotification.where(notification_type: Notification.types[:moved_post])end- it "should create two notifications" do+ it "creates two notifications" doexpect {Jobs::NotifyMovedPosts.new.execute(post_ids: [p1.id, p2.id, p3.id], moved_by_id: admin.id)}.to change(moved_post_notifications, :count).by(2)diff --git a/spec/jobs/notify_reviewable_spec.rb b/spec/jobs/notify_reviewable_spec.rbindex 2abb7494e32..0eec7cc630c 100644--- a/spec/jobs/notify_reviewable_spec.rb+++ b/spec/jobs/notify_reviewable_spec.rb@@ -29,7 +29,7 @@ RSpec.describe Jobs::NotifyReviewable do)end- it "will notify users of new reviewable content for the user menu" do+ it "notifies users of new reviewable content for the user menu" doSiteSetting.navigation_menu = "sidebar"SiteSetting.enable_category_group_moderation = true@@ -103,7 +103,7 @@ RSpec.describe Jobs::NotifyReviewable doexpect(group_user_message.data[:unseen_reviewable_count]).to eq(1)end- it "won't notify a group when disabled" do+ it "does not notify a group when disabled" doSiteSetting.enable_category_group_moderation = falseGroupUser.create!(group_id: group.id, user_id: moderator.id)diff --git a/spec/jobs/open_topic_spec.rb b/spec/jobs/open_topic_spec.rbindex 946c459fc98..d49c5a6c21c 100644--- a/spec/jobs/open_topic_spec.rb+++ b/spec/jobs/open_topic_spec.rb@@ -7,7 +7,7 @@ RSpec.describe Jobs::OpenTopic dobefore { topic.update!(closed: true) }- it "should work" do+ it "opens the topic when the timer expires" dofreeze_time(61.minutes.from_now) dodescribed_class.new.execute(topic_timer_id: topic.public_topic_timer.id)@@ -35,7 +35,7 @@ RSpec.describe Jobs::OpenTopic dofab!(:topic) { Fabricate(:topic, category: category, closed: true) }- it "should restore the category's auto close timer" do+ it "restores the category's auto close timer" doFabricate(:topic_timer, status_type: TopicTimer.types[:open], topic: topic, user: admin)freeze_time(61.minutes.from_now) do@@ -77,7 +77,7 @@ RSpec.describe Jobs::OpenTopic dofab!(:topic) { Fabricate(:topic_timer, user: user).topic }- it "should destroy the topic timer" do+ it "destroys the topic timer" dotopic.update!(closed: true)freeze_time(topic.public_topic_timer.execute_at + 1.minute)@@ -88,7 +88,7 @@ RSpec.describe Jobs::OpenTopic doexpect(topic.reload.open?).to eq(false)end- it "should reconfigure topic timer if category's topics are set to autoclose" do+ it "reconfigures the timer when the category's topics close automatically" docategory = Fabricate(:category, auto_close_based_on_last_post: true, auto_close_hours: 5)topic = Fabricate(:topic, category: category)diff --git a/spec/jobs/periodical_updates_spec.rb b/spec/jobs/periodical_updates_spec.rbindex 811c8d9be9a..86200f831ed 100644--- a/spec/jobs/periodical_updates_spec.rb+++ b/spec/jobs/periodical_updates_spec.rb@@ -8,7 +8,7 @@ RSpec.describe Jobs::PeriodicalUpdates do)end- it "works" do+ it "runs all periodic updates without an error" do# does not blow up, no mocks, everything is calledJobs::PeriodicalUpdates.new.execute(nil)enddiff --git a/spec/jobs/post_update_topic_tracking_state_spec.rb b/spec/jobs/post_update_topic_tracking_state_spec.rbindex 574a82d7e37..620ed6ddaa7 100644--- a/spec/jobs/post_update_topic_tracking_state_spec.rb+++ b/spec/jobs/post_update_topic_tracking_state_spec.rb@@ -5,18 +5,18 @@ RSpec.describe Jobs::PostUpdateTopicTrackingState dofab!(:post)- it "should publish messages" do+ it "publishes messages" domessages = MessageBus.track_publish { job.execute({ post_id: post.id }) }expect(messages.size).not_to eq(0)end- it "should not publish messages for deleted topics" do+ it "does not publish messages for deleted topics" dopost.topic.trash!messages = MessageBus.track_publish { job.execute({ post_id: post.id }) }expect(messages.size).to eq(0)end- it "should not update topic groups for small_action posts in private messages" do+ it "does not update topic groups for small-action posts in private messages" douser = Fabricate(:user, refresh_auto_groups: true)recipient = Fabricate(:user)pm =diff --git a/spec/jobs/post_uploads_recovery_spec.rb b/spec/jobs/post_uploads_recovery_spec.rbindex 57c7633406e..570e1641313 100644--- a/spec/jobs/post_uploads_recovery_spec.rb+++ b/spec/jobs/post_uploads_recovery_spec.rb@@ -2,7 +2,7 @@RSpec.describe Jobs::PostUploadsRecovery dodescribe "#grace_period" do- it "should restrict the grace period to the right range" do+ it "clamps the grace period to its valid range" doSiteSetting.purge_deleted_uploads_grace_period_days = described_class::MIN_PERIOD - 1expect(described_class.new.grace_period).to eq(30)diff --git a/spec/jobs/publish_topic_to_category_spec.rb b/spec/jobs/publish_topic_to_category_spec.rbindex 1127534d736..65d2bf9317d 100644--- a/spec/jobs/publish_topic_to_category_spec.rb+++ b/spec/jobs/publish_topic_to_category_spec.rb@@ -24,7 +24,7 @@ RSpec.describe Jobs::PublishTopicToCategory doenddescribe "when topic has been deleted" do- it "should not publish the topic to the new category" do+ it "does not publish the topic to the new category" docreated_at = freeze_time 1.hour.agotopic@@ -39,7 +39,7 @@ RSpec.describe Jobs::PublishTopicToCategory doendend- it "should publish the topic to the new category" do+ it "publishes the topic to the new category" dofreeze_time 1.hour.ago dotopic.update!(visible: false)end@@ -63,7 +63,7 @@ RSpec.describe Jobs::PublishTopicToCategory doenddescribe "when topic is a private message" do- it "should publish the topic to the new category" do+ it "publishes the topic to the new category" dofreeze_time 1.hour.ago doexpect { topic.convert_to_private_message(Discourse.system_user) }.to change {topic.private_message?@@ -127,7 +127,7 @@ RSpec.describe Jobs::PublishTopicToCategory doenddescribe "when new category has a default auto-close" do- it "should apply the auto-close timer upon publishing" do+ it "applies the auto-close timer when publishing" dofreeze_timeanother_category.update!(auto_close_hours: 5)diff --git a/spec/jobs/pull_hotlinked_images_spec.rb b/spec/jobs/pull_hotlinked_images_spec.rbindex 73c2b26d6d6..e98e2863154 100644--- a/spec/jobs/pull_hotlinked_images_spec.rb+++ b/spec/jobs/pull_hotlinked_images_spec.rb@@ -540,26 +540,26 @@ RSpec.describe Jobs::PullHotlinkedImages dosubject(:job) { described_class.new }describe "when url is invalid" do- it "should return false" do+ it "rejects image URLs without a scheme or protocol-relative prefix" doexpect(job.should_download_image?("null")).to eq(false)expect(job.should_download_image?("meta.discourse.org")).to eq(false)endenddescribe "when url is valid" do- it "should return true" do+ it "accepts HTTP and protocol-relative image URLs" doexpect(job.should_download_image?("http://meta.discourse.org")).to eq(true)expect(job.should_download_image?("//meta.discourse.org")).to eq(true)endenddescribe "when url is an upload" do- it "should return false for original" do+ it "rejects an original upload URL" doexpect(job.should_download_image?(Fabricate(:upload).url)).to eq(false)endcontext "when secure uploads enabled" do- it "should return false for secure-upload url" do+ it "rejects a secure upload URL" dosetup_s3SiteSetting.secure_uploads = true@@ -570,7 +570,7 @@ RSpec.describe Jobs::PullHotlinkedImages doendend- it "should return true for optimized" do+ it "accepts an optimized image URL" dosrc = Discourse.store.get_path_for_optimized_image(Fabricate(:optimized_image))expect(job.should_download_image?(src)).to eq(true)enddiff --git a/spec/jobs/rebake_custom_emoji_posts_spec.rb b/spec/jobs/rebake_custom_emoji_posts_spec.rbindex 49951a4660e..7cd98cc1e71 100644--- a/spec/jobs/rebake_custom_emoji_posts_spec.rb+++ b/spec/jobs/rebake_custom_emoji_posts_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe Jobs::RebakeCustomEmojiPosts do- it "should rebake posts that are using a given custom emoji" do+ it "rebakes posts using the given custom emoji" doupload = Fabricate(:upload)custom_emoji = CustomEmoji.create!(name: "test", upload: upload)Emoji.clear_cachediff --git a/spec/jobs/regular/group_smtp_email_spec.rb b/spec/jobs/regular/group_smtp_email_spec.rbindex cbab0070282..8c1b9975912 100644--- a/spec/jobs/regular/group_smtp_email_spec.rb+++ b/spec/jobs/regular/group_smtp_email_spec.rb@@ -99,7 +99,7 @@ RSpec.describe Jobs::GroupSmtpEmail doexpect(email_text).not_to include(recipient_user.username)end- it "creates an EmailLog record with the correct details" do+ it "stores delivery details in the EmailLog" dojob.execute(args)email_log =EmailLog.find_by(post_id: post.id, topic_id: post.topic_id, user_id: recipient_user.id)@@ -121,7 +121,7 @@ RSpec.describe Jobs::GroupSmtpEmail doexpect(incoming_email.subject).to eq("Re: Help I need support")end- it "does not create a post reply key, it always replies to the group email_username" do+ it "uses the group email address in the generated mail headers" dojob.execute(args)expect(ActionMailer::Base.deliveries.count).to eq(1)expect(ActionMailer::Base.deliveries.last.subject).to eq("Re: Help I need support")diff --git a/spec/jobs/regular/site_setting_update_default_categories_spec.rb b/spec/jobs/regular/site_setting_update_default_categories_spec.rbindex fc43a5423b9..a40e25d5c53 100644--- a/spec/jobs/regular/site_setting_update_default_categories_spec.rb+++ b/spec/jobs/regular/site_setting_update_default_categories_spec.rb@@ -23,7 +23,7 @@ describe Jobs::SiteSettingUpdateDefaultCategories do)end- it "should update existing users user preference" do+ it "updates existing users' category preferences" dojob.execute(id: "default_categories_watching",value: category_ids.last(2).join("|"),@@ -73,7 +73,7 @@ describe Jobs::SiteSettingUpdateDefaultCategories do)end- it "should publish a MessageBus informing the correct groups" do+ it "publishes the affected groups through MessageBus" domessages =MessageBus.track_publish("/site_setting/default_categories_watching/process") dojob.execute(diff --git a/spec/jobs/regular/site_setting_update_default_tags_spec.rb b/spec/jobs/regular/site_setting_update_default_tags_spec.rbindex 18330d4ddb7..63ac9a545bb 100644--- a/spec/jobs/regular/site_setting_update_default_tags_spec.rb+++ b/spec/jobs/regular/site_setting_update_default_tags_spec.rb@@ -18,7 +18,7 @@ describe Jobs::SiteSettingUpdateDefaultTags doTagUser.create!(tag_id: tags.last.id, notification_level: tracking, user: user2)end- it "should update existing users user preference" do+ it "updates existing users' preferences" dojob.execute(id: "default_tags_watching",value: tags.last(2).pluck(:name).join("|"),@@ -31,7 +31,7 @@ describe Jobs::SiteSettingUpdateDefaultTags do)end- it "should publish a MessageBus informing the correct groups" do+ it "publishes a MessageBus message for the affected groups" domessages =MessageBus.track_publish("/site_setting/default_tags_watching/process") dojob.execute(diff --git a/spec/jobs/reindex_search_spec.rb b/spec/jobs/reindex_search_spec.rbindex 2e3ee9653ad..683304a63e4 100644--- a/spec/jobs/reindex_search_spec.rb+++ b/spec/jobs/reindex_search_spec.rb@@ -14,7 +14,7 @@ RSpec.describe Jobs::ReindexSearch do# Didn't check `topic` because topic doesn't have posts in fabrication# thus no search data%w[post category user].each do |m|- it "should rebuild `#{m}` when default_locale changed" do+ it "rebuilds `#{m}` when default_locale changes" doSiteSetting.default_locale = "en"model = Fabricate(m.to_sym)SiteSetting.default_locale = locale@@ -22,7 +22,7 @@ RSpec.describe Jobs::ReindexSearch doexpect(model.public_send("#{m}_search_data").locale).to eq localeend- it "should rebuild `#{m}` when INDEX_VERSION changed" do+ it "rebuilds `#{m}` when INDEX_VERSION changes" domodel = Fabricate(m.to_sym)# so that search data can be reindexedsearch_data = model.public_send("#{m}_search_data")@@ -59,7 +59,7 @@ RSpec.describe Jobs::ReindexSearch doafter { FakeIndexer.reset }- it "should not reindex posts that belong to a deleted topic or have been trashed" do+ it "does not reindex trashed posts or posts in deleted topics" dopost = Fabricate(:post)post2 = Fabricate(:post)post3 = Fabricate(:post)@@ -72,7 +72,7 @@ RSpec.describe Jobs::ReindexSearch doexpect(FakeIndexer.posts).to contain_exactly(post)end- it "should not reindex posts with a developmental version" do+ it "does not reindex posts with a development version" doFabricate(:post, version: SearchIndexer::POST_INDEX_VERSION + 1)job.rebuild_posts(indexer: FakeIndexer)@@ -80,7 +80,7 @@ RSpec.describe Jobs::ReindexSearch doexpect(FakeIndexer.posts).to eq([])end- it "should not reindex posts with empty raw" do+ it "does not reindex posts with empty raw content" dopost = Fabricate(:post)post.post_search_data.destroy!@@ -193,7 +193,7 @@ RSpec.describe Jobs::ReindexSearch doenddescribe "#execute" do- it "should clean up topic_search_data of trashed topics" do+ it "removes topic search data for trashed topics" dotopic = Fabricate(:post).topictopic2 = Fabricate(:post).topic@@ -207,7 +207,7 @@ RSpec.describe Jobs::ReindexSearch doexpect(TopicSearchData.pluck(:topic_id)).to contain_exactly(topic2.topic_search_data.topic_id)end- it "should clean up post_search_data of posts with empty raw or posts from trashed topics" do+ it "removes post search data for empty posts and trashed topics" dopost = Fabricate(:post)post2 = Fabricate(:post, post_type: Post.types[:small_action])post2.raw = ""diff --git a/spec/jobs/reviewable_priorities_spec.rb b/spec/jobs/reviewable_priorities_spec.rbindex 1e85659d16a..436a12ff65e 100644--- a/spec/jobs/reviewable_priorities_spec.rb+++ b/spec/jobs/reviewable_priorities_spec.rb@@ -49,7 +49,7 @@ RSpec.describe Jobs::ReviewablePriorities dolet(:high_threshold) { 13.0 }let(:score_to_hide_post) { 8.66 }- it "will set priorities based on the maximum score" do+ it "sets priorities based on the maximum score" doother_reviewable.destroy!Jobs::ReviewablePriorities.new.execute({})diff --git a/spec/jobs/send_system_message_spec.rb b/spec/jobs/send_system_message_spec.rbindex 4b2897abcc4..ff4f5ceda36 100644--- a/spec/jobs/send_system_message_spec.rb+++ b/spec/jobs/send_system_message_spec.rb@@ -16,7 +16,7 @@ RSpec.describe Jobs::SendSystemMessage docontext "with valid parameters" dofab!(:user)- it "should call SystemMessage.create" do+ it "creates the system message" doSystemMessage.any_instance.expects(:create).with("welcome_invite", {})Jobs::SendSystemMessage.new.execute(user_id: user.id, message_type: "welcome_invite")enddiff --git a/spec/jobs/suspicious_login_spec.rb b/spec/jobs/suspicious_login_spec.rbindex e102311aa18..7b3a2337550 100644--- a/spec/jobs/suspicious_login_spec.rb+++ b/spec/jobs/suspicious_login_spec.rb@@ -13,7 +13,7 @@ RSpec.describe Jobs::SuspiciousLogin doDiscourseIpInfo.stubs(:get).with("1.1.2.1").returns(london)end- it "will correctly compute distance" do+ it "computes the distance between login locations" dodef expect_distance(from, to, distance)expect(UserAuthToken.distance(from.values, to.values).to_i).to eq(distance)expect(UserAuthToken.distance(to.values, from.values).to_i).to eq(distance)@@ -24,7 +24,7 @@ RSpec.describe Jobs::SuspiciousLogin doexpect_distance(bern, london, 747)end- it "will not send an email on first login" do+ it "does not email the user on their first login" doexpect dodescribed_class.new.execute(user_id: user.id, client_ip: "1.1.1.1")end.to_not change { Jobs::CriticalUserEmail.jobs.size }@@ -32,7 +32,7 @@ RSpec.describe Jobs::SuspiciousLogin doexpect(UserAuthTokenLog.where(action: "suspicious").count).to eq(0)end- it "will not send an email when user log in from a known location" do+ it "does not email the user after a login from a known location" doUserAuthTokenLog.create!(action: "generate", user_id: user.id, client_ip: "1.1.1.1")expect do@@ -43,7 +43,7 @@ RSpec.describe Jobs::SuspiciousLogin doexpect(UserAuthTokenLog.where(action: "suspicious").count).to eq(0)end- it "will send an email when user logs in from a new location" do+ it "emails the user after a login from a new location" doUserAuthTokenLog.create!(action: "generate", user_id: user.id, client_ip: "1.1.1.1")described_class.new.execute(user_id: user.id, client_ip: "1.1.2.1")diff --git a/spec/jobs/toggle_topic_closed_spec.rb b/spec/jobs/toggle_topic_closed_spec.rbindex 5164add32df..35510ee8844 100644--- a/spec/jobs/toggle_topic_closed_spec.rb+++ b/spec/jobs/toggle_topic_closed_spec.rb@@ -5,7 +5,7 @@ RSpec.describe Jobs::ToggleTopicClosed dofab!(:topic) { Fabricate(:topic_timer, user: admin).topic }- it "should be able to close a topic" do+ it "closes a topic" dotopicfreeze_time(61.minutes.from_now) do@@ -18,7 +18,7 @@ RSpec.describe Jobs::ToggleTopicClosed doenddescribe "opening a topic" do- it "should be work" do+ it "opens a closed topic" dotopic.update!(closed: true)freeze_time(61.minutes.from_now) do@@ -37,7 +37,7 @@ RSpec.describe Jobs::ToggleTopicClosed dofab!(:topic) { Fabricate(:topic, category: category, closed: true) }- it "should restore the category's auto close timer" do+ it "restores the category's auto-close timer" doFabricate(:topic_timer, status_type: TopicTimer.types[:open], topic: topic, user: admin)freeze_time(61.minutes.from_now) do@@ -55,7 +55,7 @@ RSpec.describe Jobs::ToggleTopicClosed doenddescribe "when trying to close a topic that has already been closed" do- it "should delete the topic timer" do+ it "deletes the topic timer" dofreeze_time(topic.public_topic_timer.execute_at + 1.minute)topic.update!(closed: true)@@ -67,7 +67,7 @@ RSpec.describe Jobs::ToggleTopicClosed doenddescribe "when trying to close a topic that has been deleted" do- it "should delete the topic timer" do+ it "deletes the topic timer" dofreeze_time(topic.public_topic_timer.execute_at + 1.minute)topic.trash!@@ -83,7 +83,7 @@ RSpec.describe Jobs::ToggleTopicClosed dofab!(:topic) { Fabricate(:topic_timer, user: user).topic }- it "should destroy the topic timer" do+ it "destroys the topic timer" dofreeze_time(topic.public_topic_timer.execute_at + 1.minute)expect do@@ -93,7 +93,7 @@ RSpec.describe Jobs::ToggleTopicClosed doexpect(topic.reload.closed).to eq(false)end- it "should reconfigure topic timer if category's topics are set to autoclose" do+ it "reconfigures the topic timer when the category's topics auto-close" docategory = Fabricate(:category, auto_close_based_on_last_post: true, auto_close_hours: 5)topic = Fabricate(:topic, category: category)diff --git a/spec/lib/admin_user_index_query_spec.rb b/spec/lib/admin_user_index_query_spec.rbindex fa0c919619e..44a2cfba1c0 100644--- a/spec/lib/admin_user_index_query_spec.rb+++ b/spec/lib/admin_user_index_query_spec.rb@@ -219,7 +219,7 @@ RSpec.describe AdminUserIndexQuery dodescribe "filtering" docontext "with exact email bypass" do- it "can correctly bypass expensive ilike query" do+ it "matches an exact email filter without ILIKE" douser = Fabricate(:user, email: "[email protected]")query = AdminUserIndexQuery.new(filter: "[email protected]").find_users_query@@ -229,7 +229,7 @@ RSpec.describe AdminUserIndexQuery doexpect(query.to_sql.downcase).not_to include("ilike")end- it "can correctly bypass expensive ilike query" do+ it "matches the email parameter exactly without ILIKE" douser = Fabricate(:user, email: "[email protected]")query = AdminUserIndexQuery.new(email: "[email protected]").find_users_querydiff --git a/spec/lib/asset_processor_spec.rb b/spec/lib/asset_processor_spec.rbindex 713cdee9784..a1a1428dcf6 100644--- a/spec/lib/asset_processor_spec.rb+++ b/spec/lib/asset_processor_spec.rb@@ -649,7 +649,7 @@ RSpec.describe AssetProcessor doexpect(AssetProcessor.ember_version).to match(/\A\d+\.\d+\.\d+\z/)end- it "errors on missing relative imports" do+ it "errors on missing relative imports for a plugin without a hyphenated name" domod_1 = <<~JS.chompimport SomeModule from "../some-module";console.log(SomeModule);diff --git a/spec/lib/auth/default_current_user_provider_spec.rb b/spec/lib/auth/default_current_user_provider_spec.rbindex 366e18f734e..1f1efe2f634 100644--- a/spec/lib/auth/default_current_user_provider_spec.rb+++ b/spec/lib/auth/default_current_user_provider_spec.rb@@ -184,7 +184,7 @@ RSpec.describe Auth::DefaultCurrentUserProvider doafter { Discourse.disable_readonly_mode(Discourse::PG_READONLY_MODE_KEY) }- it "should not update ApiKey#last_used_at" do+ it "does not update ApiKey#last_used_at" doapi_key = ApiKey.create!(user_id: user.id, created_by_id: -1)params = { "HTTP_API_KEY" => api_key.key }@@ -251,7 +251,7 @@ RSpec.describe Auth::DefaultCurrentUserProvider doafter { user.clear_last_seen_cache!(@orig) }- it "should not update last seen for suspended users" do+ it "does not update last seen for suspended users" doprovider2 = provider("/", "HTTP_COOKIE" => "_t=#{cookie}")u = provider2.current_useru.reload@@ -277,7 +277,7 @@ RSpec.describe Auth::DefaultCurrentUserProvider doafter { Discourse.disable_readonly_mode(Discourse::PG_READONLY_MODE_KEY) }- it "should not update User#last_seen_at" do+ it "does not update User#last_seen_at" doprovider2 = provider("/", "HTTP_COOKIE" => "_t=#{cookie}")u = provider2.current_useru.reload@@ -286,7 +286,7 @@ RSpec.describe Auth::DefaultCurrentUserProvider doenddescribe "when impersonating another user" do- it "should not update User#last_seen_at" do+ it "does not update User#last_seen_at" doold_timestamp = 1.week.agouser.update!(last_seen_at: old_timestamp)User.any_instance.stubs(:is_impersonating).returns(true)@@ -298,7 +298,7 @@ RSpec.describe Auth::DefaultCurrentUserProvider doendend- it "should not cache an invalid user when Rails hasn't set `path_parameters` on the request yet" do+ it "does not cache an invalid user before Rails sets the request's path_parameters" doSiteSetting.login_required = trueuser = Fabricate(:user)api_key = ApiKey.create!(user_id: user.id, created_by_id: Discourse.system_user)@@ -394,12 +394,12 @@ RSpec.describe Auth::DefaultCurrentUserProvider doendend- it "should update last seen for non ajax" do+ it "updates last seen for non-AJAX requests" doexpect(provider("/topic/anything/goes", method: "POST").should_update_last_seen?).to eq(true)expect(provider("/topic/anything/goes", method: "GET").should_update_last_seen?).to eq(true)end- it "should update ajax reqs with discourse visible" do+ it "updates last seen for AJAX requests with Discourse visible" doexpect(provider("/topic/anything/goes",@@ -410,7 +410,7 @@ RSpec.describe Auth::DefaultCurrentUserProvider do).to eq(true)end- it "should not update last seen for ajax calls without Discourse-Present header" do+ it "does not update last seen for AJAX requests without the Discourse-Present header" doexpect(provider("/topic/anything/goes",@@ -420,7 +420,7 @@ RSpec.describe Auth::DefaultCurrentUserProvider do).to eq(false)end- it "should update last seen for API calls with Discourse-Present header" do+ it "updates last seen for API calls with the Discourse-Present header" doapi_key = ApiKey.create!(user_id: user.id, created_by_id: -1)params = {:method => "POST",@@ -749,7 +749,7 @@ RSpec.describe Auth::DefaultCurrentUserProvider doafter { Discourse.disable_readonly_mode(Discourse::PG_READONLY_MODE_KEY) }- it "should not update ApiKey#last_used_at" do+ it "does not update ApiKey#last_used_at" doparams = { "REQUEST_METHOD" => "GET", "HTTP_USER_API_KEY" => api_key.key }good_provider = provider("/", params)@@ -833,7 +833,7 @@ RSpec.describe Auth::DefaultCurrentUserProvider docreate_request_env(path: "/").merge({ :method => "GET", "HTTP_COOKIE" => "_t=#{cookie}" })end- it "should work when the current user was cached by a different provider instance" do+ it "logs off a user cached by another provider instance" douser_provider = TestProvider.new(env)expect(user_provider.current_user).to eq(user)expect(UserAuthToken.find_by(user_id: user.id)).to be_present@@ -843,7 +843,7 @@ RSpec.describe Auth::DefaultCurrentUserProvider doexpect(UserAuthToken.find_by(user_id: user.id)).to be_nilend- it "should trigger user_logged_out event" do+ it "triggers the user_logged_out event" doevent_triggered_user = nilevent_handler = Proc.new { |user| event_triggered_user = user.id }DiscourseEvent.on(:user_logged_out, &event_handler)diff --git a/spec/lib/auth/github_authenticator_spec.rb b/spec/lib/auth/github_authenticator_spec.rbindex 5d55c9bf2ad..0f313c8680e 100644--- a/spec/lib/auth/github_authenticator_spec.rb+++ b/spec/lib/auth/github_authenticator_spec.rb@@ -60,7 +60,7 @@ RSpec.describe Auth::GithubAuthenticator do).to eq(user.username)end- it "should use primary email for new user creation over other available emails" do+ it "uses the primary email when creating a user" dohash = {provider: "github",extra: {@@ -82,7 +82,7 @@ RSpec.describe Auth::GithubAuthenticator doexpect(result.email).to eq("[email protected]")end- it "should not error out if user already has a different old github account attached" do+ it "handles a user with a different GitHub account already attached" do# There is a rare case where an end user had# 2 different github accounts and moved emails between the 2@@ -114,7 +114,7 @@ RSpec.describe Auth::GithubAuthenticator doexpect(UserAssociatedAccount.where(user_id: user.id).pluck(:provider_uid)).to eq(["1001"])end- it "will not authenticate for already existing users with an unverified email" do+ it "does not authenticate existing users with an unverified email" dohash = {provider: "github",extra: {@@ -160,7 +160,7 @@ RSpec.describe Auth::GithubAuthenticator doexpect(result.email_valid).to eq(hash[:info][:email].present?)end- it "will skip blocklisted domains for non existing users" do+ it "skips blocklisted domains for new users" dohash = {provider: "github",extra: {@@ -187,7 +187,7 @@ RSpec.describe Auth::GithubAuthenticator doexpect(result.email_valid).to eq(true)end- it "will find allowlisted domains for non existing users" do+ it "finds allowlisted domains for new users" dohash = {provider: "github",extra: {diff --git a/spec/lib/auth/managed_authenticator_spec.rb b/spec/lib/auth/managed_authenticator_spec.rbindex 8ade73aa523..aa6592472d8 100644--- a/spec/lib/auth/managed_authenticator_spec.rb+++ b/spec/lib/auth/managed_authenticator_spec.rb@@ -206,7 +206,7 @@ RSpec.describe Auth::ManagedAuthenticator doexpect(UserAssociatedAccount.last.info["nickname"]).to eq("IAmGroot")end- it "will ignore name when equal to email" do+ it "ignores the name when it equals the email address" doresult = authenticator.after_authenticate(hash.deep_merge(info: { name: hash.info.email }))expect(result.email).to eq(hash.info.email)expect(result.name).to eq(nil)diff --git a/spec/lib/backup_restore/database_restorer_spec.rb b/spec/lib/backup_restore/database_restorer_spec.rbindex e36d01c3181..f4f36114ab8 100644--- a/spec/lib/backup_restore/database_restorer_spec.rb+++ b/spec/lib/backup_restore/database_restorer_spec.rb@@ -160,7 +160,7 @@ RSpec.describe BackupRestore::DatabaseRestorer doenddescribe "database connection" do- it "it is not erroring for non-multisite" do+ it "does not raise an error outside multisite mode" doexpect { execute_stubbed_restore }.not_to raise_errorendenddiff --git a/spec/lib/backup_restore/s3_backup_store_spec.rb b/spec/lib/backup_restore/s3_backup_store_spec.rbindex 5975ea4281d..6324d8648d1 100644--- a/spec/lib/backup_restore/s3_backup_store_spec.rb+++ b/spec/lib/backup_restore/s3_backup_store_spec.rb@@ -194,7 +194,7 @@ RSpec.describe BackupRestore::S3BackupStore doenddescribe "#create_multipart" do- it "should set the ACL context when `s3_use_acls` site setting is enabled" do+ it "sets the ACL context when s3_use_acls is enabled" doSiteSetting.s3_use_acls = trueresponse = store.create_multipart("test_file.tar.gz", "application/gzip", metadata: {})@@ -208,7 +208,7 @@ RSpec.describe BackupRestore::S3BackupStore do)end- it "should not set the ACL context when `s3_use_acls` site setting is disabled" do+ it "omits the ACL context when s3_use_acls is disabled" doSiteSetting.s3_use_acls = falsestore.create_multipart("test_file.tar.gz", "application/gzip", metadata: {})@@ -220,7 +220,7 @@ RSpec.describe BackupRestore::S3BackupStore doexpect(create_multipart_upload_request[:context].params[:acl]).to eq(nil)end- it "should set the tagging context when `s3_enable_access_control_tags` site setting is enabled" do+ it "sets the tagging context when s3_enable_access_control_tags is enabled" doSiteSetting.s3_enable_access_control_tags = truestore.create_multipart("test_file.tar.gz", "application/gzip", metadata: {})@@ -241,7 +241,7 @@ RSpec.describe BackupRestore::S3BackupStore dobefore { create_backups }after { remove_backups }- it "should set the ACL context when `s3_use_acls` site setting is enabled" do+ it "sets the ACL context when s3_use_acls is enabled" dostore.move_existing_stored_upload(existing_external_upload_key: "default/b.tar.gz",original_filename: "b.tar.gz",@@ -256,7 +256,7 @@ RSpec.describe BackupRestore::S3BackupStore do)end- it "should not set the ACL context when `s3_use_acls` site setting is disabled" do+ it "omits the ACL context when s3_use_acls is disabled" doSiteSetting.s3_use_acls = falsestore.move_existing_stored_upload(@@ -271,7 +271,7 @@ RSpec.describe BackupRestore::S3BackupStore doexpect(copy_object_request[:context].params[:acl]).to eq(nil)end- it "should set the tagging context when `s3_enable_access_control_tags` site setting is enabled" do+ it "sets the tagging context when s3_enable_access_control_tags is enabled" doSiteSetting.s3_enable_access_control_tags = truestore.move_existing_stored_upload(diff --git a/spec/lib/color_math_spec.rb b/spec/lib/color_math_spec.rbindex 82b12119848..d0dc06cdfaa 100644--- a/spec/lib/color_math_spec.rb+++ b/spec/lib/color_math_spec.rb@@ -2,14 +2,14 @@describe ColorMath dodescribe "#brightness" do- it "works" do+ it "returns the brightness of grayscale colors" doexpect(ColorMath.brightness("000")).to eq(0)expect(ColorMath.brightness("fff")).to eq(255)endenddescribe "#scale_color_lightness" do- it "works" do+ it "scales the lightness of grayscale colors" doexpect(ColorMath.scale_color_lightness("000", 0.5)).to eq("808080")expect(ColorMath.scale_color_lightness("fff", -0.5)).to eq("808080")enddiff --git a/spec/lib/composer_messages_finder_spec.rb b/spec/lib/composer_messages_finder_spec.rbindex b65e27f3739..e56d8d1530c 100644--- a/spec/lib/composer_messages_finder_spec.rb+++ b/spec/lib/composer_messages_finder_spec.rb@@ -50,7 +50,7 @@ RSpec.describe ComposerMessagesFinder doComposerMessagesFinder.new(user, composer_action: "createTopic", topic_id: topic.id)end- it "should return an empty string" do+ it "returns an empty string" doexpect(finder.check_education_message).to eq(nil)endend@@ -60,7 +60,7 @@ RSpec.describe ComposerMessagesFinder doComposerMessagesFinder.new(user, composer_action: "reply", topic_id: topic.id)end- it "should return an empty string" do+ it "returns an empty string" doexpect(finder.check_education_message).to eq(nil)endend@@ -404,7 +404,7 @@ RSpec.describe ComposerMessagesFinder doexpect(finder.check_get_a_room(min_users_posted: 2)).to be_blankend- it "will notify you if it hasn't in the current topic" do+ it "notifies the user if no notice was shown in the current topic" doUserHistory.create!(action: UserHistory.actions[:notified_about_get_a_room],target_user_id: user.id,@@ -413,7 +413,7 @@ RSpec.describe ComposerMessagesFinder doexpect(finder.check_get_a_room(min_users_posted: 2)).to be_presentend- it "won't notify you if you haven't had enough posts" do+ it "does not notify users with too few posts" doSiteSetting.get_a_room_threshold = 10expect(finder.check_get_a_room(min_users_posted: 2)).to be_blankenddiff --git a/spec/lib/concern/cached_counting_spec.rb b/spec/lib/concern/cached_counting_spec.rbindex 8dd1482b807..29d48d85a47 100644--- a/spec/lib/concern/cached_counting_spec.rb+++ b/spec/lib/concern/cached_counting_spec.rb@@ -15,7 +15,7 @@ class TestCachedCountingendRSpec.describe CachedCounting do- it "should be default disabled in test" do+ it "is disabled by default in the test environment" doexpect(CachedCounting.enabled?).to eq(false)enddiff --git a/spec/lib/concern/has_custom_fields_spec.rb b/spec/lib/concern/has_custom_fields_spec.rbindex d054b9fa113..b377f61b71e 100644--- a/spec/lib/concern/has_custom_fields_spec.rb+++ b/spec/lib/concern/has_custom_fields_spec.rb@@ -322,7 +322,7 @@ RSpec.describe HasCustomFields doexpect(item.custom_fields[field_type]).to eq(%w[a b])end- it "will not fail to load custom fields if json is corrupt" do+ it "loads custom fields when their JSON is corrupt" dofield_type = "bad_json"CustomFieldsTestItem.register_custom_field_type(field_type, :json)diff --git a/spec/lib/concern/second_factor_manager_spec.rb b/spec/lib/concern/second_factor_manager_spec.rbindex 6e4c3449a81..679d7bd7737 100644--- a/spec/lib/concern/second_factor_manager_spec.rb+++ b/spec/lib/concern/second_factor_manager_spec.rb@@ -17,7 +17,7 @@ RSpec.describe SecondFactorManager dolet(:user_backup) { user_second_factor_backup.user }describe "#totp" do- it "should return the right data" do+ it "returns the generated TOTP data" dototp = nilexpect do totp = another_user.create_totp(enabled: true) end.to change {@@ -32,7 +32,7 @@ RSpec.describe SecondFactorManager doenddescribe "#create_totp" do- it "should create the right record" do+ it "creates an enabled TOTP record" dosecond_factor = another_user.create_totp(enabled: true)expect(second_factor.method).to eq(UserSecondFactor.methods[:totp])@@ -42,20 +42,20 @@ RSpec.describe SecondFactorManager doenddescribe "#totp_provisioning_uri" do- it "should return the right uri" do+ it "returns the TOTP provisioning URI" doexpect(user.user_second_factors.totps.first.totp_provisioning_uri).to eq("otpauth://totp/#{SiteSetting.title}:#{ERB::Util.url_encode(user.email)}?secret=#{user_second_factor_totp.data}&issuer=#{SiteSetting.title}",)end- it "should handle a colon in the site title" do+ it "removes a colon from the site title" doSiteSetting.title = "Spaceballs: The Discourse"expect(user.user_second_factors.totps.first.totp_provisioning_uri).to eq("otpauth://totp/Spaceballs%20The%20Discourse:#{ERB::Util.url_encode(user.email)}?secret=#{user_second_factor_totp.data}&issuer=Spaceballs%20The%20Discourse",)end- it "should handle a two words before a colon in the title" do+ it "preserves words before a colon in the site title" doSiteSetting.title = "Our Spaceballs: The Discourse"expect(user.user_second_factors.totps.first.totp_provisioning_uri).to eq("otpauth://totp/Our%20Spaceballs%20The%20Discourse:#{ERB::Util.url_encode(user.email)}?secret=#{user_second_factor_totp.data}&issuer=Our%20Spaceballs%20The%20Discourse",@@ -64,7 +64,7 @@ RSpec.describe SecondFactorManager doenddescribe "#authenticate_totp" do- it "should be able to authenticate a token" do+ it "authenticates a token once" dofreeze_time doexpect(user.user_second_factors.totps.first.last_used).to eq(nil)@@ -77,14 +77,14 @@ RSpec.describe SecondFactorManager doenddescribe "when token is blank" do- it "should be false" do+ it "rejects the token" doexpect(user.authenticate_totp(nil)).to eq(false)expect(user.user_second_factors.totps.first.last_used).to eq(nil)endenddescribe "when token is invalid" do- it "should be false" do+ it "rejects the token" doexpect(user.authenticate_totp("111111")).to eq(false)expect(user.user_second_factors.totps.first.last_used).to eq(nil)end@@ -93,26 +93,26 @@ RSpec.describe SecondFactorManager dodescribe "#totp_enabled?" dodescribe "when user does not have a second factor record" do- it "should return false" do+ it "returns false" doexpect(another_user.totp_enabled?).to eq(false)endenddescribe "when user's second factor record is disabled" do- it "should return false" do+ it "returns false" dodisable_totpexpect(user.totp_enabled?).to eq(false)endenddescribe "when user's second factor record is enabled" do- it "should return true" do+ it "returns true" doexpect(user.totp_enabled?).to eq(true)endenddescribe "when SSO is enabled" do- it "should return false" do+ it "returns false" doSiteSetting.discourse_connect_url = "http://someurl.com"SiteSetting.discourse_connect_secret = "x" * 10SiteSetting.enable_discourse_connect = true@@ -122,7 +122,7 @@ RSpec.describe SecondFactorManager doenddescribe "when local login is disabled" do- it "should return false" do+ it "returns false" doSiteSetting.enable_local_logins = falseexpect(user.totp_enabled?).to eq(false)@@ -565,7 +565,7 @@ RSpec.describe SecondFactorManager dodescribe "backup codes" dodescribe "#generate_backup_codes" do- it "should generate and store 10 backup codes" do+ it "generates and stores 10 backup codes" dobackup_codes = user.generate_backup_codesexpect(backup_codes.length).to be 10@@ -578,7 +578,7 @@ RSpec.describe SecondFactorManager doenddescribe "#create_backup_codes" do- it "should create 10 backup code records" do+ it "creates 10 backup-code records" doraw_codes = Array.new(10) { SecureRandom.hex(8) }backup_codes = another_user.create_backup_codes(raw_codes)@@ -587,7 +587,7 @@ RSpec.describe SecondFactorManager doenddescribe "#authenticate_backup_code" do- it "should be able to authenticate a backup code" do+ it "authenticates a backup code once" dobackup_code = "iAmValidBackupCode"expect(user_backup.authenticate_backup_code(backup_code)).to eq(true)@@ -595,13 +595,13 @@ RSpec.describe SecondFactorManager doenddescribe "when code is blank" do- it "should be false" do+ it "rejects the code" doexpect(user_backup.authenticate_backup_code(nil)).to eq(false)endenddescribe "when code is invalid" do- it "should be false" do+ it "rejects the code" doexpect(user_backup.authenticate_backup_code("notValidBackupCode")).to eq(false)endend@@ -609,26 +609,26 @@ RSpec.describe SecondFactorManager dodescribe "#backup_codes_enabled?" dodescribe "when user does not have a second factor backup enabled" do- it "should return false" do+ it "returns false" doexpect(another_user.backup_codes_enabled?).to eq(false)endenddescribe "when user's second factor backup codes have been used" do- it "should return false" do+ it "returns false" douser_backup.user_second_factors.backup_codes.update_all(enabled: false)expect(user_backup.backup_codes_enabled?).to eq(false)endenddescribe "when user's second factor code is available" do- it "should return true" do+ it "returns true" doexpect(user_backup.backup_codes_enabled?).to eq(true)endenddescribe "when SSO is enabled" do- it "should return false" do+ it "returns false" doSiteSetting.discourse_connect_url = "http://someurl.com"SiteSetting.discourse_connect_secret = "x" * 10SiteSetting.enable_discourse_connect = true@@ -638,7 +638,7 @@ RSpec.describe SecondFactorManager doenddescribe "when local login is disabled" do- it "should return false" do+ it "returns false" doSiteSetting.enable_local_logins = falseexpect(user_backup.backup_codes_enabled?).to eq(false)diff --git a/spec/lib/cooked_post_processor_spec.rb b/spec/lib/cooked_post_processor_spec.rbindex 4ba03a9488b..9a1ee05efb9 100644--- a/spec/lib/cooked_post_processor_spec.rb+++ b/spec/lib/cooked_post_processor_spec.rb@@ -82,7 +82,7 @@ RSpec.describe CookedPostProcessor doOneboxer.invalidate(url)end- it "should respect SiteSetting.max_oneboxes_per_post" do+ it "respects SiteSetting.max_oneboxes_per_post" doSiteSetting.max_oneboxes_per_post = 2SiteSetting.add_rel_nofollow_to_user_content = false@@ -200,7 +200,7 @@ RSpec.describe CookedPostProcessor doafter { urls.each { |url| InlineOneboxer.invalidate(url) } }- it "should convert the right links to inline oneboxes" do+ it "converts eligible links to inline oneboxes" docpp.post_processhtml = cpp.html@@ -514,7 +514,7 @@ RSpec.describe CookedPostProcessor do)end- it "should not add lightbox" do+ it "does not add a lightbox" doFastImage.expects(:size).returns([1750, 2000])cpp.post_process@@ -534,7 +534,7 @@ RSpec.describe CookedPostProcessor do)end- it "should not add lightbox" do+ it "does not add a lightbox" doFastImage.expects(:size).returns([1750, 2000])cpp.post_process@@ -554,7 +554,7 @@ RSpec.describe CookedPostProcessor do)end- it "should not add lightbox" do+ it "does not add a lightbox" doFastImage.expects(:size).returns([1750, 2000])cpp.post_process@@ -767,7 +767,7 @@ RSpec.describe CookedPostProcessor doexpect(cpp).to be_dirtyend- it "should escape the filename" do+ it "escapes the filename" doupload.update!(original_filename: "><img src=x onerror=alert('haha')>.png")cpp.post_process@@ -1215,7 +1215,7 @@ RSpec.describe CookedPostProcessor doexpect(doc.css("img.animated").size).to eq(1)end- it "marks giphy images as animated" do+ it "marks Tenor images as animated" dopost =Fabricate(:post,@@ -2094,7 +2094,7 @@ RSpec.describe CookedPostProcessor dotestMARKDOWN- it "should not be marked as modified" do+ it "leaves the quote unmarked as modified" docpp.post_process_quotesexpect(cpp.doc.css("aside.quote.quote-modified")).to be_blankend@@ -2108,7 +2108,7 @@ RSpec.describe CookedPostProcessor dotestMARKDOWN- it "should be marked as modified" do+ it "marks the quote as modified" docpp.post_process_quotesexpect(cpp.doc.css("aside.quote.quote-modified")).to be_presentend@@ -2122,7 +2122,7 @@ RSpec.describe CookedPostProcessor doand this is a replyMARKDOWN- it "it should be marked as missing" do+ it "marks the quoted post as missing" docpp.post_process_quotesexpect(cpp.doc.css("aside.quote.quote-post-not-found")).to be_presentend@@ -2171,7 +2171,7 @@ RSpec.describe CookedPostProcessor dobefore { SiteSetting.remove_full_quote = true }- it "works" do+ it "removes the full quote while preserving intervening hidden and action posts" dohidden =Fabricate(:post,diff --git a/spec/lib/db_helper_spec.rb b/spec/lib/db_helper_spec.rbindex f99956696c0..4b9da0f0a42 100644--- a/spec/lib/db_helper_spec.rb+++ b/spec/lib/db_helper_spec.rb@@ -7,7 +7,7 @@ RSpec.describe DbHelper dolet(:long_sidebar_url_name) { "a" * (sidebar_url_name_limit + 1) }describe ".remap" do- it "should remap columns properly" do+ it "remaps the columns" dopost = Fabricate(:post, cooked: "this is a specialcode that I included")post_attributes = post.reload.attributes@@ -109,7 +109,7 @@ RSpec.describe DbHelper doenddescribe ".regexp_replace" do- it "should remap columns correctly" do+ it "remaps the columns" dopost = Fabricate(:post, raw: "this is a [img]test[/img] post")DbHelper.regexp_replace("\\[img\\]test\\[/img\\]", "[img]something[/img]")diff --git a/spec/lib/demon/sidekiq_spec.rb b/spec/lib/demon/sidekiq_spec.rbindex b7ca5c930e7..ee9172ce25a 100644--- a/spec/lib/demon/sidekiq_spec.rb+++ b/spec/lib/demon/sidekiq_spec.rb@@ -2,7 +2,7 @@RSpec.describe Demon::Sidekiq dodescribe ".heartbeat_check" do- it "should restart sidekiq daemons when daemon cannot be match to an entry in Sidekiq::ProcessSet or when heartbeat check has been missed" do+ it "restarts Sidekiq daemons missing from Sidekiq::ProcessSet or with a missed heartbeat" dorunning_sidekiq_daemon = described_class.new(1)running_sidekiq_daemon.set_pid(1)missing_sidekiq_daemon = described_class.new(2)@@ -45,7 +45,7 @@ RSpec.describe Demon::Sidekiq doenddescribe ".rss_memory_check" do- it "should restart sidekiq daemons when daemon's RSS memory exceeds the maximum allowed RSS memory" do+ it "restarts Sidekiq daemons whose RSS memory exceeds the allowed maximum" dostub_const(described_class, "SIDEKIQ_RSS_MEMORY_CHECK_INTERVAL_SECONDS", 0) do# Set to a negative value to fake that the process has exceeded the maximum allowed RSS memorystub_const(described_class, "DEFAULT_MAX_ALLOWED_SIDEKIQ_RSS_MEGABYTES", -1) dodiff --git a/spec/lib/discourse_hub_spec.rb b/spec/lib/discourse_hub_spec.rbindex ed97ed549e6..6a78f82a525 100644--- a/spec/lib/discourse_hub_spec.rb+++ b/spec/lib/discourse_hub_spec.rb@@ -2,7 +2,7 @@RSpec.describe DiscourseHub dodescribe ".discourse_version_check" do- it "should return just return the json that the hub returns" do+ it "returns the JSON received from the hub" dohub_response = { "success" => "OK", "latest_version" => "0.8.1" }stub_request(@@ -18,7 +18,7 @@ RSpec.describe DiscourseHub doenddescribe ".discover_enrollment" do- it "should trigger a POST request to hub" do+ it "sends a POST request to the hub" dostub_request(:post,(ENV["HUB_BASE_URL"] || "http://local.hub:3000/api") + "/discover/enroll",@@ -34,7 +34,7 @@ RSpec.describe DiscourseHub doenddescribe ".discover_enrollment_payload" do- it "should return the correct payload" do+ it "returns the configured payload" dopayload = DiscourseHub.discover_enrollment_payloadexpect(payload[:forum_url]).to eq(Discourse.base_url)expect(payload[:forum_title]).to eq(SiteSetting.title)@@ -44,7 +44,7 @@ RSpec.describe DiscourseHub dodescribe ".version_check_payload" dodescribe "when Discourse Hub has not fetched stats since past 7 days" do- it "should include stats" do+ it "includes site statistics" doDiscourseHub.stats_fetched_at = 8.days.agojson = JSON.parse(DiscourseHub.version_check_payload.to_json)@@ -70,7 +70,7 @@ RSpec.describe DiscourseHub doenddescribe "when Discourse Hub has fetched stats in past 7 days" do- it "should not include stats" do+ it "omits site statistics" doDiscourseHub.stats_fetched_at = 2.days.agojson = JSON.parse(DiscourseHub.version_check_payload.to_json)@@ -87,7 +87,7 @@ RSpec.describe DiscourseHub dodescribe "when send_anonymize_stats is disabled" dodescribe "when Discourse Hub has not fetched stats for the past year" do- it "should not include stats" do+ it "omits site statistics" doDiscourseHub.stats_fetched_at = 1.year.agoSiteSetting.share_anonymized_statistics = falsejson = JSON.parse(DiscourseHub.version_check_payload.to_json)@@ -112,7 +112,7 @@ RSpec.describe DiscourseHub doafter { Rails.logger.stop_broadcasting_to(fake_logger) }- it "should log correctly on error" do+ it "logs errors from the hub request" dostub_request(:get, (ENV["HUB_BASE_URL"] || "http://local.hub:3000/api") + "/test").to_return(status: 500,body: "",diff --git a/spec/lib/discourse_ip_info_spec.rb b/spec/lib/discourse_ip_info_spec.rbindex 43157313dfc..6e10a68d4e2 100644--- a/spec/lib/discourse_ip_info_spec.rb+++ b/spec/lib/discourse_ip_info_spec.rb@@ -44,7 +44,7 @@ RSpec.describe DiscourseIpInfo dodescribe ".mmdb_download" dobefore { Discourse::Utils.stubs(:execute_command) }- it "should download the MaxMind databases from MaxMind's download permalinks when `maxmind_license_key` and `maxmind_account_id` global setting has been set" do+ it "downloads MaxMind databases from permalinks when the license key and account ID are set" doglobal_setting :maxmind_license_key, "license_key"global_setting :maxmind_account_id, "account_id"@@ -68,7 +68,7 @@ RSpec.describe DiscourseIpInfo dodescribed_class.mmdb_download("GeoLite2-City")end- it "should download the MaxMind databases from MaxMind's undocumented download URL when `maxmind_license_key` global setting has been set but not `maxmind_account_id` for backwards compatibility reasons" do+ it "uses the legacy MaxMind download URL when only the license key is set" doglobal_setting :maxmind_license_key, "license_key"stub_request(@@ -79,7 +79,7 @@ RSpec.describe DiscourseIpInfo dodescribed_class.mmdb_download("GeoLite2-City")end- it "should download the MaxMind databases from the right URL when `maxmind_mirror_url` global setting has been configured" do+ it "downloads MaxMind databases from the configured mirror" doglobal_setting :maxmind_mirror_url, "https://b.www.example.com/mirror"stub_request(:get, "https://b.www.example.com/mirror/GeoLite2-City.tar.gz").to_return(@@ -90,7 +90,7 @@ RSpec.describe DiscourseIpInfo dodescribed_class.mmdb_download("GeoLite2-City")end- it "should download the MaxMind databases from the right URL when `maxmind_mirror_url` global setting has been configured and has a trailing slash" do+ it "downloads MaxMind databases from a mirror URL with a trailing slash" doglobal_setting :maxmind_mirror_url, "https://b.www.example.com/mirror/"stub_request(:get, "https://b.www.example.com/mirror/GeoLite2-City.tar.gz").to_return(@@ -101,7 +101,7 @@ RSpec.describe DiscourseIpInfo dodescribed_class.mmdb_download("GeoLite2-City")end- it "should not throw an error and instead log the exception when database file fails to download" do+ it "logs database download exceptions without raising them" dofake_logger = FakeLogger.newRails.logger.broadcast_to(fake_logger)diff --git a/spec/lib/discourse_plugin_registry_spec.rb b/spec/lib/discourse_plugin_registry_spec.rbindex 18ade3fd201..f81c10da9de 100644--- a/spec/lib/discourse_plugin_registry_spec.rb+++ b/spec/lib/discourse_plugin_registry_spec.rb@@ -41,7 +41,7 @@ RSpec.describe DiscoursePluginRegistry doenddescribe ".define_filtered_register" do- it "works" do+ it "filters registered values by their enabled plugin" dofresh_registry.define_filtered_register(:test_things)expect(fresh_registry.test_things.length).to eq(0)@@ -142,7 +142,7 @@ RSpec.describe DiscoursePluginRegistry doexpect(registry_instance.stylesheets[plugin_directory_name].include?("hello.css")).to eq(true)end- it "won't add the same file twice" do+ it "does not add the same CSS file twice" doexpect { registry_instance.register_css("hello.css", plugin_directory_name) }.not_to change(registry.stylesheets[plugin_directory_name],:size,@@ -157,7 +157,7 @@ RSpec.describe DiscoursePluginRegistry doexpect(registry_instance.javascripts.include?("hello.js")).to eq(true)end- it "won't add the same file twice" do+ it "does not add the same JavaScript file twice" doexpect { registry_instance.register_js("hello.js") }.not_to change(registry.javascripts,:size,@@ -189,7 +189,7 @@ RSpec.describe DiscoursePluginRegistry doafter { registry.reset! }- it "should register the file once" do+ it "registers the service worker file once" do2.times { registry.register_service_worker("hello.js") }expect(registry.service_workers.size).to eq(1)diff --git a/spec/lib/discourse_redis_spec.rb b/spec/lib/discourse_redis_spec.rbindex c00cb95381e..62a607a7abd 100644--- a/spec/lib/discourse_redis_spec.rb+++ b/spec/lib/discourse_redis_spec.rb@@ -16,7 +16,7 @@ RSpec.describe DiscourseRedis dodescribe "pipelined / multi" dolet(:redis) { DiscourseRedis.new }- it "should support multi commands" do+ it "supports multi commands" doval =redis.multi do |transaction|transaction.set "foo", "bar"@@ -32,7 +32,7 @@ RSpec.describe DiscourseRedis doexpect(val).to eq(%w[OK OK foo])end- it "should support pipelined commands" do+ it "supports pipelined commands" doset, incr = nilval =redis.pipelined do |pipeline|@@ -52,7 +52,7 @@ RSpec.describe DiscourseRedis doexpect(redis.get("baz")).to eq("1")end- it "should noop pipelined commands against a readonly redis" do+ it "ignores pipelined commands against read-only Redis" doredis.without_namespace.expects(:pipelined).raises(Redis::ReadOnlyError)set, incr = nil@@ -68,7 +68,7 @@ RSpec.describe DiscourseRedis doexpect(redis.get("baz")).to eq(nil)end- it "should noop multi commands against a readonly redis" do+ it "ignores multi commands against read-only Redis" doredis.without_namespace.expects(:multi).raises(Redis::ReadOnlyError)val =@@ -87,7 +87,7 @@ RSpec.describe DiscourseRedis dodescribe "when namespace is enabled" dolet(:redis) { DiscourseRedis.new }- it "should append namespace to the keys" do+ it "adds the namespace to keys" doraw_redis.set("default:key", 1)raw_redis.set("test:key2", 1)raw_redis.set("default:key3", 1)@@ -112,7 +112,7 @@ RSpec.describe DiscourseRedis doenddescribe "#sadd?" do- it "should send the right command with the right key prefix to redis" do+ it "sends the command with the namespaced key to Redis" doredis = DiscourseRedis.newredis.without_namespace.expects(:sadd?).with("default:testset", "1", anything)@@ -122,7 +122,7 @@ RSpec.describe DiscourseRedis doenddescribe "#srem?" do- it "should send the right command with the right key prefix to redis" do+ it "sends the command with the namespaced key to Redis" doredis = DiscourseRedis.newredis.without_namespace.expects(:srem?).with("default:testset", "1", anything)@@ -134,7 +134,7 @@ RSpec.describe DiscourseRedis dodescribe "when namespace is disabled" dolet(:redis) { DiscourseRedis.new(nil, namespace: false) }- it "should not append any namespace to the keys" do+ it "does not add a namespace to keys" doraw_redis.set("default:key", 1)raw_redis.set("test:key2", 1)@@ -150,7 +150,7 @@ RSpec.describe DiscourseRedis doexpect(redis.mget("key1", "key2")).to eq([nil, nil])end- it "should noop a readonly redis" do+ it "ignores commands against read-only Redis" doexpect(Discourse.recently_readonly?).to eq(false)redis.without_namespace.expects(:set).raises(Redis::ReadOnlyError)@@ -194,7 +194,7 @@ RSpec.describe DiscourseRedis doenddescribe DiscourseRedis::EvalHelper do- it "works" do+ it "evaluates the Lua script" dohelper = DiscourseRedis::EvalHelper.new <<~LUAreturn 'hello world'LUAdiff --git a/spec/lib/discourse_spec.rb b/spec/lib/discourse_spec.rbindex 202f9ec00aa..d15be6b1935 100644--- a/spec/lib/discourse_spec.rb+++ b/spec/lib/discourse_spec.rb@@ -21,7 +21,7 @@ RSpec.describe Discourse dodescribe "running_in_rack" doafter { ENV.delete("DISCOURSE_RUNNING_IN_RACK") }- it "should not be running in rack" do+ it "is not running in Rack" doexpect(Discourse.running_in_rack?).to eq(false)ENV["DISCOURSE_RUNNING_IN_RACK"] = "1"expect(Discourse.running_in_rack?).to eq(true)@@ -477,13 +477,13 @@ RSpec.describe Discourse doafter { Discourse.reset_job_exception_stats! }- it "should not fail on incorrectly shaped hash" do+ it "handles an incorrectly shaped hash" doexpect doDiscourse.handle_job_exception(FakeTestError.new, { job: "test" })end.to raise_error(FakeTestError)end- it "should collect job exception stats" do+ it "collects job exception statistics" do# see MiniScheduler Manager which reports it like this# https://github.com/discourse/mini_scheduler/blob/2b2c1c56b6e76f51108c2a305775469e24cf2b65/lib/mini_scheduler/manager.rb#L95exception_context = {@@ -517,7 +517,7 @@ RSpec.describe Discourse doendend- it "should not fail when called" do+ it "runs without an error" doexception = StandardError.newexpect do Discourse.handle_job_exception(exception, nil, nil) end.to raise_error(diff --git a/spec/lib/discourse_tagging_spec.rb b/spec/lib/discourse_tagging_spec.rbindex add10620f26..e8577b79332 100644--- a/spec/lib/discourse_tagging_spec.rb+++ b/spec/lib/discourse_tagging_spec.rb@@ -597,17 +597,17 @@ RSpec.describe DiscourseTagging doFabricate(:tag_group, permissions: { "staff" => 1 }, tag_names: [hidden_tag.name])end- it "should return staff tags to admin" do+ it "returns staff tags to admins" dotags = DiscourseTagging.filter_allowed_tags(Guardian.new(admin)).to_aexpect(sorted_tag_names(tags)).to eq(sorted_tag_names([tag1, tag2, tag3, hidden_tag]))end- it "should return staff tags to moderator" do+ it "returns staff tags to moderators" dotags = DiscourseTagging.filter_allowed_tags(Guardian.new(moderator), for_input: true).to_aexpect(sorted_tag_names(tags)).to eq(sorted_tag_names([tag1, tag2, tag3, hidden_tag]))end- it "should not return hidden tag to non-staff" do+ it "hides staff tags from non-staff users" dotags = DiscourseTagging.filter_allowed_tags(Guardian.new(user)).to_aexpect(sorted_tag_names(tags)).to eq(sorted_tag_names([tag1, tag2, tag3]))end@@ -619,17 +619,17 @@ RSpec.describe DiscourseTagging doFabricate(:tag_group, permissions: { "admins" => 1 }, tag_names: [admin_only_tag.name])end- it "should return admin-only tags to admin" do+ it "returns admin-only tags to admins" dotags = DiscourseTagging.filter_allowed_tags(Guardian.new(admin), for_input: true).to_aexpect(sorted_tag_names(tags)).to eq(sorted_tag_names([tag1, tag2, tag3, admin_only_tag]))end- it "should not return admin-only tags to moderator" do+ it "hides admin-only tags from moderators" dotags = DiscourseTagging.filter_allowed_tags(Guardian.new(moderator), for_input: true).to_aexpect(sorted_tag_names(tags)).to eq(sorted_tag_names([tag1, tag2, tag3]))end- it "should not return admin-only tags to regular user" do+ it "hides admin-only tags from regular users" dotags = DiscourseTagging.filter_allowed_tags(Guardian.new(user), for_input: true).to_aexpect(sorted_tag_names(tags)).to eq(sorted_tag_names([tag1, tag2, tag3]))end@@ -644,12 +644,12 @@ RSpec.describe DiscourseTagging dobefore { group.add(user) }- it "should return all tags to member of group" do+ it "returns all tags to group members" dotags = DiscourseTagging.filter_allowed_tags(Guardian.new(user)).to_aexpect(sorted_tag_names(tags)).to eq(sorted_tag_names([tag1, tag2, tag3, hidden_tag]))end- it "should allow a tag group to have multiple group permissions" do+ it "allows a tag group to have multiple group permissions" dogroup2 = Fabricate(:group, name: "another-group")user2 = Fabricate(:user)user3 = Fabricate(:user)@@ -666,12 +666,12 @@ RSpec.describe DiscourseTagging doexpect(sorted_tag_names(tags)).to eq(sorted_tag_names([tag1, tag2, tag3]))end- it "should not hide group tags to member of group" do+ it "shows group tags to group members" dotags = DiscourseTagging.hidden_tag_names(Guardian.new(user)).to_aexpect(sorted_tag_names(tags)).to eq([])end- it "should hide group tags to non-member of group" do+ it "hides group tags from non-members" doother_user = Fabricate(:user)tags = DiscourseTagging.hidden_tag_names(Guardian.new(other_user)).to_aexpect(sorted_tag_names(tags)).to eq([hidden_tag.name])@@ -1298,7 +1298,7 @@ RSpec.describe DiscourseTagging doexpect(topic.errors[:base]).to be_emptyend- it "will return error if user is not in correct group" do+ it "returns an error if the user is not in the required group" douser2 = Fabricate(:user)valid = DiscourseTagging.tag_topic_by_names(topic, Guardian.new(user2), ["alpha"])expect(valid).to eq(false)@@ -2106,7 +2106,7 @@ RSpec.describe DiscourseTagging do# this test is to make sure that the parent tag is the only one returned when the child tag is also in a tag group# allowed in the category- it "Will only return the parent tag" do+ it "returns only the parent tag" dotags =DiscourseTagging.filter_allowed_tags(Guardian.new(user),diff --git a/spec/lib/distributed_mutex_spec.rb b/spec/lib/distributed_mutex_spec.rbindex b1ba62cf505..1946acac8be 100644--- a/spec/lib/distributed_mutex_spec.rb+++ b/spec/lib/distributed_mutex_spec.rb@@ -80,7 +80,7 @@ RSpec.describe DistributedMutex doenddescribe "executions" do- it "should not allow critical sections to overlap" do+ it "prevents critical sections from overlapping" doconnections = 3.times.map { DiscourseRedis.new }scenario =diff --git a/spec/lib/email/receiver_spec.rb b/spec/lib/email/receiver_spec.rbindex 9af50d188ee..bd257f48415 100644--- a/spec/lib/email/receiver_spec.rb+++ b/spec/lib/email/receiver_spec.rb@@ -786,7 +786,7 @@ RSpec.describe Email::Receiver do)end- it "works" do+ it "publishes the topic_created event with incoming addresses" dohandler_calls = 0handler =proc do |topic|@@ -1093,7 +1093,7 @@ RSpec.describe Email::Receiver doSiteSetting.alternative_reply_by_email_addresses = ""end- it "it matches nothing if there is not reply_by_email_address" do+ it "matches nothing when reply_by_email_address is blank" doexpect(Email::Receiver.reply_by_email_address_regex).to eq(/$a/)end@@ -1422,12 +1422,12 @@ RSpec.describe Email::Receiver dobefore { SiteSetting.block_auto_generated_emails = true }- it "should allow creating topic even when email is autogenerated" do+ it "allows creating a topic from an autogenerated email" doexpect { process(:mailinglist) }.to change { Topic.count }expect(IncomingEmail.last.is_auto_generated).to eq(false)end- it "should allow replying without reply key" do+ it "allows replying without a reply key" doprocess(:mailinglist)topic = Topic.last@@ -1467,12 +1467,12 @@ RSpec.describe Email::Receiver do)end- it "should skip validations for staged users" do+ it "skips validations for staged users" doFabricate(:user, email: "[email protected]", staged: true)expect { process(:mailinglist_short_message) }.to change { Topic.count }end- it "should skip validations for regular users" do+ it "skips validations for regular users" doFabricate(:user, email: "[email protected]", refresh_auto_groups: true)expect { process(:mailinglist_short_message) }.to change { Topic.count }end@@ -1486,11 +1486,11 @@ RSpec.describe Email::Receiver doFabricate(:user, email: "[email protected]", refresh_auto_groups: true)end- it "should allow creating topic within read-only category" do+ it "allows creating a topic in the read-only category" doexpect { process(:mailinglist) }.to change { Topic.count }end- it "should allow replying within read-only category" do+ it "allows replying in the read-only category" doprocess(:mailinglist)topic = Topic.last@@ -2006,7 +2006,7 @@ RSpec.describe Email::Receiver do)end- it "works" do+ it "creates the reply" doexpect { process(:reply_user_matching) }.to change { topic.posts.count }end@@ -2210,7 +2210,7 @@ RSpec.describe Email::Receiver do)end- it "removes the translated 'Previous Replies' marker" do+ it "removes the translated 'Previous Replies' marker from previous-replies email" doexpect { process(:previous_replies_de) }.to change { topic.posts.count }expect(topic.posts.last.raw).to eq("This will not include the previous discussion that is present in this email.",@@ -2224,7 +2224,7 @@ RSpec.describe Email::Receiver do)end- it "removes the translated 'Previous Replies' marker" do+ it "removes the translated 'Previous Replies' marker from reply-above email" doexpect { process(:reply_above_de) }.to change { topic.posts.count }expect(topic.posts.last.raw).to eq("This will not include the previous discussion that is present in this email.",diff --git a/spec/lib/email/sender_spec.rb b/spec/lib/email/sender_spec.rbindex bcde8ff146b..ca349c240e5 100644--- a/spec/lib/email/sender_spec.rb+++ b/spec/lib/email/sender_spec.rb@@ -146,7 +146,7 @@ RSpec.describe Email::Sender docontext "when no plus addressing" dobefore { SiteSetting.reply_by_email_address = "%{reply_key}@test.com" }- it "should not set the return_path" do+ it "leaves return_path unset" doemail_sender.sendexpect(message.header[:return_path].to_s).to eq("")end@@ -155,7 +155,7 @@ RSpec.describe Email::Sender docontext "with plus addressing" dobefore { SiteSetting.reply_by_email_address = "replies+%{reply_key}@test.com" }- it "should set the return_path" do+ it "sets return_path" doemail_sender.sendexpect(message.header[:return_path].to_s).to eq("replies+verp-#{EmailLog.last.bounce_key}@test.com",@@ -173,7 +173,7 @@ RSpec.describe Email::Sender domessage.header["X-Discourse-Topic-Id"] = topic.idend- it "should add the right header" do+ it "adds the List-ID header" doemail_sender.sendexpect(message.header["List-ID"]).to be_present@@ -182,7 +182,7 @@ RSpec.describe Email::Sender doendcontext "when topic id is not present" do- it "should add the right header" do+ it "adds the Message-ID header" doemail_sender.sendexpect(message.header["Message-ID"]).to be_present@@ -238,14 +238,14 @@ RSpec.describe Email::Sender domessage.header["X-Discourse-Topic-Id"] = topic.idend- it "should add the right header" do+ it "adds the Precedence header" doemail_sender.sendexpect(message.header["Precedence"]).to be_presentendenddescribe "removes custom Discourse headers from digest/registration/other mails" do- it "should remove the right headers" do+ it "removes custom Discourse headers" doemail_sender.sendexpect(message.header["X-Discourse-Topic-Id"]).not_to be_presentexpect(message.header["X-Discourse-Topic-Ids"]).not_to be_present@@ -398,7 +398,7 @@ RSpec.describe Email::Sender domessage.header["X-MC-Metadata"] = { foo: "bar" }.to_jsonend- it "should set the right header" do+ it "adds the message ID to the Mandrill metadata" doemail_sender.sendexpect(message.header["X-MC-Metadata"].to_s).to match(message.message_id)end@@ -410,7 +410,7 @@ RSpec.describe Email::Sender domessage.header["X-MSYS-API"] = { foo: "bar" }.to_jsonend- it "should set the right header" do+ it "adds the message ID to the SparkPost metadata" doemail_sender.sendexpect(message.header["X-MSYS-API"].to_s).to match(message.message_id)end@@ -419,7 +419,7 @@ RSpec.describe Email::Sender docontext "with email logs" dolet(:email_log) { EmailLog.last }- it "should create the right log" do+ it "creates an email log without a reply key" doexpect do email_sender.send end.to_not change { PostReplyKey.count }expect(email_log).to be_present@@ -489,7 +489,7 @@ RSpec.describe Email::Sender dolet(:email_log) { EmailLog.last }- it "should create the right log" do+ it "records the post and topic in the email log" doemail_sender.sendexpect(email_log.post_id).to eq(post.id)expect(email_log.topic_id).to eq(topic.id)@@ -498,7 +498,7 @@ RSpec.describe Email::Sender doendcontext "with email parts" do- it "should contain the right message" do+ it "builds matching plain-text and HTML email parts" doemail_sender.sendexpect(message).to be_multipart@@ -880,7 +880,7 @@ RSpec.describe Email::Sender doendcontext "with a deleted post" do- it "should skip sending the email" do+ it "skips the email and records the deleted-post reason" dopost = Fabricate(:post, deleted_at: 1.day.ago)message = Mail::Message.new to: "[email protected]", body: "some content"@@ -897,7 +897,7 @@ RSpec.describe Email::Sender doendcontext "with a deleted topic" do- it "should skip sending the email" do+ it "skips the email and records the deleted-topic reason" dopost = Fabricate(:post, topic: Fabricate(:topic, deleted_at: 1.day.ago))message = Mail::Message.new to: "[email protected]", body: "some content"@@ -928,11 +928,11 @@ RSpec.describe Email::Sender do@email_log = EmailLog.lastend- it "should have the current user_id" do+ it "records the current user ID" doexpect(@email_log.user_id).to eq(user.id)end- it "should have the smtp_transaction_response message" do+ it "records the SMTP transaction response" doexpect(@email_log.smtp_transaction_response).to eq(mock_smtp_transaction_response)end@@ -945,7 +945,7 @@ RSpec.describe Email::Sender doenddescribe "when allow reply by email header is not present" do- it "should not create a post reply key" do+ it "does not create a post reply key" doexpect { email_sender.send }.to_not change { PostReplyKey.count }endend@@ -955,7 +955,7 @@ RSpec.describe Email::Sender dobefore { message.header[header] = "test-%{reply_key}@test.com" }- it "should create a post reply key" do+ it "creates a post reply key" doexpect { email_sender.send }.to change { PostReplyKey.count }.by(1)post_reply_key = PostReplyKey.last@@ -969,7 +969,7 @@ RSpec.describe Email::Sender doexpect { email_sender.send }.not_to change { PostReplyKey.count }end- it "should find existing key" do+ it "reuses the existing post reply key" doexisting_post_reply_key = PostReplyKey.create(post_id: post.id, user_id: user.id)expect { email_sender.send }.not_to change { PostReplyKey.count }post_reply_key = PostReplyKey.lastdiff --git a/spec/lib/email/styles_spec.rb b/spec/lib/email/styles_spec.rbindex c60839cbc0f..3e99b2b0fae 100644--- a/spec/lib/email/styles_spec.rb+++ b/spec/lib/email/styles_spec.rb@@ -79,14 +79,14 @@ RSpec.describe Email::Styles doexpect(frag.at("a")["href"]).to eq(iframe_url)end- it "won't allow non URLs in iframe src, strips them with no link" do+ it "strips non-URL iframe sources without adding a link" doiframe_url = "alert('xss hole')"frag = html_fragment("<iframe src=\"#{iframe_url}\"></iframe>")expect(frag.at("iframe")).to be_blankexpect(frag.at("a")).to be_blankend- it "won't allow empty iframe src, strips them with no link" do+ it "strips empty iframe sources without adding a link" dofrag = html_fragment("<iframe src=''></iframe>")expect(frag.at("iframe")).to be_blankexpect(frag.at("a")).to be_blankdiff --git a/spec/lib/email_cook_spec.rb b/spec/lib/email_cook_spec.rbindex 3d1f025d87a..3eec9f806e4 100644--- a/spec/lib/email_cook_spec.rb+++ b/spec/lib/email_cook_spec.rb@@ -135,7 +135,7 @@ RSpec.describe EmailCook do)end- it "it works and does not interpret Markdown in plaintext and elided" do+ it "leaves Markdown uninterpreted in plain-text and elided sections" dolong = <<~EMAIL[plaintext]*Lorem ipsum* dolor sit amet, consectetur adipiscing elit.diff --git a/spec/lib/email_updater_spec.rb b/spec/lib/email_updater_spec.rbindex 2f1cc0218cf..f806891df47 100644--- a/spec/lib/email_updater_spec.rb+++ b/spec/lib/email_updater_spec.rb@@ -270,7 +270,7 @@ RSpec.describe EmailUpdater doendcontext "when it was deleted before" do- it "works" do+ it "restores the deleted email after confirmation" doexpect_enqueued_with(job: :critical_user_email,args: {diff --git a/spec/lib/excerpt_parser_spec.rb b/spec/lib/excerpt_parser_spec.rbindex ff4d62fba58..ea7833ad08d 100644--- a/spec/lib/excerpt_parser_spec.rb+++ b/spec/lib/excerpt_parser_spec.rb@@ -139,7 +139,7 @@ RSpec.describe ExcerptParser doenddescribe "keep_quotes parameter" do- it "should keep the quoted content in html" do+ it "keeps quoted content in the HTML" dohtml = <<~HTML.strip<aside class="quote"><blockquote>diff --git a/spec/lib/file_helper_spec.rb b/spec/lib/file_helper_spec.rbindex b35d6e0816a..52cd446535c 100644--- a/spec/lib/file_helper_spec.rb+++ b/spec/lib/file_helper_spec.rb@@ -107,7 +107,7 @@ RSpec.describe FileHelper doenddescribe "when max_file_size is exceeded" do- it "should return nil" do+ it "returns nil" dotmpfile =FileHelper.download("//eviltrout.com/trout.png",@@ -137,7 +137,7 @@ RSpec.describe FileHelper dodescribe "when url is a jpeg" dolet(:url) { "https://eviltrout.com/trout.jpg" }- it "should prioritize the content type returned by the response" do+ it "prefers the response content type" dostub_request(:get, url).to_return(body: png, headers: { "content-type": "image/png" })tmpfile = FileHelper.download(url, max_file_size: 10_000, tmp_file_name: "trouttmp")diff --git a/spec/lib/file_store/base_store_spec.rb b/spec/lib/file_store/base_store_spec.rbindex 3390b2c8c8a..f9f8df2a3b6 100644--- a/spec/lib/file_store/base_store_spec.rb+++ b/spec/lib/file_store/base_store_spec.rb@@ -14,19 +14,19 @@ RSpec.describe FileStore::BaseStore docontext "with empty URL" dobefore { upload.update!(url: "") }- it "should return the right path" do+ it "builds the original upload path from its SHA1" doexpect_correct_path("original/2X/4/4170ac2a2782a1516fe9e13d7322ae482c1bd594.png")enddescribe "when Upload#extension has not been set" do- it "should return the right path" do+ it "infers the extension when building the upload path" doupload.update!(extension: nil)expect_correct_path("original/2X/4/4170ac2a2782a1516fe9e13d7322ae482c1bd594.png")endenddescribe "when id is negative" do- it "should return the right depth" do+ it "uses a single directory level" doupload.update!(id: -999)expect_correct_path("original/1X/4170ac2a2782a1516fe9e13d7322ae482c1bd594.png")end@@ -110,14 +110,14 @@ RSpec.describe FileStore::BaseStore dolet!(:optimized_path) { "optimized/1X/#{upload.sha1}_1_100x200.png" }context "with empty URL" do- it "should return the right path" do+ it "builds the optimized image path" dooptimized = Fabricate.build(:optimized_image, upload: upload, version: 1)expect(FileStore::BaseStore.new.get_path_for_optimized_image(optimized)).to eq(optimized_path,)end- it "should return the right path for `nil` version" do+ it "defaults a nil version to version 1 in the image path" dooptimized = Fabricate.build(:optimized_image, upload: upload, version: nil)expect(FileStore::BaseStore.new.get_path_for_optimized_image(optimized)).to eq(optimized_path,@@ -185,7 +185,7 @@ RSpec.describe FileStore::BaseStore dolet(:upload_s3) { Fabricate(:upload_s3) }let(:store) { FileStore::BaseStore.new }- it "should return consistent encodings for fresh and cached downloads" do+ it "returns consistent encodings for fresh and cached downloads" dofirst_encoding = File.read(store.download(upload_s3)).encodingsecond_encoding = File.read(store.download(upload_s3)).encoding@@ -193,14 +193,14 @@ RSpec.describe FileStore::BaseStore doexpect(second_encoding).to eq(Encoding::UTF_8)end- it "should return a file path" do+ it "returns a file path" dopath = store.download(upload_s3)expect(path).to be_a(String)expect(File.exist?(path)).to eq(true)end- it "should return the path when s3 cdn enabled" do+ it "returns the path when the S3 CDN is enabled" doSiteSetting.s3_cdn_url = "https://cdn.s3.#{SiteSetting.s3_region}.amazonaws.com"stub_request(:get, Discourse.store.cdn_url(upload_s3.url)).to_return(status: 200,@@ -213,7 +213,7 @@ RSpec.describe FileStore::BaseStore doexpect(File.exist?(path)).to eq(true)end- it "should return the path when secure uploads are enabled" do+ it "returns the path when secure uploads are enabled" doSiteSetting.login_required = trueSiteSetting.secure_uploads = truediff --git a/spec/lib/file_store/s3_store_spec.rb b/spec/lib/file_store/s3_store_spec.rbindex cfd01ad93f4..1c44cafc49e 100644--- a/spec/lib/file_store/s3_store_spec.rb+++ b/spec/lib/file_store/s3_store_spec.rb@@ -1069,7 +1069,7 @@ RSpec.describe FileStore::S3Store dodescribe "#create_multipart" dobefore { store.s3_helper.stub_client_responses! }- it "should create a multipart upload with the ACL parameter set to private canned ACL when `s3_use_acls` site setting is enabled" do+ it "creates a multipart upload with a private canned ACL when `s3_use_acls` is enabled" dostore.create_multipart("test_file.tar.gz", "application/gzip", metadata: {})create_multipart_request =@@ -1082,7 +1082,7 @@ RSpec.describe FileStore::S3Store do)end- it "should create a multipart upload with the ACL parameter set to nil when `s3_use_acls` site setting is disabled" do+ it "creates a multipart upload without an ACL when `s3_use_acls` is disabled" doSiteSetting.s3_use_acls = falsestore.create_multipart("test_file.tar.gz", "application/gzip", metadata: {})@@ -1094,7 +1094,7 @@ RSpec.describe FileStore::S3Store doexpect(create_multipart_request[:context].params[:acl]).to eq(nil)end- it "should create a multipart upload with the tagging parameter set to visibility tags when `s3_enable_access_control_tags` site setting is enabled" do+ it "creates a multipart upload with visibility tags when access-control tags are enabled" doSiteSetting.s3_enable_access_control_tags = truestore.create_multipart("test_file.tar.gz", "application/gzip", metadata: {})diff --git a/spec/lib/filter_best_posts_spec.rb b/spec/lib/filter_best_posts_spec.rbindex 4469d2ab6fc..ba18e6668ee 100644--- a/spec/lib/filter_best_posts_spec.rb+++ b/spec/lib/filter_best_posts_spec.rb@@ -29,13 +29,13 @@ RSpec.describe FilterBestPosts dodescribe "processing options" dobefore { @filtered_posts = TopicView.new(topic.id, nil, best: 99).filtered_posts }- it "should not get the status post" do+ it "excludes the status post" dobest = FilterBestPosts.new(topic, @filtered_posts, 99)expect(best.filtered_posts.size).to eq(3)expect(best.posts.map(&:id)).to match_array([p2.id, p3.id])end- it "should get no results for trust level too low" do+ it "returns no results below the minimum trust level" dobest =FilterBestPosts.new(topic,@@ -46,17 +46,17 @@ RSpec.describe FilterBestPosts doexpect(best.posts.count).to eq(0)end- it "should filter out the posts with a score that is too low" do+ it "excludes posts below the minimum score" dobest = FilterBestPosts.new(topic, @filtered_posts, 99, min_score: 99)expect(best.posts.count).to eq(0)end- it "should filter out everything if min replies not met" do+ it "returns no posts below the minimum reply count" dobest = FilterBestPosts.new(topic, @filtered_posts, 99, min_replies: 99)expect(best.posts.count).to eq(0)end- it "should punch through posts if the score is high enough" do+ it "includes posts whose score exceeds the threshold" dop2.update_column(:score, 100)best =@@ -70,7 +70,7 @@ RSpec.describe FilterBestPosts doexpect(best.posts.count).to eq(1)end- it "should bypass trust level score" do+ it "bypasses the trust-level score" dobest =FilterBestPosts.new(topic,@@ -82,7 +82,7 @@ RSpec.describe FilterBestPosts doexpect(best.posts.count).to eq(0)end- it "should return none if restricted to posts a moderator liked" do+ it "returns none when no posts were liked by a moderator" dobest = FilterBestPosts.new(topic, @filtered_posts, 99, only_moderator_liked: true)expect(best.posts.count).to eq(0)end@@ -93,7 +93,7 @@ RSpec.describe FilterBestPosts doexpect(best.posts.count).to eq(0)end- it "should find the post liked by the moderator" do+ it "returns a post liked by a moderator" doPostActionCreator.like(moderator, p2)best = FilterBestPosts.new(topic, @filtered_posts, 99, only_moderator_liked: true)expect(best.posts.count).to eq(1)diff --git a/spec/lib/final_destination_spec.rb b/spec/lib/final_destination_spec.rbindex 104aca4229e..41c259972d2 100644--- a/spec/lib/final_destination_spec.rb+++ b/spec/lib/final_destination_spec.rb@@ -356,7 +356,7 @@ RSpec.describe FinalDestination doendcontext "when forcing GET" do- it "will do a GET when forced" do+ it "uses GET when forced" dourl = "https://force.get.com/posts?page=4"get_stub = fd_stub_request(:get, url)head_stub = fd_stub_request(:head, url)@@ -368,7 +368,7 @@ RSpec.describe FinalDestination doexpect(head_stub).to_not have_been_requestedend- it "will do a HEAD if not forced" do+ it "uses HEAD when GET is not forced" dourl = "https://eviltrout.com/posts?page=2"get_stub = fd_stub_request(:get, url)head_stub = fd_stub_request(:head, url)@@ -380,7 +380,7 @@ RSpec.describe FinalDestination doexpect(head_stub).to have_been_requestedend- it "will do a GET when forced on a wildcard subdomain" do+ it "uses GET for a matching wildcard subdomain" dourl = "https://any-subdomain.ihaveawildcard.com/some/other/content"get_stub = fd_stub_request(:get, url)head_stub = fd_stub_request(:head, url)@@ -392,7 +392,7 @@ RSpec.describe FinalDestination doexpect(head_stub).to_not have_been_requestedend- it "will do a HEAD if on a subdomain of a forced get domain without a wildcard" do+ it "uses HEAD for subdomains when the forced GET domain has no wildcard" dourl = "https://particularly.eviltrout.com/has/a/secret/plan"get_stub = fd_stub_request(:get, url)head_stub = fd_stub_request(:head, url)@@ -420,7 +420,7 @@ RSpec.describe FinalDestination docontext "when the status code is 405" dobefore { fd_stub_request(:head, "https://eviltrout.com").to_return(status: 405) }- it "will try a GET" do+ it "tries a GET" dofinal = FinalDestination.new("https://eviltrout.com", opts)expect(final.resolve.to_s).to eq("https://discourse.org")expect(final.status).to eq(:resolved)@@ -431,7 +431,7 @@ RSpec.describe FinalDestination docontext "when the status code is 501" dobefore { fd_stub_request(:head, "https://eviltrout.com").to_return(status: 501) }- it "will try a GET" do+ it "tries a GET" dofinal = FinalDestination.new("https://eviltrout.com", opts)expect(final.resolve.to_s).to eq("https://discourse.org")expect(final.status).to eq(:resolved)@@ -468,7 +468,7 @@ RSpec.describe FinalDestination doendend- it "should use the correct format for cookies when there is only one cookie" do+ it "formats a single cookie correctly" dofd_stub_request(:head, "https://eviltrout.com").to_return(status: 302,headers: {@@ -490,7 +490,7 @@ RSpec.describe FinalDestination doexpect(final.cookie).to eq("foo=219ffwef9w0f")end- it "should use the correct format for cookies when there are multiple cookies" do+ it "formats multiple cookies correctly" dofd_stub_request(:head, "https://eviltrout.com").to_return(status: 302,headers: {@@ -728,7 +728,7 @@ RSpec.describe FinalDestination doenddescribe "https cache" do- it "will cache https lookups" do+ it "caches HTTPS lookups" doFinalDestination.clear_https_cache!("wikipedia.com")fd_stub_request(:head, "http://wikipedia.com/image.png").to_return(diff --git a/spec/lib/flag_settings_spec.rb b/spec/lib/flag_settings_spec.rbindex deba079daed..4ef973c0e89 100644--- a/spec/lib/flag_settings_spec.rb+++ b/spec/lib/flag_settings_spec.rb@@ -6,7 +6,7 @@ RSpec.describe FlagSettings dolet(:settings) { FlagSettings.new }describe "add" do- it "will add a type" do+ it "adds a type" dosettings.add(3, :off_topic)expect(settings.flag_types).to include(:off_topic)expect(settings.is_flag?(:off_topic)).to eq(true)@@ -17,26 +17,26 @@ RSpec.describe FlagSettings doexpect(settings.auto_action_types).to be_emptyend- it "will add a topic type" do+ it "adds a topic type" dosettings.add(4, :inappropriate, topic_type: true)expect(settings.flag_types).to include(:inappropriate)expect(settings.topic_flag_types).to include(:inappropriate)expect(settings.without_additional_message_types).to include(:inappropriate)end- it "will add a notify type" do+ it "adds a notify type" dosettings.add(3, :off_topic, notify_type: true)expect(settings.flag_types).to include(:off_topic)expect(settings.notify_types).to include(:off_topic)end- it "will add an auto action type" do+ it "adds an auto action type" dosettings.add(7, :notify_moderators, auto_action_type: true)expect(settings.flag_types).to include(:notify_moderators)expect(settings.auto_action_types).to include(:notify_moderators)end- it "will add a type which requires message" do+ it "adds a type requiring a message" dosettings.add(7, :notify_user, require_message: true)expect(settings.flag_types).to include(:notify_user)expect(settings.additional_message_types).to include(:notify_user)diff --git a/spec/lib/freedom_patches/fast_image_spec.rb b/spec/lib/freedom_patches/fast_image_spec.rbindex 89934252daa..919a8ba67ea 100644--- a/spec/lib/freedom_patches/fast_image_spec.rb+++ b/spec/lib/freedom_patches/fast_image_spec.rb@@ -11,13 +11,13 @@ RSpec.describe FastImage doFinalDestination::SSRFDetector.disallow_ip_lookups_in_test!end- it "should filter endpoint hostname through our SSRF detector and return null object" do+ it "filters the endpoint hostname through the SSRF detector and returns a null object" dostub_ip_lookup("example.com", %W[0.0.0.0])expect(described_class.type("http://example.com")).to eq(nil)end- it "should send the right request if endpoint hostname resolves to a public ip address" do+ it "sends the request when the endpoint resolves to a public IP address" dostub_ip_lookup("example.com", %W[52.125.123.12])success = Class.new(StandardError)diff --git a/spec/lib/freedom_patches/translate_accelerator_spec.rb b/spec/lib/freedom_patches/translate_accelerator_spec.rbindex 6ab8d4d5b4e..2d44f4ae4a2 100644--- a/spec/lib/freedom_patches/translate_accelerator_spec.rb+++ b/spec/lib/freedom_patches/translate_accelerator_spec.rb@@ -68,7 +68,7 @@ RSpec.describe "translate accelerator" doenddescribe ".overrides_by_locale" do- it "should cache overrides for each locale" do+ it "caches overrides for each locale" dooverride_translation("en", "got", "summer")override_translation("zh_TW", "got", "冬季")@@ -269,7 +269,7 @@ RSpec.describe "translate accelerator" docontext "with existing translations in current locale and fallback locale" docontext "with overrides in both locales" do- it "should return the override from the current locale" do+ it "returns the override from the current locale" dooverride_translation("de", "foo", "Override of foo in :de")override_translation("en", "foo", "Override of foo in :en")translation_should_equal("foo", "Override of foo in :de")@@ -277,21 +277,21 @@ RSpec.describe "translate accelerator" doendcontext "with override only in current locale" do- it "should return the override from the current locale" do+ it "returns the override from the current locale" dooverride_translation("de", "foo", "Override of foo in :de")translation_should_equal("foo", "Override of foo in :de")endendcontext "with override only in fallback locale" do- it "should return the translation from the current locale" do+ it "returns the translation from the current locale" dooverride_translation("en", "foo", "Override of foo in :en")translation_should_equal("foo", "Foo in :de")endendcontext "with no overrides" do- it "should return the translation from the current locale" do+ it "returns the translation from the current locale" dotranslation_should_equal("foo", "Foo in :de")endend@@ -299,7 +299,7 @@ RSpec.describe "translate accelerator" docontext "with existing translation in fallback locale" docontext "with overrides in both locales" do- it "should return the override from the current locale" do+ it "returns the override from the current locale" dooverride_translation("de", "fish", "Override of fish in :de")override_translation("en", "fish", "Override of fish in :en")translation_should_equal("fish", "Override of fish in :de")@@ -307,21 +307,21 @@ RSpec.describe "translate accelerator" doendcontext "with override only in current locale" do- it "should return the override from the current locale" do+ it "returns the override from the current locale" dooverride_translation("de", "fish", "Override of fish in :de")translation_should_equal("fish", "Override of fish in :de")endendcontext "with override only in fallback locale" do- it "should return the translation from the current locale" do+ it "returns the translation from the current locale" dooverride_translation("en", "fish", "Override of fish in :en")translation_should_equal("fish", "Override of fish in :en")endendcontext "with no overrides" do- it "should return the translation from the fallback locale" do+ it "returns the translation from the fallback locale" dotranslation_should_equal("fish", "original fish")endenddiff --git a/spec/lib/freedom_patches/web_push_spec.rb b/spec/lib/freedom_patches/web_push_spec.rbindex 6b4f9f9239d..0c706434dd6 100644--- a/spec/lib/freedom_patches/web_push_spec.rb+++ b/spec/lib/freedom_patches/web_push_spec.rb@@ -13,7 +13,7 @@ RSpec.describe klass doFinalDestination::SSRFDetector.disallow_ip_lookups_in_test!end- it "should filter endpoint hostname through our SSRF detector" do+ it "filters the endpoint hostname through the SSRF detector" doklass::Request.any_instance.expects(:encrypt_payload)klass::Request.any_instance.expects(:headers)@@ -34,7 +34,7 @@ RSpec.describe klass doend.to raise_error(FinalDestination::SSRFDetector::DisallowedIpError)end- it "should send the right request if endpoint hostname resolves to a public ip address" do+ it "sends the expected request when the endpoint resolves to a public IP address" doklass::Request.any_instance.expects(:encrypt_payload)klass::Request.any_instance.expects(:headers)diff --git a/spec/lib/global_path_spec.rb b/spec/lib/global_path_spec.rbindex 61c0cecd7c8..2caf6b27c58 100644--- a/spec/lib/global_path_spec.rb+++ b/spec/lib/global_path_spec.rb@@ -16,12 +16,12 @@ RSpec.describe GlobalPath doexpect(cdn_relative_path("/test")).to eq("/test")end- it "returns path when a cdn is defined with a path" do+ it "includes the path from a protocol-relative CDN URL" doGlobalSetting.expects(:cdn_url).returns("//something.com/foo")expect(cdn_relative_path("/test")).to eq("/foo/test")end- it "returns path when a cdn is defined with a path" do+ it "includes the path from a CDN URL with a scheme and port" doGlobalSetting.expects(:cdn_url).returns("https://something.com:221/foo")expect(cdn_relative_path("/test")).to eq("/foo/test")enddiff --git a/spec/lib/guardian/invite_guardian_spec.rb b/spec/lib/guardian/invite_guardian_spec.rbindex f77b40351ff..b8def41d4cc 100644--- a/spec/lib/guardian/invite_guardian_spec.rb+++ b/spec/lib/guardian/invite_guardian_spec.rb@@ -171,16 +171,16 @@ RSpec.describe InviteGuardian dolet(:topic) { Fabricate(:topic, category: category) }- it "should return true for an admin user" do+ it "returns true for an admin" doexpect(Guardian.new(admin).can_invite_to?(topic)).to eq(true)end- it "should return true for a group owner" do+ it "returns true for a group owner" dogroup_owner.update!(trust_level: 2)expect(Guardian.new(group_owner).can_invite_to?(topic)).to eq(true)end- it "should return false for a normal user" do+ it "returns false for a regular user" doexpect(Guardian.new(user).can_invite_to?(topic)).to eq(false)endend@@ -193,7 +193,7 @@ RSpec.describe InviteGuardian dolet(:group_owner) { Fabricate(:user).tap { |user| automatic_group.add_owner(user) } }let(:topic) { Fabricate(:topic, category: category) }- it "should return false for all type of users" do+ it "returns false for every user type" doexpect(Guardian.new(admin).can_invite_to?(topic)).to eq(false)expect(Guardian.new(group_owner).can_invite_to?(topic)).to eq(false)expect(Guardian.new(user).can_invite_to?(topic)).to eq(false)diff --git a/spec/lib/guardian/post_guardian_spec.rb b/spec/lib/guardian/post_guardian_spec.rbindex dce84101f60..feb7e8c7b23 100644--- a/spec/lib/guardian/post_guardian_spec.rb+++ b/spec/lib/guardian/post_guardian_spec.rb@@ -320,7 +320,7 @@ RSpec.describe PostGuardian dofab!(:post) { Fabricate(:post, user: user, topic: topic) }describe "when post has been deleted" do- it "should return the right value" do+ it "allows a moderator to recover a post they deleted" doexpect(Guardian.new(moderator).can_recover_post?(post)).to be_falseyPostDestroyer.new(moderator, post).destroy@@ -329,7 +329,7 @@ RSpec.describe PostGuardian doenddescribe "when post's user has been deleted" do- it "should return the right value" do+ it "allows a moderator to recover a post whose author was deleted" doPostDestroyer.new(moderator, post).destroypost.user.destroy!diff --git a/spec/lib/guardian/user_guardian_spec.rb b/spec/lib/guardian/user_guardian_spec.rbindex 22493d55279..a37aad8a007 100644--- a/spec/lib/guardian/user_guardian_spec.rb+++ b/spec/lib/guardian/user_guardian_spec.rb@@ -39,12 +39,12 @@ RSpec.describe UserGuardian docontext "with anon user" dolet(:guardian) { Guardian.new }- it "should return the right value for non-automatic requests" do+ it "returns the expected value for non-automatic requests" doSiteSetting.reviewable_claiming = "optional"expect(guardian.can_claim_reviewable_topic?(topic)).to eq(false)end- it "should return the right value for automatic requests" do+ it "returns the expected value for automatic requests" doexpect(guardian.can_claim_reviewable_topic?(topic, true)).to eq(false)endend@@ -52,12 +52,12 @@ RSpec.describe UserGuardian docontext "with current user" dolet(:guardian) { Guardian.new(user) }- it "should return the right value for non-automatic requests" do+ it "returns the expected value for non-automatic requests" doSiteSetting.reviewable_claiming = "optional"expect(guardian.can_claim_reviewable_topic?(topic)).to eq(false)end- it "should return the right value for automatic requests" do+ it "returns the expected value for automatic requests" doexpect(guardian.can_claim_reviewable_topic?(topic, true)).to eq(false)endend@@ -65,12 +65,12 @@ RSpec.describe UserGuardian docontext "with moderator" dolet(:guardian) { Guardian.new(moderator) }- it "should return the right value for non-automatic requests" do+ it "returns the expected value for non-automatic requests" doSiteSetting.reviewable_claiming = "optional"expect(guardian.can_claim_reviewable_topic?(topic)).to eq(true)end- it "should return the right value for automatic requests" do+ it "returns the expected value for automatic requests" doexpect(guardian.can_claim_reviewable_topic?(topic, true)).to eq(true)endend@@ -78,12 +78,12 @@ RSpec.describe UserGuardian docontext "with admin" dolet(:guardian) { Guardian.new(admin) }- it "should return the right value for non-automatic requests" do+ it "returns the expected value for non-automatic requests" doSiteSetting.reviewable_claiming = "optional"expect(guardian.can_claim_reviewable_topic?(topic)).to eq(true)end- it "should return the right value for automatic requests" do+ it "returns the expected value for automatic requests" doexpect(guardian.can_claim_reviewable_topic?(topic, true)).to eq(true)endend@@ -145,7 +145,7 @@ RSpec.describe UserGuardian docontext "with anon user" dolet(:guardian) { Guardian.new }- it "should return the right value" do+ it "returns the expected value" doexpect(guardian.can_pick_avatar?(user_avatar, users_upload)).to eq(false)endenddiff --git a/spec/lib/guardian_spec.rb b/spec/lib/guardian_spec.rbindex 386090cf4e4..a10c9752992 100644--- a/spec/lib/guardian_spec.rb+++ b/spec/lib/guardian_spec.rb@@ -373,13 +373,13 @@ RSpec.describe Guardian dobefore { another_user.user_option.update!(allow_private_messages: false) }context "for a normal user" do- it "should return false" do+ it "prevents the user from sending a private message" doexpect(Guardian.new(user).can_send_private_message?(another_user)).to eq(false)endendcontext "for a staff user" do- it "should return true" do+ it "allows staff to send private messages" do[admin, moderator].each do |staff_user|expect(Guardian.new(staff_user).can_send_private_message?(another_user)).to eq(true)end@@ -790,7 +790,7 @@ RSpec.describe Guardian doexpect(Guardian.new(moderator).can_create?(Topic, category)).to be_falseyend- it "should check for full permissions" do+ it "checks for full category permissions" docategory = plain_categorycategory.set_permissions(everyone: :create_post)category.save@@ -886,7 +886,7 @@ RSpec.describe Guardian docontext "as a moderator" dodescribe "when post has been deleted" do- it "should return the right value" do+ it "allows recovery only after the topic is deleted" doexpect(Guardian.new(moderator).can_recover_topic?(topic)).to be_falseyPostDestroyer.new(moderator, topic.first_post).destroy@@ -896,7 +896,7 @@ RSpec.describe Guardian doenddescribe "when post's user has been deleted" do- it "should return the right value" do+ it "allows recovery after the topic's author is deleted" doPostDestroyer.new(moderator, topic.first_post).destroytopic.first_post.user.destroy!@@ -1518,7 +1518,7 @@ RSpec.describe Guardian doexpect(Guardian.new(moderator).can_see_flags?(post)).to be_truthyend- it "allows moderators to see flags" do+ it "allows admins to see flags" doexpect(Guardian.new(admin).can_see_flags?(post)).to be_truthyendend@@ -2004,7 +2004,7 @@ RSpec.describe Guardian doexpect(Guardian.new(admin).can_grant_admin?(user)).to be_truthyend- it "should not allow an admin to grant admin access to a non real user" do+ it "prevents granting admin access to a system user" doDiscourse.system_user.update!(admin: false)expect(Guardian.new(admin).can_grant_admin?(Discourse.system_user)).to be(false)ensure@@ -2032,7 +2032,7 @@ RSpec.describe Guardian doexpect(Guardian.new(admin).can_revoke_admin?(another_admin)).to be_truthyend- it "should not allow an admin to revoke a no real user's admin access" do+ it "prevents revoking a system user's admin access" doexpect(Guardian.new(admin).can_revoke_admin?(Discourse.system_user)).to be(false)endend@@ -2046,7 +2046,7 @@ RSpec.describe Guardian doexpect(Guardian.new(user).can_grant_moderation?(moderator)).to be_falseyend- it "will allow an admin to grant their own moderator access" do+ it "allows admins to grant themselves moderator access" doexpect(Guardian.new(admin).can_grant_moderation?(admin)).to be_truthyend@@ -2058,7 +2058,7 @@ RSpec.describe Guardian doexpect(Guardian.new(admin).can_grant_moderation?(user)).to be_truthyend- it "should not allow an admin to grant moderation to a non real user" do+ it "prevents granting moderation to a system user" doDiscourse.system_user.update!(moderator: false)expect(Guardian.new(admin).can_grant_moderation?(Discourse.system_user)).to be(false)ensure@@ -2092,7 +2092,7 @@ RSpec.describe Guardian doexpect(Guardian.new(admin).can_revoke_moderation?(admin)).to be_falseyend- it "should not allow an admin to revoke moderation from a non real user" do+ it "prevents revoking moderation from a system user" doexpect(Guardian.new(admin).can_revoke_moderation?(Discourse.system_user)).to be(false)endend@@ -2834,7 +2834,7 @@ RSpec.describe Guardian doglobal_setting :allowed_theme_repos, " https://magic.com/repo.git, https://x.com/git"end- it "should respect theme allowlisting" do+ it "respects theme allowlisting" dor = RemoteTheme.create!(remote_url: "https://magic.com/repo.git")theme.update!(remote_theme_id: r.id)@@ -3289,14 +3289,14 @@ RSpec.describe Guardian doenddescribe "suspension reasons" do- it "will be shown by default" do+ it "shows suspension reasons by default" doexpect(Guardian.new.can_see_suspension_reason?(user)).to eq(true)endcontext "with hide suspension reason enabled" dobefore { SiteSetting.hide_suspension_reasons = true }- it "will not be shown to anonymous users" do+ it "hides suspension reasons from anonymous users" doexpect(Guardian.new.can_see_suspension_reason?(user)).to eq(false)end@@ -3311,14 +3311,14 @@ RSpec.describe Guardian doenddescribe "silencing reasons" do- it "will be shown by default" do+ it "shows silencing reasons by default" doexpect(Guardian.new.can_see_silencing_reason?(user)).to eq(true)endcontext "with hide silencing reason enabled" dobefore { SiteSetting.hide_silencing_reasons = true }- it "will not be shown to anonymous users" do+ it "hides silencing reasons from anonymous users" doexpect(Guardian.new.can_see_silencing_reason?(user)).to eq(false)end@@ -3360,7 +3360,7 @@ RSpec.describe Guardian dodescribe "#can_remove_allowed_users?" docontext "with staff users" do- it "should be true" do+ it "allows moderators to remove allowed users" doexpect(Guardian.new(moderator).can_remove_allowed_users?(topic)).to eq(true)endend@@ -3374,7 +3374,7 @@ RSpec.describe Guardian dotopic.allowed_users << another_userend- it "should be true" do+ it "allows the topic creator to remove allowed users" doexpect(Guardian.new(topic_creator).can_remove_allowed_users?(topic)).to eq(true)endend@@ -3387,19 +3387,19 @@ RSpec.describe Guardian dotopic.allowed_users << another_userend- it "should be false" do+ it "prevents regular users from removing allowed users" doexpect(Guardian.new(user).can_remove_allowed_users?(topic)).to eq(false)enddescribe "target_user is the user" dodescribe "when user is in a pm with another user" do- it "should return true" do+ it "allows the user to leave the PM" doexpect(Guardian.new(user).can_remove_allowed_users?(topic, user)).to eq(true)endenddescribe "when user is the creator of the topic" do- it "should return false" do+ it "prevents the topic creator from leaving" doexpect(Guardian.new(topic.user).can_remove_allowed_users?(topic, topic.user)).to eq(false,)@@ -3407,7 +3407,7 @@ RSpec.describe Guardian doenddescribe "when user is the only user in the topic" do- it "should return false" do+ it "prevents the last user from leaving" dotopic.remove_allowed_user(Discourse.system_user, another_user.username)expect(Guardian.new(user).can_remove_allowed_users?(topic, user)).to eq(false)@@ -3416,7 +3416,7 @@ RSpec.describe Guardian doenddescribe "target_user is not the user" do- it "should return false" do+ it "prevents removing another user" doexpect(Guardian.new(user).can_remove_allowed_users?(topic, moderator)).to eq(false)endend@@ -3425,11 +3425,11 @@ RSpec.describe Guardian docontext "with anonymous users" dofab!(:topic)- it "should be false" do+ it "prevents anonymous users from removing allowed users" doexpect(Guardian.new.can_remove_allowed_users?(topic)).to eq(false)end- it "should be false when the topic does not have a user (for example because the user was removed)" do+ it "prevents removing allowed users when the topic has no author" doDB.exec("UPDATE topics SET user_id=NULL WHERE id=#{topic.id}")topic.reload@@ -3535,12 +3535,12 @@ RSpec.describe Guardian doenddescribe "#can_mention_here?" do- it "returns false if disabled" do+ it "returns false when the maximum here mentions is zero" doSiteSetting.max_here_mentioned = 0expect(admin.guardian.can_mention_here?).to eq(false)end- it "returns false if disabled" do+ it "returns false when the here mention is blank" doSiteSetting.here_mention = ""expect(admin.guardian.can_mention_here?).to eq(false)end@@ -3579,7 +3579,7 @@ RSpec.describe Guardian dofab!(:category)- it "should correctly detect category moderation" do+ it "detects category moderation" dogroup.add(user)Fabricate(:category_moderation_group, category:, group:)guardian = Guardian.new(user)diff --git a/spec/lib/html_to_markdown_spec.rb b/spec/lib/html_to_markdown_spec.rbindex ffc6db2ceed..4320e99a7f4 100644--- a/spec/lib/html_to_markdown_spec.rb+++ b/spec/lib/html_to_markdown_spec.rb@@ -465,7 +465,7 @@ RSpec.describe HtmlToMarkdown do).to eq("> ```\n> var foo = 'bar';\n> ```")end- it "works" do+ it "converts a blockquote nested in a list item" doexpect(html_to_markdown("<ul><li><p>A list item with a blockquote:</p><blockquote><p>This is a <strong>blockquote</strong><br>inside a list item.</p></blockquote></li></ul>",@@ -550,7 +550,7 @@ RSpec.describe HtmlToMarkdown do)end- it "works" do+ it "converts nested bold and italic text with line breaks" doexpect(html_to_markdown("<div>A <b> B <i> C <br> D </i> E <br> F </b> G</div>")).to eq("A __B *C*__\n__*D* E__\n**F** G",)diff --git a/spec/lib/i18n/i18n_interpolation_keys_finder_spec.rb b/spec/lib/i18n/i18n_interpolation_keys_finder_spec.rbindex 970b223984b..72a8bc38a3e 100644--- a/spec/lib/i18n/i18n_interpolation_keys_finder_spec.rb+++ b/spec/lib/i18n/i18n_interpolation_keys_finder_spec.rb@@ -2,7 +2,7 @@RSpec.describe I18nInterpolationKeysFinder dodescribe "#find" do- it "should return the right keys" do+ it "returns the interpolation keys" doexpect(described_class.find("%{first} %{second} {{third}}")).to eq(%w[first second third])endenddiff --git a/spec/lib/inline_oneboxer_spec.rb b/spec/lib/inline_oneboxer_spec.rbindex 57c9e7fbcab..e431016904f 100644--- a/spec/lib/inline_oneboxer_spec.rb+++ b/spec/lib/inline_oneboxer_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe InlineOneboxer do- it "should return nothing with empty input" do+ it "returns nothing for empty input" doexpect(InlineOneboxer.new([]).process).to be_blankend@@ -146,7 +146,7 @@ RSpec.describe InlineOneboxer doexpect(InlineOneboxer.lookup("/test")).to be_nilend- it "will return the fancy title" do+ it "returns the fancy title" dotopic = Fabricate(:topic, title: "Hello :pizza: with an emoji")onebox = InlineOneboxer.lookup(topic.url, skip_cache: true)expect(onebox).to be_present@@ -154,7 +154,7 @@ RSpec.describe InlineOneboxer doexpect(onebox[:title]).to eq("Hello 🍕 with an emoji")end- it "will append the post number post author's username to the title" do+ it "appends the post number and author's username to the title" dotopic = Fabricate(:topic, title: "Inline oneboxer")Fabricate(:post, topic: topic) # OPFabricate(:post, topic: topic)@@ -182,13 +182,13 @@ RSpec.describe InlineOneboxer doexpect(lookup.call(99)).to eq("Inline oneboxer - #4 by #{posts[3].user.username}")end- it "will not crawl domains that aren't allowlisted" do+ it "does not crawl domains that are not allowlisted" doSiteSetting.enable_inline_onebox_on_all_domains = falseonebox = InlineOneboxer.lookup("https://eviltrout.com", skip_cache: true)expect(onebox).to be_blankend- it "will crawl anything if allowed to" do+ it "crawls any domain when configured to do so" doSiteSetting.enable_inline_onebox_on_all_domains = truestub_request(:get, "https://eviltrout.com/some-path").to_return(@@ -203,7 +203,7 @@ RSpec.describe InlineOneboxer doexpect(onebox[:title]).to eq("a blog")end- it "will not return a onebox if it does not meet minimal length" do+ it "does not return a onebox shorter than the minimum length" doSiteSetting.enable_inline_onebox_on_all_domains = truestub_request(:get, "https://eviltrout.com/some-path").to_return(@@ -218,7 +218,7 @@ RSpec.describe InlineOneboxer doexpect(onebox[:title]).to eq(nil)end- it "will lookup allowlisted domains" do+ it "looks up allowlisted domains" doSiteSetting.allowed_inline_onebox_domains = "eviltrout.com"RetrieveTitle.stubs(:crawl).returns("Evil Trout's Blog")diff --git a/spec/lib/json_error_spec.rb b/spec/lib/json_error_spec.rbindex 8081e728cc0..f47527ef1d2 100644--- a/spec/lib/json_error_spec.rb+++ b/spec/lib/json_error_spec.rb@@ -3,7 +3,7 @@RSpec.shared_examples "a generic error" dolet(:result) { creator.create_errors_json(obj) }- it "should have a result object" do+ it "includes a result object" doexpect(result).to be_presentenddiff --git a/spec/lib/middleware/anonymous_cache_spec.rb b/spec/lib/middleware/anonymous_cache_spec.rbindex 12617a4d0bf..c51c39f84d0 100644--- a/spec/lib/middleware/anonymous_cache_spec.rb+++ b/spec/lib/middleware/anonymous_cache_spec.rb@@ -292,7 +292,7 @@ RSpec.describe Middleware::AnonymousCache doenddescribe "background request rate limit" do- it "will rate limit background requests" do+ it "rate limits background requests" doapp = Middleware::AnonymousCache.new(lambda { |env| [200, {}, ["ok"]] })global_setting :background_requests_max_queue_length, "0.5"@@ -332,7 +332,7 @@ RSpec.describe Middleware::AnonymousCache dodescribe "#force_anonymous!" dobefore { RateLimiter.enable }- it "will revert to anonymous once we reach the limit" do+ it "reverts to anonymous when the limit is reached" dois_anon = falseapp =@@ -485,7 +485,7 @@ RSpec.describe Middleware::AnonymousCache doexpect(@status).to eq(200)end- it "should never block robots.txt" do+ it "allows robots.txt requests" doSiteSetting.blocked_crawler_user_agents = "Googlebot"get "/robots.txt",@@ -496,7 +496,7 @@ RSpec.describe Middleware::AnonymousCache doexpect(@status).to eq(200)end- it "should never block srv/status" do+ it "allows srv/status requests" doSiteSetting.blocked_crawler_user_agents = "Googlebot"get "/srv/status",diff --git a/spec/lib/middleware/discourse_public_exceptions_spec.rb b/spec/lib/middleware/discourse_public_exceptions_spec.rbindex 85c2303879b..4f2fc04ffd1 100644--- a/spec/lib/middleware/discourse_public_exceptions_spec.rb+++ b/spec/lib/middleware/discourse_public_exceptions_spec.rb@@ -16,7 +16,7 @@ RSpec.describe Middleware::DiscoursePublicExceptions do}.merge(opts)end- it "should not log for invalid mime type requests" do+ it "does not log invalid MIME type requests" doex = Middleware::DiscoursePublicExceptions.new("/test")ex.call(diff --git a/spec/lib/middleware/request_tracker_spec.rb b/spec/lib/middleware/request_tracker_spec.rbindex 186ac277006..bf4982d721e 100644--- a/spec/lib/middleware/request_tracker_spec.rb+++ b/spec/lib/middleware/request_tracker_spec.rb@@ -1485,7 +1485,7 @@ RSpec.describe Middleware::RequestTracker doafter { Middleware::RequestTracker.unregister_ip_skipper }- it "won't block if the ip is skipped" do+ it "does not block skipped IP addresses" doenv1 = env("REMOTE_ADDR" => "1.1.1.2")status, _ = middleware.call(env1)status, _ = middleware.call(env1)diff --git a/spec/lib/migration/column_dropper_spec.rb b/spec/lib/migration/column_dropper_spec.rbindex f14e21b34d3..84d672b86b2 100644--- a/spec/lib/migration/column_dropper_spec.rb+++ b/spec/lib/migration/column_dropper_spec.rb@@ -28,7 +28,7 @@ RSpec.describe Migration::ColumnDropper doendend- describe ".mark_readonly" do+ describe ".mark_readonly schema lookup" doit "only checks the public schema for default values" doDB.exec <<~SQLCREATE TABLE test_public_schema (id INTEGER, col TEXT);@@ -55,7 +55,7 @@ RSpec.describe Migration::ColumnDropper doendend- describe ".mark_readonly" do+ describe ".mark_readonly enforcement" dolet(:table_name) { "table_with_readonly_column" }before do@@ -78,7 +78,7 @@ RSpec.describe Migration::ColumnDropper doSQLend- it "should be droppable" do+ it "allows the read-only column to be dropped" doMigration::ColumnDropper.execute_drop(table_name, ["email"])expect(has_trigger?(Migration::BaseDropper.readonly_trigger_name(table_name, "email"))).to eq(@@ -88,7 +88,7 @@ RSpec.describe Migration::ColumnDropper doexpect(has_column?(table_name, "email")).to eq(false)end- it "should prevent updates to the readonly column" do+ it "prevents updates to the read-only column" doDB.exec <<~SQLUPDATE #{table_name}SET email = '[email protected]'@@ -101,7 +101,7 @@ RSpec.describe Migration::ColumnDropper do].each { |message| expect(e.message).to include(message) }end- it "should allow updates to the other columns" do+ it "allows updates to other columns" doDB.exec <<~SQLUPDATE #{table_name}SET topic_id = 2@@ -112,7 +112,7 @@ RSpec.describe Migration::ColumnDropper doend- it "should prevent insertions to the readonly column" do+ it "prevents insertions into the read-only column" doexpect do ActiveRecord::Base.connection.raw_connection.exec <<~SQL end.to raise_error(INSERT INTO #{table_name} (topic_id, email)VALUES (2, '[email protected]');@@ -122,7 +122,7 @@ RSpec.describe Migration::ColumnDropper do)end- it "should allow insertions to the other columns" do+ it "allows insertions into other columns" doDB.exec <<~SQLINSERT INTO #{table_name} (topic_id)VALUES (2);diff --git a/spec/lib/migration/safe_migrate_spec.rb b/spec/lib/migration/safe_migrate_spec.rbindex 33ef910b068..af74a39772c 100644--- a/spec/lib/migration/safe_migrate_spec.rb+++ b/spec/lib/migration/safe_migrate_spec.rb@@ -161,7 +161,7 @@ RSpec.describe Migration::SafeMigrate doenddescribe "for a post deployment migration" do- it "should not ban unsafe migrations using up" do+ it "does not ban unsafe migrations that use up" doMigration::SafeMigrate::SafeMigration.enable_safe!path = File.expand_path "#{Rails.root.join("spec/fixtures/db/post_migrate/drop_table")}"@@ -171,7 +171,7 @@ RSpec.describe Migration::SafeMigrate doexpect(output).to include("drop_table(:email_logs)")end- it "should not ban unsafe migrations using change" do+ it "does not ban unsafe migrations that use change" doMigration::SafeMigrate::SafeMigration.enable_safe!path = File.expand_path "#{Rails.root.join("spec/fixtures/db/post_migrate/change")}"diff --git a/spec/lib/migration/table_dropper_spec.rb b/spec/lib/migration/table_dropper_spec.rbindex add89c3c153..028747584f2 100644--- a/spec/lib/migration/table_dropper_spec.rb+++ b/spec/lib/migration/table_dropper_spec.rb@@ -31,7 +31,7 @@ RSpec.describe Migration::TableDropper doenddescribe ".execute_drop" do- it "should drop the table" do+ it "drops the table" doMigration::TableDropper.execute_drop(table_name)expect(table_exists?(table_name)).to eq(false)@@ -50,7 +50,7 @@ RSpec.describe Migration::TableDropper doSQLend- it "should be droppable" do+ it "allows the table to be dropped" doMigration::TableDropper.execute_drop(table_name)expect(has_trigger?(Migration::BaseDropper.readonly_trigger_name(table_name))).to eq(false)@@ -58,7 +58,7 @@ RSpec.describe Migration::TableDropper doexpect(table_exists?(table_name)).to eq(false)end- it "should drop the read_only function" do+ it "drops the read_only function" doMigration::TableDropper.execute_drop(table_name)schema_name, function_name =@@ -67,7 +67,7 @@ RSpec.describe Migration::TableDropper doexpect(function_exists?(function_name, schema_name)).to eq(false)end- it "should prevent insertions to the table" do+ it "prevents insertions into the table" doDB.exec <<~SQLINSERT INTO #{table_name} (topic_id) VALUES (2)SQLdiff --git a/spec/lib/new_post_manager_spec.rb b/spec/lib/new_post_manager_spec.rbindex 095c3c7869b..a24ab2ab8b9 100644--- a/spec/lib/new_post_manager_spec.rb+++ b/spec/lib/new_post_manager_spec.rb@@ -6,7 +6,7 @@ RSpec.describe NewPostManager dofab!(:user) { Fabricate(:user, refresh_auto_groups: true) }fab!(:topic) { Fabricate(:topic, user: user) }- describe "default action" do+ describe "default action for regular posts" doit "creates the post by default" domanager = NewPostManager.new(user, raw: "this is a new post", topic_id: topic.id)result = manager.perform@@ -18,7 +18,7 @@ RSpec.describe NewPostManager doendend- describe "default action" do+ describe "default action for private messages" dofab!(:other_user, :user)it "doesn't enqueue private messages" do@@ -150,7 +150,7 @@ RSpec.describe NewPostManager dotopic.user.trust_level = 0end- it "will return an enqueue result" do+ it "returns an enqueue result" doresult = NewPostManager.default_handler(manager)expect(NewPostManager.queue_enabled?).to eq(true)expect(result.action).to eq(:enqueued)@@ -164,7 +164,7 @@ RSpec.describe NewPostManager dotopic.user.trust_level = 1end- it "will return an enqueue result" do+ it "returns an enqueue result" doresult = NewPostManager.default_handler(manager)expect(NewPostManager.queue_enabled?).to eq(true)expect(result.action).to eq(:enqueued)@@ -178,7 +178,7 @@ RSpec.describe NewPostManager douser.update!(trust_level: 2)end- it "will return an enqueue result" do+ it "returns an enqueue result" doresult = NewPostManager.default_handler(manager)expect(result).to be_nilend@@ -206,7 +206,7 @@ RSpec.describe NewPostManager docontext "with a high trust level setting" dobefore { SiteSetting.approve_unless_allowed_groups = Group::AUTO_GROUPS[:trust_level_4] }- it "will return an enqueue result" do+ it "returns an enqueue result" doresult = NewPostManager.default_handler(manager)expect(NewPostManager.queue_enabled?).to eq(true)expect(result.action).to eq(:enqueued)@@ -220,7 +220,7 @@ RSpec.describe NewPostManager doSiteSetting.approve_unless_allowed_groups = Group::AUTO_GROUPS[:trust_level_4]end- it "will return an enqueue result" do+ it "returns an enqueue result" donpm =NewPostManager.new(user,@@ -242,7 +242,7 @@ RSpec.describe NewPostManager douser.update!(staged: true)end- it "will return an enqueue result" do+ it "returns an enqueue result" doresult = NewPostManager.default_handler(manager)expect(NewPostManager.queue_enabled?).to eq(true)expect(result.action).to eq(:enqueued)@@ -407,7 +407,7 @@ RSpec.describe NewPostManager doSiteSetting.approve_new_topics_unless_allowed_groups = Group::AUTO_GROUPS[:trust_level_4]end- it "will return an enqueue result" do+ it "returns an enqueue result" doresult = NewPostManager.default_handler(manager)expect(NewPostManager.queue_enabled?).to eq(true)expect(result.action).to eq(:enqueued)@@ -872,7 +872,7 @@ RSpec.describe NewPostManager dotopic.user.trust_level = 0end- it "will store via_email and raw_email in the enqueued post" do+ it "stores via_email and raw_email in the enqueued post" doresult = manager.performexpect(result.action).to eq(:enqueued)expect(result.reviewable).to be_presentdiff --git a/spec/lib/onebox/engine/stack_exchange_onebox_spec.rb b/spec/lib/onebox/engine/stack_exchange_onebox_spec.rbindex ca9e0048e11..67daf3241e9 100644--- a/spec/lib/onebox/engine/stack_exchange_onebox_spec.rb+++ b/spec/lib/onebox/engine/stack_exchange_onebox_spec.rb@@ -31,7 +31,7 @@ RSpec.describe Onebox::Engine::StackExchangeOnebox doexpect(described_class === URI("http://#{domain}/a/55503")).to eq(true)end- it "matches question with long URL on #{domain}" do+ it "matches an answer URL with a fragment on #{domain}" doexpect(described_class === URI("http://#{domain}/questions/55495/title-of-question/55503#55503"),).to eq(true)diff --git a/spec/lib/onebox/engine/trello_onebox_spec.rb b/spec/lib/onebox/engine/trello_onebox_spec.rbindex d3e8ce0ae27..e0134bddbbe 100644--- a/spec/lib/onebox/engine/trello_onebox_spec.rb+++ b/spec/lib/onebox/engine/trello_onebox_spec.rb@@ -2,13 +2,13 @@RSpec.describe Onebox::Engine::TrelloOnebox dodescribe "Boards" do- it "should onebox with SEF url corrrectly" do+ it "oneboxes an SEF URL correctly" doexpect(Onebox.preview("https://trello.com/b/nC8QJJoZ/trello-development-roadmap").to_s,).to match('iframe src="https://trello.com/b/nC8QJJoZ.html"')end- it "should onebox without SEF url corrrectly" do+ it "oneboxes a non-SEF URL correctly" doexpect(Onebox.preview("https://trello.com/b/nC8QJJoZ/").to_s).to match('iframe src="https://trello.com/b/nC8QJJoZ.html"',)@@ -21,7 +21,7 @@ RSpec.describe Onebox::Engine::TrelloOnebox doenddescribe "Cards" do- it "should onebox with SEF url corrrectly" do+ it "oneboxes an SEF URL correctly" doexpect(Onebox.preview("https://trello.com/c/NIRpzVDM/1211-what-can-you-expect-from-this-board",@@ -29,7 +29,7 @@ RSpec.describe Onebox::Engine::TrelloOnebox do).to match('iframe src="https://trello.com/c/NIRpzVDM.html"')end- it "should onebox without SEF url corrrectly" do+ it "oneboxes a non-SEF URL correctly" doexpect(Onebox.preview("https://trello.com/c/NIRpzVDM/").to_s).to match('iframe src="https://trello.com/c/NIRpzVDM.html"',)diff --git a/spec/lib/onebox/engine_spec.rb b/spec/lib/onebox/engine_spec.rbindex 19196dec634..b7e9d83556d 100644--- a/spec/lib/onebox/engine_spec.rb+++ b/spec/lib/onebox/engine_spec.rb@@ -132,11 +132,11 @@ RSpec.describe Onebox::Engine dolet(:onebox_name) { ScopeForTemplateName::TemplateNameOnebox.onebox_name }- it "should not include the scope" do+ it "omits the scope" doexpect(onebox_name).not_to include("ScopeForTemplateName", "scopefortemplatename")end- it "should not include the word Onebox" do+ it "omits the word Onebox" doexpect(onebox_name).not_to include("onebox", "Onebox")endenddiff --git a/spec/lib/onebox_spec.rb b/spec/lib/onebox_spec.rbindex d065f8b6393..824b1d696a1 100644--- a/spec/lib/onebox_spec.rb+++ b/spec/lib/onebox_spec.rb@@ -16,7 +16,7 @@ RSpec.describe Onebox dotemplates.each { |template| expect(File.read(template)).not_to match(text) }end- it "should not contain any script tags" do+ it "contains no script tags" doexpect_templates_to_not_match(/<script/)endenddiff --git a/spec/lib/oneboxer_spec.rb b/spec/lib/oneboxer_spec.rbindex 236aaa780f8..2cd43c6e014 100644--- a/spec/lib/oneboxer_spec.rb+++ b/spec/lib/oneboxer_spec.rb@@ -172,7 +172,7 @@ RSpec.describe Oneboxer doexpect(preview("/u/#{user.username}")).to include(user.name)end- it "should respect enable_names site setting" do+ it "respects the enable_names site setting" douser = Fabricate(:user)user.user_stat.update!(post_count: 1)@@ -386,7 +386,7 @@ RSpec.describe Oneboxer doenddescribe ".onebox_raw" do- it "should escape the onebox URL before processing" do+ it "escapes the onebox URL before processing" dopost = Fabricate(:post, raw: Discourse.base_url + "/new?'class=black")cpp = CookedPostProcessor.new(post, invalidate_oneboxes: true)cpp.post_process_oneboxesdiff --git a/spec/lib/plugin/filter_manager_spec.rb b/spec/lib/plugin/filter_manager_spec.rbindex 78275b0189d..87a25487dc7 100644--- a/spec/lib/plugin/filter_manager_spec.rb+++ b/spec/lib/plugin/filter_manager_spec.rb@@ -11,15 +11,15 @@ RSpec.describe Plugin::FilterManager doexpect(instance.apply(:added_numbers, 1, 0)).to eq(5)end- it "should raise an exception if wrong arity is passed in" do+ it "raises an exception for an invalid arity" doexpect do instance.register(:test) {} end.to raise_error(ArgumentError)end- it "should return the original if no filters exist" do+ it "returns the original value when no filters exist" doexpect(instance.apply(:foo, nil, 42)).to eq(42)end- it "should raise an exception if no block is passed in" do+ it "raises an exception when no block is provided" doexpect do instance.register(:test) end.to raise_error(ArgumentError)endenddiff --git a/spec/lib/plugin/instance_spec.rb b/spec/lib/plugin/instance_spec.rbindex eb3a5d3086d..9656d5c2737 100644--- a/spec/lib/plugin/instance_spec.rb+++ b/spec/lib/plugin/instance_spec.rb@@ -486,7 +486,7 @@ TEXTenddescribe ".register_seedfu_fixtures" do- it "should add the new path to SeedFu's fixtures path" do+ it "adds the new path to SeedFu's fixture paths" doplugin = Plugin::Instance.new nil, "/tmp/test.rb"plugin.register_seedfu_fixtures(["some_path"])plugin.register_seedfu_fixtures("some_path2")@@ -509,7 +509,7 @@ TEXTpluginend- it "should add the right callback" do+ it "adds the expected callback" docalled = 0plugin_instance.add_model_callback(User, :after_create) { called += 1 }@@ -523,7 +523,7 @@ TEXTexpect(called).to eq(1)end- it "should add the right callback with options" do+ it "adds the expected callback with options" docalled = 0plugin_instance.add_model_callback(User, :after_commit, on: :create) { called += 1 }@@ -1369,7 +1369,7 @@ TEXTdescribe "#add_request_rate_limiter" doafter { Middleware::RequestTracker.reset_rate_limiters_stack }- it "should raise an error if `after` and `before` kwarg are provided" do+ it "raises an error when both `after` and `before` are provided" doplugin = Plugin::Instance.newexpect do@@ -1383,7 +1383,7 @@ TEXTend.to raise_error(ArgumentError, "only one of `after` or `before` can be provided")end- it "should raise an error if value of `after` kwarg is invalid" do+ it "raises an error when `after` is invalid" doplugin = Plugin::Instance.newexpect {@@ -1399,7 +1399,7 @@ TEXT)end- it "should raise an error if value of `before` kwarg is invalid" do+ it "raises an error when `before` is invalid" doplugin = Plugin::Instance.newexpect {diff --git a/spec/lib/post_action_creator_spec.rb b/spec/lib/post_action_creator_spec.rbindex 13e6d3d443a..b9848a099a2 100644--- a/spec/lib/post_action_creator_spec.rb+++ b/spec/lib/post_action_creator_spec.rb@@ -185,7 +185,7 @@ RSpec.describe PostActionCreator doenddescribe "flags" do- it "will create a reviewable if one does not exist" do+ it "creates a reviewable if one does not exist" doresult = PostActionCreator.create(user, post, :inappropriate)expect(result.success?).to eq(true)@@ -366,7 +366,7 @@ RSpec.describe PostActionCreator doenddescribe "take_action" do- it "will hide the post" do+ it "hides the post" doPostActionCreator.new(Fabricate(:moderator, refresh_auto_groups: true),@@ -384,7 +384,7 @@ RSpec.describe PostActionCreator doPostActionCreator.create(Fabricate(:user, refresh_auto_groups: true), post, :inappropriate)end- it "will agree with the old reviewable" do+ it "agrees with the old reviewable" doreviewable =PostActionCreator.new(diff --git a/spec/lib/post_action_destroyer_spec.rb b/spec/lib/post_action_destroyer_spec.rbindex a6d2275cbbf..03328470e85 100644--- a/spec/lib/post_action_destroyer_spec.rb+++ b/spec/lib/post_action_destroyer_spec.rb@@ -71,7 +71,7 @@ RSpec.describe PostActionDestroyer doendcontext "when post action doesn’t exist" do- it "fails" do+ it "returns an error for an unsupported post action" doresult = PostActionDestroyer.destroy(user, post, :like)expect(result.success).to eq(false)expect(result.not_found).to eq(true)diff --git a/spec/lib/post_creator_spec.rb b/spec/lib/post_creator_spec.rbindex fd0157b54e1..c4ba5c26cb0 100644--- a/spec/lib/post_creator_spec.rb+++ b/spec/lib/post_creator_spec.rb@@ -661,7 +661,7 @@ RSpec.describe PostCreator doendcontext "with regular expressions" do- it "works" do+ it "applies regular-expression tag rules" doSiteSetting.watched_words_regular_expressions = trueFabricate(:watched_word,@@ -1187,7 +1187,7 @@ RSpec.describe PostCreator doexpect(post.topic.topic_allowed_users.where(user_id: tl0_user.id).count).to eq(0)end- it "does not add whisperers to allowed users of the topic" do+ it "does not add whisper authors to the topic's allowed users" doSiteSetting.whispers_allowed_groups = "#{Group::AUTO_GROUPS[:staff]}"unrelated_user.update!(admin: true)@@ -1205,7 +1205,7 @@ RSpec.describe PostCreator do)end- it "does not add whisperers to allowed users of the topic" do+ it "does not add small-action authors to the topic's allowed users" dounrelated_user.update!(admin: true)PostCreator.create!(@@ -1615,7 +1615,7 @@ RSpec.describe PostCreator doenddescribe "read credit for creator" do- it "should give credit to creator" do+ it "records reading credit for the creator" dopost = create_postexpect(PostTiming.find_by(@@ -1806,7 +1806,7 @@ RSpec.describe PostCreator doenddescribe "#create!" do- it "should return the post if it was successfully created" do+ it "returns the newly created post" dotitle = "This is a valid title"raw = "This is a really awesome post"@@ -1818,7 +1818,7 @@ RSpec.describe PostCreator doexpect(post.raw).to eq(raw)end- it "should raise an error when post fails to be created" do+ it "raises an error when the post cannot be created" dopost_creator = PostCreator.new(user, title: "", raw: "")expect { post_creator.create! }.to raise_error(ActiveRecord::RecordNotSaved)end@@ -1894,7 +1894,7 @@ RSpec.describe PostCreator dobefore { another_user.user_option.update!(allow_private_messages: false) }- it "should not be valid" do+ it "rejects the private message" dopost_creator =PostCreator.new(user,@@ -1911,7 +1911,7 @@ RSpec.describe PostCreator do)end- it "should not be valid if the name is downcased" do+ it "rejects the private message when the username is lowercase" dopost_creator =PostCreator.new(user,@@ -1929,7 +1929,7 @@ RSpec.describe PostCreator dofab!(:muted_me) { evil_trout }fab!(:another_user, :user)- it "should fail" do+ it "rejects the private message" doupdater = UserUpdater.new(muted_me, muted_me)updater.update_muted_users("#{user.username}")@@ -1975,7 +1975,7 @@ RSpec.describe PostCreator docontext "when post author is ignored" dolet!(:ignored_user) { Fabricate(:ignored_user, user: ignorer, ignored_user: user) }- it "should fail" do+ it "rejects the private message" dopc =PostCreator.new(user,@@ -2020,7 +2020,7 @@ RSpec.describe PostCreator doFabricate(:allowed_pm_user, user: allowed_user, allowed_pm_user: sender)end- it "should succeed" do+ it "accepts the private message" doallowed_user.user_option.update!(enable_allowed_pm_users: true)pc =@@ -2042,7 +2042,7 @@ RSpec.describe PostCreator doFabricate(:allowed_pm_user, user: allowed_user, allowed_pm_user: sender)end- it "should fail" do+ it "rejects the private message" doallowed_user.user_option.update!(allow_private_messages: false)allowed_user.user_option.update!(enable_allowed_pm_users: true)@@ -2073,7 +2073,7 @@ RSpec.describe PostCreator doFabricate(:allowed_pm_user, user: not_allowed_user, allowed_pm_user: allowed_user)end- it "should fail" do+ it "rejects the private message" donot_allowed_user.user_option.update!(enable_allowed_pm_users: true)pc =@@ -2091,7 +2091,7 @@ RSpec.describe PostCreator do)end- it "should succeed when not enabled" do+ it "accepts the private message when allow-list enforcement is disabled" donot_allowed_user.user_option.update!(enable_allowed_pm_users: false)pc =@@ -2141,7 +2141,7 @@ RSpec.describe PostCreator doFabricate(:allowed_pm_user, user: allowed_user, allowed_pm_user: sender)end- it "should fail" do+ it "rejects the private message" doallowed_user.user_option.update!(enable_allowed_pm_users: true)not_allowed_user.user_option.update!(enable_allowed_pm_users: true)diff --git a/spec/lib/post_destroyer_spec.rb b/spec/lib/post_destroyer_spec.rbindex d0c91a334c5..a107d60a3e7 100644--- a/spec/lib/post_destroyer_spec.rb+++ b/spec/lib/post_destroyer_spec.rb@@ -241,7 +241,7 @@ RSpec.describe PostDestroyer doPostDestroyer.new(@user, @reply.reload).recoverend- it "won't recover a non user-deleted post" do+ it "does not recover a post that was not deleted by its author" doPostRevisor.new(@reply).revise!(admin,{ raw: "this is a change to the post" },@@ -251,7 +251,7 @@ RSpec.describe PostDestroyer doexpect(@reply.reload.raw).to eq("this is a change to the post")end- it "should increment the user's post count" do+ it "increments the user's post count" doPostDestroyer.new(@user, @reply).destroyexpect(@user.user_stat.topic_count).to eq(1)expect(@user.user_stat.post_count).to eq(1)@@ -283,7 +283,7 @@ RSpec.describe PostDestroyer doendcontext "when recovered by admin" do- it "should set user_deleted to false" do+ it "sets user_deleted to false" doPostDestroyer.new(@user, @reply).destroyexpect(@reply.reload.user_deleted).to eq(true)@@ -291,7 +291,7 @@ RSpec.describe PostDestroyer doexpect(@reply.reload.user_deleted).to eq(false)end- it "should increment the user's post count" do+ it "increments the user's post count" doPostDestroyer.new(moderator, @reply).destroyexpect(@user.reload.user_stat.topic_count).to eq(1)expect(@user.user_stat.post_count).to eq(0)@@ -883,7 +883,7 @@ RSpec.describe PostDestroyer doexpect(events[1][:params].first).to eq(first_post.topic)end- it "should not log a personal message view" do+ it "does not log a personal message view" doSiteSetting.log_personal_messages_views = trueFabricate(:topic_web_hook)StaffActionLogger.any_instance.expects(:log_check_personal_message).never@@ -894,7 +894,7 @@ RSpec.describe PostDestroyer dodescribe "deleting a post directly after a whisper" dobefore { SiteSetting.whispers_allowed_groups = "#{Group::AUTO_GROUPS[:staff]}" }- it "should not set Topic#last_post_user_id to a whisperer" do+ it "does not set Topic#last_post_user_id to a whisper's author" dopost_1 = create_post(topic: post.topic, user: moderator)create_post(topic: post.topic, user: Fabricate(:user), post_type: Post.types[:whisper])whisper_2 =@@ -1042,7 +1042,7 @@ RSpec.describe PostDestroyer dofab!(:coding_horror) { coding_horror }fab!(:post) { Fabricate(:post, raw: "Hello @CodingHorror") }- it "should feature the users again (in case they've changed)" do+ it "enqueues an update of featured topic users" doexpect_enqueued_with(job: :feature_topic_users, args: { topic_id: post.topic_id }) doPostDestroyer.new(moderator, post).destroyend@@ -1067,7 +1067,7 @@ RSpec.describe PostDestroyer do).by(-1)end- it "should increase the post_number when there are deletion gaps" do+ it "increases the post number across deletion gaps" doPostDestroyer.new(moderator, reply).destroyp = Fabricate(:post, user: post.user, topic: post.topic)expect(p.post_number).to eq(3)@@ -1094,7 +1094,7 @@ RSpec.describe PostDestroyer dobefore { Jobs::SendSystemMessage.clear }- it "should delete public post actions and agree with flags" do+ it "deletes public post actions and agrees with flags" dourl = second_post.urlPostDestroyer.new(moderator, second_post).destroy@@ -1127,14 +1127,14 @@ RSpec.describe PostDestroyer do)end- it "should not send the flags_agreed_and_post_deleted message if it was deleted by system" do+ it "does not send the flags_agreed_and_post_deleted message for system deletions" doexpect(ReviewableFlaggedPost.pending.count).to eq(1)PostDestroyer.new(Discourse.system_user, second_post, context: "Automated testing").destroyexpect(Jobs::SendSystemMessage.jobs.size).to eq(0)expect(ReviewableFlaggedPost.pending.count).to eq(0)end- it "should not send the flags_agreed_and_post_deleted message if it was deleted by author" do+ it "does not send the flags_agreed_and_post_deleted message for author deletions" doSiteSetting.delete_removed_posts_after = 0expect(ReviewableFlaggedPost.pending.count).to eq(1)PostDestroyer.new(second_post.user, second_post).destroy@@ -1142,7 +1142,7 @@ RSpec.describe PostDestroyer doexpect(ReviewableFlaggedPost.pending.count).to eq(0)end- it "should not send the flags_agreed_and_post_deleted message if flags were ignored" do+ it "does not send the flags_agreed_and_post_deleted message when flags were ignored" doexpect(ReviewableFlaggedPost.pending.count).to eq(1)flag_result.reviewable.perform(moderator, :ignore_and_do_nothing)second_post.reload@@ -1152,7 +1152,7 @@ RSpec.describe PostDestroyer doexpect(Jobs::SendSystemMessage.jobs.size).to eq(0)end- it "should not send the flags_agreed_and_post_deleted message if defer_flags is true" do+ it "does not send the flags_agreed_and_post_deleted message when flags are deferred" doexpect(ReviewableFlaggedPost.pending.count).to eq(1)PostDestroyer.new(moderator, second_post, defer_flags: true).destroyexpect(Jobs::SendSystemMessage.jobs.size).to eq(0)@@ -1187,7 +1187,7 @@ RSpec.describe PostDestroyer dofab!(:custom_flag) { Fabricate(:flag, name: "custom flag", notify_type: true) }let(:third_post) { Fabricate(:post, topic_id: post.topic_id) }- it "should send message to user with correct translation" do+ it "sends the user a translated message" doPostActionCreator.new(moderator,third_post,@@ -1221,7 +1221,7 @@ RSpec.describe PostDestroyer do)end- it "should delete the user actions" do+ it "deletes the user actions" dolike = create_user_action(UserAction::LIKE)PostDestroyer.new(moderator, second_post).destroy@@ -1237,12 +1237,12 @@ RSpec.describe PostDestroyer dobefore { TopicLink.extract_from(second_post) }- it "should destroy the topic links when moderator destroys the post" do+ it "destroys topic links when a moderator destroys the post" doPostDestroyer.new(moderator, second_post.reload).destroyexpect(topic.topic_links.count).to eq(0)end- it "should destroy the topic links when the user destroys the post" do+ it "destroys topic links when the user destroys the post" doPostDestroyer.new(second_post.user, second_post.reload).destroyexpect(topic.topic_links.count).to eq(0)end@@ -1260,7 +1260,7 @@ RSpec.describe PostDestroyer do"http://#{base_url.host}/t/#{other_topic.slug}/#{other_topic.id}/#{other_post.post_number}"end- it "should destroy internal links when user deletes own post" do+ it "destroys internal links when the author deletes the post" donew_post = Post.create!(user: user, topic: topic, raw: "Link to other topic:\n\n#{url}\n")TopicLink.extract_from(new_post)@@ -1273,7 +1273,7 @@ RSpec.describe PostDestroyer doexpect(updated_link_counts.count).to eq(0)end- it "should destroy internal links when moderator deletes post" do+ it "destroys internal links when a moderator deletes the post" donew_post = create_post(user: user, topic: topic, raw: "Link to other topic:\n\n#{url}\n")TopicLink.extract_from(new_post)link_counts = TopicLink.counts_for(guardian, other_topic.reload, [other_post])@@ -1522,7 +1522,7 @@ RSpec.describe PostDestroyer docontext "when deleting by the creator" dobefore { PostDestroyer.new(user, last_reply).destroy }- it "will reset the topic's bumped_at" do+ it "resets the topic's bumped_at" dotopic.reloadexpect(topic.bumped_at).to eq_time(second_last_reply.created_at)@@ -1541,7 +1541,7 @@ RSpec.describe PostDestroyer docontext "when deleting by a staff user" dobefore { PostDestroyer.new(moderator, last_reply).destroy }- it "will reset the topic's bumped_at" do+ it "resets the topic's bumped_at" dotopic.reloadexpect(topic.bumped_at).to eq_time(second_last_reply.created_at)diff --git a/spec/lib/post_merger_spec.rb b/spec/lib/post_merger_spec.rbindex f18ccdd038f..76e7ca253db 100644--- a/spec/lib/post_merger_spec.rb+++ b/spec/lib/post_merger_spec.rb@@ -10,7 +10,7 @@ RSpec.describe PostMerger dolet(:topic) { post.topic }describe ".merge" do- it "should merge posts into the latest post correctly" do+ it "merges posts into the latest post" doreply1 = create_post(topic: topic, raw: "The first reply", post_number: 2, user: user)reply2 =create_post(topic: topic, raw: "The second reply\nSecond line", post_number: 3, user: user)@@ -36,7 +36,7 @@ RSpec.describe PostMerger do)end- it "should not allow the first post in a topic to be merged" do+ it "rejects merging the first post in a topic" dopost.update!(user: user)reply1 = create_post(topic: topic, post_number: post.post_number, user: user)reply2 = create_post(topic: topic, post_number: post.post_number, user: user)@@ -46,7 +46,7 @@ RSpec.describe PostMerger do)end- it "should only allow staff to merge posts" do+ it "allows only staff to merge posts" doreply1 = create_post(topic: topic, post_number: post.post_number, user: user)reply2 = create_post(topic: topic, post_number: post.post_number, user: user)@@ -78,7 +78,7 @@ RSpec.describe PostMerger doexpect(reply2.raw).to eq(merged_raw)end- it "should not allow posts from different topics to be merged" do+ it "rejects merging posts from different topics" doanother_post = create_post(user: post.user)expect { PostMerger.new(user, [another_post, post]).merge }.to raise_error(@@ -87,7 +87,7 @@ RSpec.describe PostMerger do)end- it "should not allow posts from different users to be merged" do+ it "rejects merging posts from different users" doanother_post = create_post(user: user, topic_id: topic.id)expect { PostMerger.new(user, [another_post, post]).merge }.to raise_error(@@ -96,7 +96,7 @@ RSpec.describe PostMerger do)end- it "should not allow posts with length greater than max_post_length" do+ it "rejects merged posts exceeding max_post_length" doSiteSetting.max_post_length = 60reply1 = create_post(topic: topic, raw: "The first reply", post_number: 2, user: user)diff --git a/spec/lib/post_revisor_spec.rb b/spec/lib/post_revisor_spec.rbindex 8b1be486f33..d80aa019bb9 100644--- a/spec/lib/post_revisor_spec.rb+++ b/spec/lib/post_revisor_spec.rb@@ -856,12 +856,12 @@ describe PostRevisor dopost.reloadend- it "does create a new version after the edit window" do+ it "increments the version after the edit window" doexpect(post.version).to eq(3)expect(post.public_version).to eq(3)end- it "does create a new version after the edit window" do+ it "records the revision time after the edit window" doexpect(post.last_version_at.to_i).to eq(new_revised_at.to_i)endend@@ -877,7 +877,7 @@ describe PostRevisor dolet(:new_description) { "this is my new description." }- it "should have no description by default" do+ it "has no description by default" doexpect(category.description).to be_blankend@@ -1266,7 +1266,7 @@ describe PostRevisor dodescribe "#publish_changes" dolet!(:post) { Fabricate(:post, topic: topic) }- it "should publish topic changes to clients" do+ it "publishes topic changes to clients" dorevisor = PostRevisor.new(topic.ordered_posts.first, topic)message =diff --git a/spec/lib/presence_channel_spec.rb b/spec/lib/presence_channel_spec.rbindex 3d5e41fe2ab..4119be619eb 100644--- a/spec/lib/presence_channel_spec.rb+++ b/spec/lib/presence_channel_spec.rb@@ -165,7 +165,7 @@ RSpec.describe PresenceChannel doexpect(data[0]["leaving_user_ids"]).to contain_exactly(user.id)end- it "will return the messagebus last_id in the state payload" do+ it "returns the MessageBus last_id in the state payload" dochannel = PresenceChannel.new("/test/public1")channel.present(user_id: user.id, client_id: "a")diff --git a/spec/lib/pretty_text/helpers_spec.rb b/spec/lib/pretty_text/helpers_spec.rbindex 6c623070af2..aabca6dbeab 100644--- a/spec/lib/pretty_text/helpers_spec.rb+++ b/spec/lib/pretty_text/helpers_spec.rb@@ -21,7 +21,7 @@ RSpec.describe PrettyText::Helpers doexpect(result["動画"][:url]).to eq(thumbnail.url)end- it "should return cdn url if available" do+ it "returns the CDN URL when available" doshort_url = upload.short_urlresult = PrettyText::Helpers.lookup_upload_urls([short_url])expect(result[short_url][:url]).to eq(upload.url)diff --git a/spec/lib/pretty_text_spec.rb b/spec/lib/pretty_text_spec.rbindex 4a3aec39c77..784911787f6 100644--- a/spec/lib/pretty_text_spec.rb+++ b/spec/lib/pretty_text_spec.rb@@ -398,7 +398,7 @@ RSpec.describe PrettyText docontext "with letter avatar" docontext "with subfolder" do- it "should have correct avatar url" do+ it "uses the correct avatar URL" doset_subfolder "/forum"md = <<~MD[quote="#{user.username}, post:123, topic:456, full:true"]@@ -418,7 +418,7 @@ RSpec.describe PrettyText do)end- it "should handle 3 mentions in a row" do+ it "handles three consecutive mentions" doexpect(PrettyText.cook("@hello @hello @hello"),).to match_html "<p><span class=\"mention\">@hello</span> <span class=\"mention\">@hello</span> <span class=\"mention\">@hello</span></p>"@@ -508,16 +508,16 @@ RSpec.describe PrettyText docontext "when mentions are disabled" dobefore { SiteSetting.enable_mentions = false }- it "should not convert mentions to links" do+ it "does not convert mentions to links" doexpect(PrettyText.cook("hi @user")).to eq("<p>hi @user</p>")endend- it "can handle mentions inside a hyperlink" do+ it "handles mentions inside an HTML hyperlink" doexpect(PrettyText.cook("<a> @inner</a> ")).to match_html "<p><a> @inner</a></p>"end- it "can handle mentions inside a hyperlink" do+ it "handles mentions inside a Markdown hyperlink" doexpect(PrettyText.cook("[link @inner](http://site.com)"),).to match_html '<p><a href="http://site.com" rel="noopener nofollow ugc">link @inner</a></p>'@@ -529,19 +529,19 @@ RSpec.describe PrettyText do)end- it "should handle group mentions with a hyphen and without" do+ it "handles group mentions with and without a hyphen" doexpect(PrettyText.cook("@hello @hello-hello"),).to match_html "<p><span class=\"mention\">@hello</span> <span class=\"mention\">@hello-hello</span></p>"end- it "should allow for @mentions to have punctuation" do+ it "allows punctuation after mentions" doexpect(PrettyText.cook("hello @bob's @bob,@bob; @bob\"")).to match_html("<p>hello <span class=\"mention\">@bob</span>'s <span class=\"mention\">@bob</span>,<span class=\"mention\">@bob</span>; <span class=\"mention\">@bob</span>\"</p>",)end- it "should not treat a medium link as a mention" do+ it "does not treat a Medium link as a mention" doexpect(PrettyText.cook(". http://test/@sam")).not_to include("mention")end@@ -612,7 +612,7 @@ RSpec.describe PrettyText doenddescribe "code fences" do- it "indents code correctly" do+ it "indents code after preceding text" docode = <<~MDX```@@ -696,7 +696,7 @@ RSpec.describe PrettyText do).to match_html("<pre data-code-foo='1'></pre>")end- it "indents code correctly" do+ it "preserves indentation after a blank line" docode = "X\n```\n\n #\n x\n```"cooked = PrettyText.cook(code)expect(cooked).to match_html(@@ -713,7 +713,7 @@ RSpec.describe PrettyText doDiscourse.redis.flushdbend- it "strips out unicode bidirectional (bidi) override characters and replaces with a highlighted span" do+ it "highlights Unicode bidirectional override characters while cooking" docode = <<~MDX```auto@@ -738,7 +738,7 @@ RSpec.describe PrettyText doexpect(cooked).to eq(html.strip)end- it "strips out unicode bidirectional (bidi) override characters and replaces with a highlighted span" do+ it "highlights Unicode bidirectional override characters during cleanup" docooked = <<~HTML<p>X</p><pre><code class="lang-auto">var isAdmin = false;@@ -829,17 +829,17 @@ RSpec.describe PrettyText doSiteSetting.exclude_rel_nofollow_domains = "foo.com|bar.com"end- it "should inject nofollow in all user provided links" do+ it "injects nofollow into user-provided links" doexpect(PrettyText.cook('<a href="http://cnn.com">cnn</a>')).to match(/noopener nofollow ugc/)end- it "should not inject nofollow in all local links" do+ it "does not inject nofollow into local links" doexpect(PrettyText.cook("<a href='#{Discourse.base_url}/test.html'>cnn</a>") !~ /nofollow ugc/,).to eq(true)end- it "should not inject nofollow in all subdomain links" do+ it "does not inject nofollow into subdomain links" doexpect(PrettyText.cook("<a href='#{Discourse.base_url.sub("http://", "http://bla.")}/test.html'>cnn</a>",@@ -847,7 +847,7 @@ RSpec.describe PrettyText do).to eq(true)end- it "should inject nofollow in all non subdomain links" do+ it "injects nofollow into links outside the subdomain" doexpect(PrettyText.cook("<a href='#{Discourse.base_url.sub("http://", "http://bla")}/test.html'>cnn</a>",@@ -855,36 +855,36 @@ RSpec.describe PrettyText do).to match(/nofollow ugc/)end- it "should not inject nofollow for foo.com" do+ it "does not inject nofollow for foo.com" doexpect(PrettyText.cook("<a href='http://foo.com/test.html'>cnn</a>") !~ /nofollow ugc/).to eq(true,)end- it "should inject nofollow for afoo.com" do+ it "injects nofollow for afoo.com" doexpect(PrettyText.cook("<a href='http://afoo.com/test.html'>cnn</a>")).to match(/nofollow ugc/,)end- it "should not inject nofollow for bar.foo.com" do+ it "does not inject nofollow for bar.foo.com" doexpect(PrettyText.cook("<a href='http://bar.foo.com/test.html'>cnn</a>") !~ /nofollow ugc/,).to eq(true)end- it "should not inject nofollow if omit_nofollow option is given" do+ it "does not inject nofollow when omit_nofollow is enabled" doexpect(PrettyText.cook('<a href="http://cnn.com">cnn</a>', omit_nofollow: true) !~ /nofollow ugc/,).to eq(true)end- it "adds the noopener attribute even if omit_nofollow option is given" do+ it "adds noopener when omit_nofollow is enabled" doraw_html = '<a href="https://www.mysite.com/" target="_blank">Check out my site!</a>'expect(PrettyText.cook(raw_html, omit_nofollow: true)).to match(/noopener/)end- it "adds the noopener attribute even if omit_nofollow option is given" do+ it "adds noopener when omit_nofollow is disabled" doraw_html = '<a href="https://www.mysite.com/" target="_blank">Check out my site!</a>'expect(PrettyText.cook(raw_html, omit_nofollow: false)).to match(/noopener nofollow ugc/)end@@ -901,12 +901,12 @@ RSpec.describe PrettyText doendcontext "with images" do- it "should dump images" do+ it "dumps images" doexpect(PrettyText.excerpt("<img src='http://cnn.com/a.gif'>", 100)).to eq("[image]")endcontext "with alt tags" do- it "should keep alt tags" do+ it "keeps alt attributes" doexpect(PrettyText.excerpt("<img src='http://cnn.com/a.gif' alt='car' title='my big car'>",@@ -916,7 +916,7 @@ RSpec.describe PrettyText doenddescribe "when alt tag is empty" do- it "should not keep alt tags" do+ it "does not keep alt attributes" doexpect(PrettyText.excerpt("<img src='http://cnn.com/a.gif' alt>", 100)).to eq("[#{I18n.t("excerpt_image")}]",)@@ -925,14 +925,14 @@ RSpec.describe PrettyText doendcontext "with title tags" do- it "should keep title tags" do+ it "keeps title attributes" doexpect(PrettyText.excerpt("<img src='http://cnn.com/a.gif' title='car'>", 100)).to eq("[car]",)enddescribe "when title tag is empty" do- it "should not keep title tags" do+ it "does not keep title attributes" doexpect(PrettyText.excerpt("<img src='http://cnn.com/a.gif' title>", 100)).to eq("[#{I18n.t("excerpt_image")}]",)@@ -940,7 +940,7 @@ RSpec.describe PrettyText doendend- it "should convert images to markdown if the option is set" do+ it "converts images to Markdown when configured" doexpect(PrettyText.excerpt("<img src='http://cnn.com/a.gif' title='car'>",@@ -956,13 +956,13 @@ RSpec.describe PrettyText do).to match_html "▶ expand"end- it "should remove meta information" do+ it "removes metadata" doexpect(PrettyText.excerpt(wrapped_image, 100),).to match_html "<a href='//localhost:3000/uploads/default/4399/33691397e78b4d75.png' class='lightbox' title='Screen Shot 2014-04-14 at 9.47.10 PM.png'>[image]</a>"end- it "should strip images when option is set" do+ it "strips images when configured" doexpect(PrettyText.excerpt("<img src='http://cnn.com/a.gif'>", 100, strip_images: true),).to be_blank@@ -975,7 +975,7 @@ RSpec.describe PrettyText do).to eq("Hello world!")end- it "should strip images, but keep emojis when option is set" do+ it "strips images but keeps emoji when configured" doemoji_image ="<img src='/images/emoji/twitter/heart.png?v=#{Emoji::EMOJI_VERSION}' title=':heart:' class='emoji' alt=':heart:' loading='lazy' width='20' height='20'>"html = "<img src='http://cnn.com/a.gif'> Hello world #{emoji_image}"@@ -988,7 +988,7 @@ RSpec.describe PrettyText doendcontext "with emojis" do- it "should remove broken emoji" do+ it "removes broken emoji" dohtml = <<~HTML<img src=\"//localhost:3000/images/emoji/twitter/bike.png?v=#{Emoji::EMOJI_VERSION}\" title=\":bike:\" class=\"emoji\" alt=\":bike:\" loading=\"lazy\" width=\"20\" height=\"20\"> <img src=\"//localhost:3000/images/emoji/twitter/cat.png?v=#{Emoji::EMOJI_VERSION}\" title=\":cat:\" class=\"emoji\" alt=\":cat:\" loading=\"lazy\" width=\"20\" height=\"20\"> <img src=\"//localhost:3000/images/emoji/twitter/discourse.png?v=#{Emoji::EMOJI_VERSION}\" title=\":discourse:\" class=\"emoji\" alt=\":discourse:\" loading=\"lazy\" width=\"20\" height=\"20\">HTML@@ -1003,38 +1003,38 @@ RSpec.describe PrettyText doendend- it "should have an option to strip links" do+ it "can strip links" doexpect(PrettyText.excerpt("<a href='http://cnn.com'>cnn</a>", 100, strip_links: true)).to eq("cnn",)end- it "should preserve links" do+ it "preserves links" doexpect(PrettyText.excerpt("<a href='http://cnn.com'>cnn</a>", 100),).to match_html "<a href='http://cnn.com'>cnn</a>"end- it "should deal with special keys properly" do+ it "handles special keys" doexpect(PrettyText.excerpt("<pre><b></pre>", 100)).to eq("")end- it "should truncate stuff properly" do+ it "truncates content correctly" doexpect(PrettyText.excerpt("hello world", 5)).to eq("hello…")expect(PrettyText.excerpt("<p>hello</p><p>world</p>", 6)).to eq("hello w…")end- it "should insert a space between to Ps" do+ it "inserts a space between paragraphs" doexpect(PrettyText.excerpt("<p>a</p><p>b</p>", 5)).to eq("a b")end- it "should strip quotes" do+ it "strips quotes" doexpect(PrettyText.excerpt("<aside class='quote'><p>a</p><p>b</p></aside>boom", 5)).to eq("boom",)end- it "should not count the surrounds of a link" do+ it "does not count link markup" doexpect(PrettyText.excerpt("<a href='http://cnn.com'>cnn</a>", 3),).to match_html "<a href='http://cnn.com'>cnn</a>"@@ -1046,7 +1046,7 @@ RSpec.describe PrettyText do).to match_html "<a href='http://cnn.com'>cn...</a>"end- it "should truncate links" do+ it "truncates links" doexpect(PrettyText.excerpt("<a href='http://cnn.com'>cnn</a>", 2),).to match_html "<a href='http://cnn.com'>cn…</a>"@@ -1070,11 +1070,11 @@ RSpec.describe PrettyText doPrettyText.extract_links(text).map(&:url).to_aend- it "should be able to extract links" do+ it "extracts links" doexpect(extract_urls("<a href='http://cnn.com'>http://bla.com</a>")).to eq(["http://cnn.com"])end- it "should extract links to topics" do+ it "extracts topic links" doexpect(extract_urls("<aside class=\"quote\" data-topic=\"321\">aside</aside>")).to eq(["/t/321"],)@@ -1111,7 +1111,7 @@ RSpec.describe PrettyText doendcontext "when lazy-videos" do- it "should extract youtube url" do+ it "extracts YouTube URLs" doexpect(extract_urls("<div class=\"lazy-video-container\" data-video-id=\"yXEuEUQIP3Q\" data-video-title=\"Mister Rogers defending PBS to the US Senate\" data-provider-name=\"youtube\"></div>",@@ -1119,7 +1119,7 @@ RSpec.describe PrettyText do).to eq(["https://www.youtube.com/watch?v=yXEuEUQIP3Q"])end- it "should extract vimeo url" do+ it "extracts Vimeo URLs" doexpect(extract_urls("<div class=\"lazy-video-container\" data-video-id=\"786646692\" data-video-title=\"Dear Rich\" data-provider-name=\"vimeo\"></div>",@@ -1127,7 +1127,7 @@ RSpec.describe PrettyText do).to eq(["https://vimeo.com/786646692"])end- it "should extract tiktok url" do+ it "extracts TikTok URLs" doexpect(extract_urls("<div class=\"lazy-video-container\" data-video-id=\"6718335390845095173\" data-video-title=\"Scramble up ur name &amp; I’ll try to guess it😍❤️ #foryoupage #petsoftiktok...\" data-provider-name=\"tiktok\"></div>",@@ -1136,17 +1136,17 @@ RSpec.describe PrettyText doendend- it "should extract links to posts" do+ it "extracts post links" doexpect(extract_urls("<aside class=\"quote\" data-topic=\"1234\" data-post=\"4567\">aside</aside>"),).to eq(["/t/1234/4567"])end- it "should not extract links to anchors" do+ it "does not extract anchor links" doexpect(extract_urls("<a href='#tos'>TOS</a>")).to eq([])end- it "should not extract links inside quotes" do+ it "does not extract links inside quotes" dolinks =PrettyText.extract_links("@@ -1168,7 +1168,7 @@ RSpec.describe PrettyText do)end- it "should not extract links inside oneboxes" do+ it "does not extract links inside oneboxes" doonebox = <<~HTML<aside class="onebox twitterstatus" data-onebox-src="https://twitter.com/EDBPostgres/status/1402528437441634306"><header class="source">@@ -1186,7 +1186,7 @@ RSpec.describe PrettyText do)end- it "should not preserve tags in code blocks" do+ it "does not preserve tags in code blocks" doexpect(PrettyText.excerpt("<pre><code class='handlebars'><h3>Hours</h3></code></pre>",@@ -1195,7 +1195,7 @@ RSpec.describe PrettyText do).to eq("<h3>Hours</h3>")end- it "should handle nil" do+ it "handles nil" doexpect(PrettyText.excerpt(nil, 100)).to eq("")end@@ -1252,7 +1252,7 @@ RSpec.describe PrettyText doexpect(PrettyText.excerpt("'", 500, text_entities: true)).to eq("'")end- it "should have an option to preserve emoji images" do+ it "can preserve emoji images" doemoji_image ="<img src='/images/emoji/twitter/heart.png?v=#{Emoji::EMOJI_VERSION}' title=':heart:' class='emoji' alt=':heart:' loading='lazy' width='20' height='20'>"expect(PrettyText.excerpt(emoji_image, 100, keep_emoji_images: true)).to match_html(@@ -1260,7 +1260,7 @@ RSpec.describe PrettyText do)end- it "should have an option to remap emoji to code points" do+ it "can remap emoji to code points" doemoji_image ="I <img src='/images/emoji/twitter/heart.png?v=#{Emoji::EMOJI_VERSION}' title=':heart:' class='emoji' alt=':heart:' loading='lazy' width='20' height='20'> you <img src='/images/emoji/twitter/heart.png?v=#{Emoji::EMOJI_VERSION}' title=':unknown:' class='emoji' alt=':unknown:' loading='lazy' width='20' height='20'> "expect(PrettyText.excerpt(emoji_image, 100, remap_emoji: true)).to match_html(@@ -1268,14 +1268,14 @@ RSpec.describe PrettyText do)end- it "should have an option to preserve emoji codes" do+ it "can preserve emoji codes" doemoji_code ="<img src='/images/emoji/twitter/heart.png?v=#{Emoji::EMOJI_VERSION}' title=':heart:' class='emoji' alt=':heart:' loading='lazy' width='20' height='20'>"expect(PrettyText.excerpt(emoji_code, 100)).to eq(":heart:")endcontext "with option to preserve onebox source" do- it "should return the right excerpt" do+ it "returns the expected excerpt" doonebox ="<aside class=\"onebox allowlistedgeneric\">\n <header class=\"source\">\n <a href=\"https://meta.discourse.org/t/infrequent-translation-updates-in-stable-branch/31213/9\">meta.discourse.org</a>\n </header>\n <article class=\"onebox-body\">\n <img src=\"https://cdn-enterprise.discourse.org/meta/user_avatar/meta.discourse.org/gerhard/200/70381_1.png\" width=\"\" height=\"\" class=\"thumbnail\">\n\n<h3><a href=\"https://meta.discourse.org/t/infrequent-translation-updates-in-stable-branch/31213/9\">Infrequent translation updates in stable branch</a></h3>\n\n<p>Well, there's an Italian translation for \"New Topic\" in beta, it's been there since November 2014 and it works here on meta. Do you have any plugins installed? Try disabling them. I'm quite confident that it's either a plugin or a site...</p>\n\n </article>\n <div class=\"onebox-metadata\">\n \n \n </div>\n <div style=\"clear: both\"></div>\n</aside>\n\n\n"expected =@@ -1288,7 +1288,7 @@ RSpec.describe PrettyText do).to eq("#{expected}\n\n#{expected}")end- it "should continue to strip quotes" do+ it "continues to strip quotes" doexpect(PrettyText.excerpt("<aside class='quote'><p>a</p><p>b</p></aside>boom",@@ -1299,7 +1299,7 @@ RSpec.describe PrettyText doendend- it "should strip audio/video" do+ it "strips audio and video" dohtml = <<~HTML<audio controls><source src="https://awebsite.com/audio.mp3"><a href="https://awebsite.com/audio.mp3">https://awebsite.com/audio.mp3</a></source>@@ -1904,7 +1904,7 @@ RSpec.describe PrettyText do)end- it "should not treat a non emoji as an emoji" do+ it "does not treat a non-emoji as an emoji" doexpect(PrettyText.cook(":email,class_name:")).not_to include("emoji")end@@ -2126,7 +2126,7 @@ HTMLexpect(PrettyText.cook(":smile::sunny:")).to eq(expected.strip)end- it "handles emoji boundaries correctly" do+ it "handles skin-tone emoji boundaries" docooked = PrettyText.cook("a,:man:t2:,b")expected ="<p>a,<img src=\"/images/emoji/twitter/man/2.png?v=#{Emoji::EMOJI_VERSION}\" title=\":man:t2:\" class=\"emoji\" alt=\":man:t2:\" loading=\"lazy\" width=\"20\" height=\"20\">,b</p>"@@ -2144,7 +2144,7 @@ HTMLexpect(cooked.split("img").length - 1).to eq(3)end- it "handles emoji boundaries correctly" do+ it "handles translated emoji boundaries" doexpect(PrettyText.cook(",:)")).to include("emoji")expect(PrettyText.cook(":-)\n")).to include("emoji")expect(PrettyText.cook("a :)")).to include("emoji")@@ -2184,7 +2184,7 @@ HTML)end- it "won't break links by censoring them." do+ it "does not break links while censoring them" doexpect_cooked_match("The link still works. [whiz](http://www.whiz.com)",'<p>The link still works. <a href="http://www.whiz.com" rel="noopener nofollow ugc">■■■■</a></p>',@@ -2598,7 +2598,7 @@ HTMLexpect(cooked).to eq(html)end- it "should sanitize the html" do+ it "sanitizes unknown HTML elements" doexpect(PrettyText.cook("<test>alert(42)</test>")).to eq "<p>alert(42)</p>"end@@ -2613,15 +2613,15 @@ HTML)end- it "should not onebox magically linked urls" do+ it "does not onebox magically linked URLs" doexpect(PrettyText.cook("[url]site.com[/url]")).not_to include("onebox")end- it "should sanitize the html" do+ it "sanitizes HTML attributes" doexpect(PrettyText.cook("<p class='hi'>hi</p>")).to eq "<p>hi</p>"end- it "should strip SCRIPT" do+ it "strips script elements" doexpect(PrettyText.cook("<script>alert(42)</script>")).to eq ""expect(PrettyText.cook("<div><script>alert(42)</script></div>")).to eq "<div></div>"@@ -2635,7 +2635,7 @@ HTML).to eq "<div></div>"end- it "should allow sanitize bypass" do+ it "allows sanitization to be bypassed" doexpect(PrettyText.cook("<test>alert(42)</test>", sanitize: false),).to eq "<p><test>alert(42)</test></p>"diff --git a/spec/lib/rate_limiter/limit_exceeded_spec.rb b/spec/lib/rate_limiter/limit_exceeded_spec.rbindex a9cfa38649f..77c239f8042 100644--- a/spec/lib/rate_limiter/limit_exceeded_spec.rb+++ b/spec/lib/rate_limiter/limit_exceeded_spec.rb@@ -2,7 +2,7 @@RSpec.describe RateLimiter::LimitExceeded dodescribe "#description" do- it "should return the right description" do+ it "returns the rate-limit description" do[[3, I18n.t("rate_limiter.short_time")],[59, I18n.t("rate_limiter.seconds", count: 59)],diff --git a/spec/lib/rate_limiter_spec.rb b/spec/lib/rate_limiter_spec.rbindex 4db2905b51e..9cbe9a6f2e4 100644--- a/spec/lib/rate_limiter_spec.rb+++ b/spec/lib/rate_limiter_spec.rb@@ -22,7 +22,7 @@ RSpec.describe RateLimiter dorate_limiter.performed!end- it "should be disabled" do+ it "is disabled" doexpect(RateLimiter.disabled?).to eq(true)end@@ -108,7 +108,7 @@ RSpec.describe RateLimiter doendcontext "when never done" do- it "should perform right away" do+ it "allows performing immediately" doexpect(rate_limiter.can_perform?).to eq(true)end@@ -128,7 +128,7 @@ RSpec.describe RateLimiter doendcontext "when max is less than or equal to zero" do- it "should raise the right error" do+ it "rejects nonpositive and missing limits" do[-1, 0, nil].each do |max|expect do RateLimiter.new(user, "a", max, 60).performed! end.to raise_error(RateLimiter::LimitExceeded,diff --git a/spec/lib/retrieve_title_spec.rb b/spec/lib/retrieve_title_spec.rbindex 74815cbdf9f..cec5180c8d4 100644--- a/spec/lib/retrieve_title_spec.rb+++ b/spec/lib/retrieve_title_spec.rb@@ -2,19 +2,19 @@RSpec.describe RetrieveTitle dodescribe ".extract_title" do- it "will extract the value from the title tag" do+ it "extracts the title tag's value" dotitle = RetrieveTitle.extract_title("<html><title>My Cool Title</title></html>")expect(title).to eq("My Cool Title")end- it "will strip whitespace" do+ it "strips surrounding whitespace" dotitle = RetrieveTitle.extract_title("<html><title> Another Title\n\n </title></html>")expect(title).to eq("Another Title")end- it "will pick og:title if title is missing" do+ it "uses og:title when the title tag is missing" dotitle = RetrieveTitle.extract_title(<<~HTML)<html><meta property="og:title" content="Good Title"@@ -24,7 +24,7 @@ RSpec.describe RetrieveTitle doexpect(title).to eq("Good Title")end- it "will prefer the title over the opengraph tag" do+ it "prefers the title tag over og:title" dotitle = RetrieveTitle.extract_title(<<~HTML)<html><title>Good Title</title>@@ -35,7 +35,7 @@ RSpec.describe RetrieveTitle doexpect(title).to eq("Good Title")end- it "will parse a YouTube url from javascript" do+ it "parses a YouTube URL from JavaScript" dotitle = RetrieveTitle.extract_title(<<~HTML)<html><title>YouTube</title>@@ -45,7 +45,7 @@ RSpec.describe RetrieveTitle doexpect(title).to eq("Video Title")end- it "will not exception out for invalid html" do+ it "handles invalid HTML" doattributes = (1..1000).map { |x| " attr#{x}='1' " }.jointitle = RetrieveTitle.extract_title <<~HTML<html>@@ -190,13 +190,13 @@ RSpec.describe RetrieveTitle doexpect(RetrieveTitle.crawl("https://example.com")).to eq(nil)end- it "it raises errors other than Net::ReadTimeout, e.g. NoMethodError" do+ it "raises errors other than Net::ReadTimeout" dostub_request(:get, "https://example.com").to_raise(NoMethodError)expect { RetrieveTitle.crawl("https://example.com") }.to raise_error(NoMethodError)end- it "it ignores Net::ReadTimeout errors" do+ it "ignores Net::ReadTimeout errors" dostub_request(:get, "https://example.com").to_raise(Net::ReadTimeout)expect(RetrieveTitle.crawl("https://example.com")).to eq(nil)diff --git a/spec/lib/s3_helper_spec.rb b/spec/lib/s3_helper_spec.rbindex 2a142279ffa..0c20b77638a 100644--- a/spec/lib/s3_helper_spec.rb+++ b/spec/lib/s3_helper_spec.rb@@ -77,7 +77,7 @@ RSpec.describe "S3Helper" doendend- it "should prefix bucket folder path only if not exists" do+ it "prefixes the bucket folder path only when it is missing" dos3_helper = S3Helper.new("bucket/folder_path", "", client: client)object1 = s3_helper.object("original/1X/def.xyz")@@ -86,7 +86,7 @@ RSpec.describe "S3Helper" doexpect(object1.key).to eq(object2.key)end- it "should not prefix the bucket folder path if the key begins with the temporary upload prefix" do+ it "does not prefix keys that begin with the temporary upload prefix" dos3_helper = S3Helper.new("bucket/folder_path", "", client: client)object1 = s3_helper.object("original/1X/def.xyz")@@ -241,7 +241,7 @@ RSpec.describe "S3Helper" dodescribe "#delete_objects" dolet(:s3_helper) { S3Helper.new("test-bucket", "", client: client) }- it "works" do+ it "deletes the object from S3" do# The S3::Client with `stub_responses: true` includes validation of requests.# If the request were invalid, this spec would raise an errors3_helper.delete_objects(%w[object/one.txt object/two.txt])diff --git a/spec/lib/s3_inventory_spec.rb b/spec/lib/s3_inventory_spec.rbindex 333cfcd0062..091e11564f6 100644--- a/spec/lib/s3_inventory_spec.rb+++ b/spec/lib/s3_inventory_spec.rb@@ -19,13 +19,13 @@ RSpec.describe S3Inventory doinventory.stubs(:cleanup!)end- it "should raise error if an inventory file is not found" do+ it "raises an error when an inventory file is missing" doinventory.s3_client.stub_responses(:list_objects, contents: [])output = capture_stdout { inventory.backfill_etags_and_list_missing }expect(output).to eq("Failed to list inventory from S3\n")end- it "should forward custom s3 options to the S3Helper when initializing" do+ it "forwards custom S3 options to S3Helper during initialization" doinventory =S3Inventory.new(:upload,@@ -75,7 +75,7 @@ RSpec.describe S3Inventory doinventory.expects(:inventory_date).times(2).returns(Time.now)end- it "should display missing uploads correctly" do+ it "displays missing uploads correctly" dooutput = capture_stdout { inventory.backfill_etags_and_list_missing }expect(output).to eq(@@ -84,7 +84,7 @@ RSpec.describe S3Inventory doexpect(Discourse.stats.get("missing_s3_uploads")).to eq(6)end- it "should detect when a url match exists with a different etag" do+ it "detects a URL match with a different ETag" doupload_with_differing_tag_1 = Upload.find_by(etag: "defcaac0b4aca535c284e95f30d608d0")upload_with_differing_tag_1.update_columns(etag: "somethingelse")@@ -140,7 +140,7 @@ RSpec.describe S3Inventory doendend- it "should backfill etags to uploads table correctly" do+ it "backfills ETags in the uploads table" dofiles = [["#{Discourse.store.absolute_base_url}/uploads/default/original/1X/0184537a4f419224404d013414e913a4f56018f2.jpg",@@ -176,7 +176,7 @@ RSpec.describe S3Inventory doBackupMetadata.update_last_restore_date(Time.now)end- it "should run if inventory files are at least #{described_class::WAIT_AFTER_RESTORE_DAYS.days} days older than the last restore date" do+ it "runs when inventory files are old enough relative to the last restore" doinventory.s3_client.stub_responses(:list_objects_v2,{@@ -196,7 +196,7 @@ RSpec.describe S3Inventory docapture_stdout { inventory.backfill_etags_and_list_missing }end- it "should not run if inventory files are not at least #{described_class::WAIT_AFTER_RESTORE_DAYS.days} days older than the last restore date and reset stats count" do+ it "does not run for newer inventory files and resets the statistics count" doDiscourse.stats.set("missing_s3_uploads", 2)inventory.s3_client.stub_responses(@@ -220,7 +220,7 @@ RSpec.describe S3Inventory doendend- it "should work when passed preloaded data" do+ it "uses preloaded data when provided" dofreeze_timeCSV.foreach(csv_filename, headers: false) do |row|diff --git a/spec/lib/schema_settings_object_validator_spec.rb b/spec/lib/schema_settings_object_validator_spec.rbindex 24bebb0611f..827735c0b57 100644--- a/spec/lib/schema_settings_object_validator_spec.rb+++ b/spec/lib/schema_settings_object_validator_spec.rb@@ -63,7 +63,7 @@ RSpec.describe SchemaSettingsObjectValidator doenddescribe ".validate_objects" do- it "should return the right array of humanized error messages for objects that are invalid" do+ it "returns humanized error messages for invalid objects" doschema = {name: "section",properties: {@@ -133,7 +133,7 @@ RSpec.describe SchemaSettingsObjectValidator doenddescribe "#validate" do- it "should return the right hash of error messages when properties are required but missing" do+ it "returns errors when required properties are missing" doschema = {name: "section",properties: {@@ -231,13 +231,13 @@ RSpec.describe SchemaSettingsObjectValidator dopropertyend- it "should not return any error messages when the value of the property is in the enum" do+ it "returns no errors when the value is in the enum" doexpect(described_class.new(schema: schema, object: { enum_property: "choice 1" }).validate,).to eq({})end- it "should return the right hash of error messages when value of property is not in the enum" do+ it "returns errors when the value is not in the enum" doerrors =described_class.new(schema: schema, object: { enum_property: "random_value" }).validate@@ -248,11 +248,11 @@ RSpec.describe SchemaSettingsObjectValidator do)end- it "should not return any error messages when enum property is not present but is not required" do+ it "returns no errors when an optional enum property is missing" doexpect(described_class.new(schema: schema(required: false), object: {}).validate).to eq({})end- it "should return the right hash of error messages when enum property is not present and is required" do+ it "returns errors when a required enum property is missing" doerrors = described_class.new(schema: schema(required: true), object: {}).validateexpect(errors.keys).to eq(["/enum_property"])@@ -264,7 +264,7 @@ RSpec.describe SchemaSettingsObjectValidator docontext "for boolean properties" dolet(:schema) { { name: "section", properties: { boolean_property: { type: "boolean" } } } }- it "should not return any error messages when the value of the property is of type boolean" do+ it "returns no errors for a boolean value" doexpect(described_class.new(schema: schema, object: { boolean_property: true }).validate,).to eq({})@@ -274,7 +274,7 @@ RSpec.describe SchemaSettingsObjectValidator do).to eq({})end- it "should return the right hash of error messages when value of property is not of type boolean" do+ it "returns errors for a non-boolean value" doerrors =described_class.new(schema: schema, object: { boolean_property: "string" }).validate@@ -286,7 +286,7 @@ RSpec.describe SchemaSettingsObjectValidator docontext "for float properties" dolet(:schema) { { name: "section", properties: { float_property: { type: "float" } } } }- it "should not return any error messages when the value of the property is of type integer or float" do+ it "returns no errors for an integer or float value" doexpect(described_class.new(schema: schema, object: { float_property: 1.5 }).validate).to eq({},)@@ -296,11 +296,11 @@ RSpec.describe SchemaSettingsObjectValidator do)end- it "should not return any error messages when the value is not present and it's not required in the schema" do+ it "returns no errors when an optional value is missing" doexpect(described_class.new(schema: schema, object: {}).validate).to eq({})end- it "should return the right hash of error messages when value of property is not present and it's required" do+ it "returns errors when a required value is missing" doschema = {name: "section",properties: {@@ -316,14 +316,14 @@ RSpec.describe SchemaSettingsObjectValidator doexpect(errors["/float_property"].full_messages).to contain_exactly("must be present")end- it "should return the right hash of error messages when value of property is not of type float" do+ it "returns errors for a non-float value" doerrors = described_class.new(schema: schema, object: { float_property: "string" }).validateexpect(errors.keys).to eq(["/float_property"])expect(errors["/float_property"].full_messages).to contain_exactly("must be a float")end- it "should return the right hash of error messages when integer property does not satisfy min or max validations" do+ it "returns errors when the number fails minimum or maximum validation" doschema = {name: "section",properties: {@@ -358,17 +358,17 @@ RSpec.describe SchemaSettingsObjectValidator docontext "for integer properties" dolet(:schema) { { name: "section", properties: { integer_property: { type: "integer" } } } }- it "should not return any error messages when the value of the property is of type integer" do+ it "returns no errors for an integer value" doexpect(described_class.new(schema: schema, object: { integer_property: 1 }).validate).to eq({},)end- it "should not return any error messages when the value is not present and it's not required in the schema" do+ it "returns no errors when the optional integer is missing" doexpect(described_class.new(schema: schema, object: {}).validate).to eq({})end- it "should return the right hash of error messages when value of property is not present and it's required" do+ it "returns errors when the required integer is missing" doschema = {name: "section",properties: {@@ -384,7 +384,7 @@ RSpec.describe SchemaSettingsObjectValidator doexpect(errors["/integer_property"].full_messages).to contain_exactly("must be present")end- it "should return the right hash of error messages when value of property is not of type integer" do+ it "returns errors for a non-integer value" doerrors =described_class.new(schema: schema, object: { integer_property: "string" }).validate@@ -397,7 +397,7 @@ RSpec.describe SchemaSettingsObjectValidator doexpect(errors["/integer_property"].full_messages).to contain_exactly("must be an integer")end- it "should not return any error messages when the value of the integer property satisfies min and max validations" do+ it "returns no errors when the integer satisfies range validation" doschema = {name: "section",properties: {@@ -416,7 +416,7 @@ RSpec.describe SchemaSettingsObjectValidator do)end- it "should return the right hash of error messages when integer property does not satisfy min or max validations" do+ it "returns errors when the integer fails range validation" doschema = {name: "section",properties: {@@ -451,17 +451,17 @@ RSpec.describe SchemaSettingsObjectValidator docontext "for string properties" dolet(:schema) { { name: "section", properties: { string_property: { type: "string" } } } }- it "should not return any error messages when the value of the property is of type string" do+ it "returns no errors for a string value" doexpect(described_class.new(schema: schema, object: { string_property: "string" }).validate,).to eq({})end- it "should not return any error messages when the value is not present and it's not required in the schema" do+ it "returns no errors when the optional string is missing" doexpect(described_class.new(schema: schema, object: {}).validate).to eq({})end- it "should return the right hash of error messages when value of property is not present and it's required" do+ it "returns errors when the required string is missing" doschema = {name: "section",properties: {@@ -477,7 +477,7 @@ RSpec.describe SchemaSettingsObjectValidator doexpect(errors["/string_property"].full_messages).to contain_exactly("must be present")end- it "should return the right hash of error messages when value of property is not of type string" do+ it "returns errors for a non-string value" doschema = { name: "section", properties: { string_property: { type: "string" } } }errors = described_class.new(schema: schema, object: { string_property: 1 }).validate@@ -485,7 +485,7 @@ RSpec.describe SchemaSettingsObjectValidator doexpect(errors["/string_property"].full_messages).to contain_exactly("must be a string")end- it "should not return an empty hash when string property satisfy url validation" do+ it "returns no errors when the string is a valid URL" doschema = {name: "section",properties: {@@ -517,7 +517,7 @@ RSpec.describe SchemaSettingsObjectValidator do).to eq({})end- it "should return the right hash of error messages when string property does not statisfy url validation" do+ it "returns errors when the string is not a valid URL" doschema = {name: "section",properties: {@@ -537,7 +537,7 @@ RSpec.describe SchemaSettingsObjectValidator doexpect(errors["/string_property"].full_messages).to contain_exactly("must be a valid URL")end- it "should not return any error messages when the value of the string property satisfies min_length and max_length validations" do+ it "returns no errors when the string satisfies length validation" doschema = {name: "section",properties: {@@ -556,7 +556,7 @@ RSpec.describe SchemaSettingsObjectValidator do).to eq({})end- it "should return the right hash of error messages when string property does not satisfy min_length or max_length validations" do+ it "returns errors when the string fails length validation" doschema = {name: "section",properties: {@@ -590,7 +590,7 @@ RSpec.describe SchemaSettingsObjectValidator doendcontext "for topic properties" do- it "should not return any error message when the value of the property is a valid id of a topic record" do+ it "returns no errors for a valid topic ID" dotopic = Fabricate(:topic)schema = { name: "section", properties: { topic_property: { type: "topic" } } }@@ -600,12 +600,12 @@ RSpec.describe SchemaSettingsObjectValidator do).to eq({})end- it "should not return any error messages when the value is not present and it's not required in the schema" do+ it "returns no errors when the optional topic ID is missing" doschema = { name: "section", properties: { topic_property: { type: "topic" } } }expect(described_class.new(schema: schema, object: {}).validate).to eq({})end- it "should return the right hash of error messages when value of property is not present and it's required" do+ it "returns errors when the required topic ID is missing" doschema = {name: "section",properties: {@@ -621,7 +621,7 @@ RSpec.describe SchemaSettingsObjectValidator doexpect(errors["/topic_property"].full_messages).to contain_exactly("must be present")end- it "should return the right hash of error messages when value of property is not an integer" do+ it "returns errors when the topic ID is not an integer" doschema = { name: "section", properties: { topic_property: { type: "topic" } } }errors = described_class.new(schema: schema, object: { topic_property: "string" }).validate@@ -633,7 +633,7 @@ RSpec.describe SchemaSettingsObjectValidator do)end- it "should return the right hash of error messages when value of property is not a valid id of a topic record" do+ it "returns errors for an unknown topic ID" doschema = {name: "section",properties: {@@ -682,7 +682,7 @@ RSpec.describe SchemaSettingsObjectValidator doendcontext "for upload properties" do- it "should not return any error message when the value of the property is a valid id of a upload record" do+ it "returns no errors for a valid upload ID" doupload = Fabricate(:upload)schema = { name: "section", properties: { upload_property: { type: "upload" } } }@@ -692,12 +692,12 @@ RSpec.describe SchemaSettingsObjectValidator do).to eq({})end- it "should not return any error messages when the value is not present and it's not required in the schema" do+ it "returns no errors when the optional upload ID is missing" doschema = { name: "section", properties: { upload_property: { type: "upload" } } }expect(described_class.new(schema: schema, object: {}).validate).to eq({})end- it "should return the right hash of error messages when value of property is not present and it's required" do+ it "returns errors when the required upload ID is missing" doschema = {name: "section",properties: {@@ -713,7 +713,7 @@ RSpec.describe SchemaSettingsObjectValidator doexpect(errors["/upload_property"].full_messages).to contain_exactly("must be present")end- it "should return the right hash of error messages when value of property is not an integer" do+ it "returns errors when the upload ID is not an integer" doschema = { name: "section", properties: { upload_property: { type: "upload" } } }errors = described_class.new(schema: schema, object: { upload_property: "string" }).validate@@ -725,7 +725,7 @@ RSpec.describe SchemaSettingsObjectValidator do)end- it "should return the right hash of error messages when value is an invalid URL string" do+ it "returns errors when the upload value is an invalid URL" doschema = { name: "section", properties: { upload_property: { type: "upload" } } }errors =@@ -743,7 +743,7 @@ RSpec.describe SchemaSettingsObjectValidator do)end- it "should return the right hash of error messages when value of property is not a valid id of a upload record" do+ it "returns errors for an unknown upload ID" doschema = {name: "section",properties: {@@ -796,7 +796,7 @@ RSpec.describe SchemaSettingsObjectValidator dofab!(:tag_2, :tag)fab!(:tag_3, :tag)- it "should not return any error message when the value of the property is an array of valid tag names" do+ it "returns no errors for valid tag names" doschema = { name: "section", properties: { tags_property: { type: "tags" } } }expect(@@ -809,12 +809,12 @@ RSpec.describe SchemaSettingsObjectValidator do).to eq({})end- it "should not return any error messages when the value is not present and it's not required in the schema" do+ it "returns no errors when the optional tag list is missing" doschema = { name: "section", properties: { tags_property: { type: "tags" } } }expect(described_class.new(schema: schema, object: {}).validate).to eq({})end- it "should return the right hash of error messages when value of property is not present and it's required" do+ it "returns errors when the required tag list is missing" doschema = {name: "section",properties: {@@ -830,7 +830,7 @@ RSpec.describe SchemaSettingsObjectValidator doexpect(errors["/tags_property"].full_messages).to contain_exactly("must be present")end- it "should return the right hash of error messages when value of property is not an array of tag names" do+ it "returns errors when the tag value is not an array" doschema = { name: "section", properties: { tags_property: { type: "tags" } } }errors = described_class.new(schema: schema, object: { tags_property: "string" }).validate@@ -842,7 +842,7 @@ RSpec.describe SchemaSettingsObjectValidator do)end- it "should return the right hash of error messages when number of tag names does not satisfy min or max validations" do+ it "returns errors when the tag count fails range validation" doschema = {name: "section",properties: {@@ -879,7 +879,7 @@ RSpec.describe SchemaSettingsObjectValidator do)end- it "should return the right hash of error messages when value of property contain tag names which are invalid" do+ it "returns errors when the list contains invalid tag names" doschema = {name: "section",properties: {@@ -930,7 +930,7 @@ RSpec.describe SchemaSettingsObjectValidator doendcontext "for groups properties" do- it "should not return any error message when the value of the property is an array of valid group record ids" do+ it "returns no errors for valid group IDs" dogroup = Fabricate(:group)schema = { name: "section", properties: { groups_property: { type: "groups" } } }@@ -940,12 +940,12 @@ RSpec.describe SchemaSettingsObjectValidator do).to eq({})end- it "should not return any error messages when the value is not present and it's not required in the schema" do+ it "returns no errors when the optional group list is missing" doschema = { name: "section", properties: { groups_property: { type: "groups" } } }expect(described_class.new(schema: schema, object: {}).validate).to eq({})end- it "should return the right hash of error messages when value of property is not present and it's required" do+ it "returns errors when the required group list is missing" doschema = {name: "section",properties: {@@ -961,7 +961,7 @@ RSpec.describe SchemaSettingsObjectValidator doexpect(errors["/groups_property"].full_messages).to contain_exactly("must be present")end- it "should return the right hash of error messages when value of property is not an array of valid group ids" do+ it "returns errors when the group value is not an array of valid IDs" doschema = { name: "section", properties: { groups_property: { type: "groups" } } }errors = described_class.new(schema: schema, object: { groups_property: "string" }).validate@@ -973,7 +973,7 @@ RSpec.describe SchemaSettingsObjectValidator do)end- it "should return the right hash of error messages when number of groups ids does not satisfy min or max validations" do+ it "returns errors when the group count fails range validation" dogroup_1 = Fabricate(:group)group_2 = Fabricate(:group)group_3 = Fabricate(:group)@@ -1014,7 +1014,7 @@ RSpec.describe SchemaSettingsObjectValidator do)end- it "should return the right hash of error messages when value of property is an array containing invalid group ids" do+ it "returns errors when the list contains invalid group IDs" doschema = {name: "section",properties: {@@ -1063,7 +1063,7 @@ RSpec.describe SchemaSettingsObjectValidator doendcontext "for post properties" do- it "should not return any error message when the value of the property is a valid id of a post record" do+ it "returns no errors for a valid post ID" dopost = Fabricate(:post)schema = { name: "section", properties: { post_property: { type: "post" } } }@@ -1073,12 +1073,12 @@ RSpec.describe SchemaSettingsObjectValidator do).to eq({})end- it "should not return any error messages when the value is not present and it's not required in the schema" do+ it "returns no errors when the optional post ID is missing" doschema = { name: "section", properties: { post_property: { type: "post" } } }expect(described_class.new(schema: schema, object: {}).validate).to eq({})end- it "should return the right hash of error messages when value of property is not present and it's required" do+ it "returns errors when the required post ID is missing" doschema = {name: "section",properties: {@@ -1094,7 +1094,7 @@ RSpec.describe SchemaSettingsObjectValidator doexpect(errors["/post_property"].full_messages).to contain_exactly("must be present")end- it "should return the right hash of error messages when value of property is not an integer" do+ it "returns errors when the post ID is not an integer" doschema = { name: "section", properties: { post_property: { type: "post" } } }errors = described_class.new(schema: schema, object: { post_property: "string" }).validate@@ -1104,7 +1104,7 @@ RSpec.describe SchemaSettingsObjectValidator doexpect(errors["/post_property"].full_messages).to contain_exactly("must be a valid post id")end- it "should return the right hash of error messages when value of property is not a valid id of a post record" do+ it "returns errors for an unknown post ID" doschema = {name: "section",properties: {@@ -1156,7 +1156,7 @@ RSpec.describe SchemaSettingsObjectValidator dofab!(:category_1, :category)fab!(:category_2, :category)- it "should not return any error message when the value of the property is an array of valid category ids" do+ it "returns no errors for valid category IDs" doschema = { name: "section", properties: { category_property: { type: "categories" } } }expect(@@ -1169,12 +1169,12 @@ RSpec.describe SchemaSettingsObjectValidator do).to eq({})end- it "should not return any error messages when the value is not present and it's not required in the schema" do+ it "returns no errors when the optional category list is missing" doschema = { name: "section", properties: { category_property: { type: "categories" } } }expect(described_class.new(schema: schema, object: {}).validate).to eq({})end- it "should return the right hash of error messages when value of property is present but empty and it's required" do+ it "returns errors when the required category list is empty" doschema = {name: "section",properties: {@@ -1190,7 +1190,7 @@ RSpec.describe SchemaSettingsObjectValidator doexpect(errors["/category_property"].full_messages).to contain_exactly("must be present")end- it "should return the right hash of error messages when value of property is not present and it's required" do+ it "returns errors when the required category list is missing" doschema = {name: "section",properties: {@@ -1206,7 +1206,7 @@ RSpec.describe SchemaSettingsObjectValidator doexpect(errors["/category_property"].full_messages).to contain_exactly("must be present")end- it "should return the right hash of error messages when value of property contains an array where not all values are integers" do+ it "returns errors when the category list contains non-integers" doschema = { name: "section", properties: { category_property: { type: "categories" } } }errors =@@ -1219,7 +1219,7 @@ RSpec.describe SchemaSettingsObjectValidator do)end- it "should return the right hash of error messages when number of category ids does not satisfy min or max validations" do+ it "returns errors when the category count fails range validation" doschema = {name: "section",properties: {@@ -1242,7 +1242,7 @@ RSpec.describe SchemaSettingsObjectValidator do)end- it "should return the right hash of error messages when value of property is not an array of valid category ids" do+ it "returns errors when the category list contains invalid IDs" doschema = {name: "section",properties: {@@ -1304,7 +1304,7 @@ RSpec.describe SchemaSettingsObjectValidator docontext "for datetime properties" dolet(:schema) { { name: "section", properties: { datetime_property: { type: "datetime" } } } }- it "should not return any error messages when the value of the property is a valid UTC datetime" do+ it "returns no errors for a valid UTC datetime" doexpect(described_class.new(schema: schema,@@ -1324,7 +1324,7 @@ RSpec.describe SchemaSettingsObjectValidator do).to eq({})end- it "should not return any error messages when the value is an ISO 8601 datetime with timezone offset" do+ it "returns no errors for an ISO 8601 datetime with a timezone offset" doexpect(described_class.new(schema: schema,@@ -1335,17 +1335,17 @@ RSpec.describe SchemaSettingsObjectValidator do).to eq({})end- it "should not return any error messages when the value is not present and it's not required in the schema" do+ it "returns no errors when the optional datetime is missing" doexpect(described_class.new(schema: schema, object: {}).validate).to eq({})end- it "should not return any error messages when the value is an empty string and it's not required" do+ it "returns no errors when the optional datetime is blank" doexpect(described_class.new(schema: schema, object: { datetime_property: "" }).validate,).to eq({})end- it "should return the right hash of error messages when value of property is not present and it's required" do+ it "returns errors when the required datetime is missing" doschema = {name: "section",properties: {@@ -1361,7 +1361,7 @@ RSpec.describe SchemaSettingsObjectValidator doexpect(errors["/datetime_property"].full_messages).to contain_exactly("must be present")end- it "should return the right hash of error messages when value of property is not a valid datetime" do+ it "returns errors for an invalid datetime" doerrors =described_class.new(schema: schema,@@ -1376,7 +1376,7 @@ RSpec.describe SchemaSettingsObjectValidator do)end- it "should return the right hash of error messages when value is a date-only string" do+ it "returns errors for a date-only string" doerrors =described_class.new(schema: schema, object: { datetime_property: "2024-12-29" }).validate@@ -1386,7 +1386,7 @@ RSpec.describe SchemaSettingsObjectValidator do)end- it "should return the right hash of error messages when value is datetime without timezone" do+ it "returns errors for a datetime without a timezone" doerrors =described_class.new(schema: schema,@@ -1401,7 +1401,7 @@ RSpec.describe SchemaSettingsObjectValidator do)end- it "should return the right hash of error messages when value of property is not a string" do+ it "returns errors when the datetime is not a string" doerrors = described_class.new(schema: schema, object: { datetime_property: 123 }).validateexpect(errors.keys).to eq(["/datetime_property"])@@ -1414,17 +1414,17 @@ RSpec.describe SchemaSettingsObjectValidator docontext "for icon properties" dolet(:schema) { { name: "section", properties: { icon_property: { type: "icon" } } } }- it "should not return any error messages when the value of the property is of type string" do+ it "returns no errors for an icon string" doexpect(described_class.new(schema: schema, object: { icon_property: "heart" }).validate,).to eq({})end- it "should not return any error messages when the value is not present and it's not required in the schema" do+ it "returns no errors when the optional icon is missing" doexpect(described_class.new(schema: schema, object: {}).validate).to eq({})end- it "should return the right hash of error messages when value of property is not present and it's required" do+ it "returns errors when the required icon is missing" doschema = {name: "section",properties: {@@ -1440,7 +1440,7 @@ RSpec.describe SchemaSettingsObjectValidator doexpect(errors["/icon_property"].full_messages).to contain_exactly("must be present")end- it "should return the right hash of error messages when value of property is not of type icon" do+ it "returns errors for an invalid icon" doerrors = described_class.new(schema: schema, object: { icon_property: 1 }).validateexpect(errors.keys).to eq(["/icon_property"])diff --git a/spec/lib/score_calculator_spec.rb b/spec/lib/score_calculator_spec.rbindex db24c7dbe2c..21602d3fdde 100644--- a/spec/lib/score_calculator_spec.rb+++ b/spec/lib/score_calculator_spec.rb@@ -30,7 +30,7 @@ RSpec.describe ScoreCalculator doenddescribe "summary" do- it "won't update the site settings when the site settings don't match" do+ it "leaves the summary flag unset when the topic does not qualify" doScoreCalculator.new(reads: 3).calculatetopic.reloadexpect(topic.has_summary).to eq(false)@@ -56,7 +56,7 @@ RSpec.describe ScoreCalculator doexpect(topic.has_summary).to eq(true)end- it "won't update the site settings when the site settings don't match" do+ it "sets the summary flag when the topic meets the configured thresholds" doSiteSetting.expects(:summary_likes_required).returns(0)SiteSetting.expects(:summary_posts_required).returns(1)SiteSetting.expects(:summary_score_threshold).returns(100)diff --git a/spec/lib/scss_checker_spec.rb b/spec/lib/scss_checker_spec.rbindex 84345c5eb04..7602de0da05 100644--- a/spec/lib/scss_checker_spec.rb+++ b/spec/lib/scss_checker_spec.rb@@ -4,7 +4,7 @@ RSpec.describe Stylesheet::Manager::ScssChecker dofab!(:theme)describe "#has_scss" do- it "should return true when theme has scss" do+ it "returns true when the theme has SCSS" doscss_theme = Fabricate(:theme, component: true)scss_theme.set_field(target: :common, name: "scss", value: ".scss{color: red;}")scss_theme.save!@@ -30,7 +30,7 @@ RSpec.describe Stylesheet::Manager::ScssChecker doexpect(embedded_theme_checker.has_scss(embedded_scss_theme.id)).to eq(true)end- it "should return false when theme does not have scss" do+ it "returns false when the theme does not have SCSS" doexpect(described_class.new(:desktop_theme, [theme.id]).has_scss(theme.id)).to eq(false)endenddiff --git a/spec/lib/search_spec.rb b/spec/lib/search_spec.rbindex c61c2d5c6b9..718ddbc3307 100644--- a/spec/lib/search_spec.rb+++ b/spec/lib/search_spec.rb@@ -168,7 +168,7 @@ RSpec.describe Search doafter { SearchIndexer.disable }- it "should apply the custom ranking weights correctly" do+ it "applies the custom ranking weights" doexpect(Search.execute("start").posts).to eq([post2, post1])SiteSetting.search_ranking_weights = "{0.00001,0.2,0.4,1.0}"@@ -271,21 +271,21 @@ RSpec.describe Search dobefore { SearchIndexer.index(suspended_user, force: true) }- it "should list suspended users to regular users if the setting is enabled" do+ it "lists suspended users to regular users when enabled" doSiteSetting.enable_listing_suspended_users_on_search = trueresult = Search.execute("revolver_ocelot", guardian: Guardian.new(user))expect(result.users).to contain_exactly(suspended_user)end- it "shouldn't list suspended users to regular users if the setting is disabled" do+ it "hides suspended users from regular users when disabled" doSiteSetting.enable_listing_suspended_users_on_search = falseresult = Search.execute("revolver_ocelot", guardian: Guardian.new(user))expect(result.users).to be_emptyend- it "should list suspended users to admins regardless of the setting" do+ it "lists suspended users to admins regardless of the setting" doSiteSetting.enable_listing_suspended_users_on_search = falseresult = Search.execute("revolver_ocelot", guardian: Guardian.new(Fabricate(:admin)))@@ -352,7 +352,7 @@ RSpec.describe Search doendend- describe "categories" do+ describe "nested category filters" doit "finds topics in sub-sub-categories" doSiteSetting.max_category_nesting = 3@@ -401,7 +401,7 @@ RSpec.describe Search doendlet!(:post2) { Fabricate(:post, topic: topic, user: user) }- it "should index correctly" do+ it "indexes the post's searchable text" dosearch_data = post.post_search_data.search_dataexpect(search_data).to match(/fun/)@@ -415,7 +415,7 @@ RSpec.describe Search doexpect(post.post_search_data.reload.search_data).to match(/harpi/)end- it "should update posts index when topic category changes" do+ it "updates the post index when the topic's category changes" doexpect do topic.update!(category: Fabricate(:category)) end.to change {post.reload.post_search_data.version}.from(SearchIndexer::POST_INDEX_VERSION).to(SearchIndexer::REINDEX_VERSION).and change {@@ -423,7 +423,7 @@ RSpec.describe Search do}.from(SearchIndexer::POST_INDEX_VERSION).to(SearchIndexer::REINDEX_VERSION)end- it "should update posts index when topic tags changes" do+ it "updates the post index when the topic's tags change" doSiteSetting.tagging_enabled = truetag = Fabricate(:tag)@@ -446,7 +446,7 @@ RSpec.describe Search do@indexed = @user.user_search_data.search_dataend- it "should pick up on data" do+ it "indexes the user's name" doexpect(@indexed).to match(/fred/)expect(@indexed).to match(/jone/)end@@ -459,11 +459,11 @@ RSpec.describe Search dolet!(:post2) { Fabricate(:post, topic: topic) }let!(:post3) { Fabricate(:post) }- it "should index correctly" do+ it "indexes the category name" doexpect(category.category_search_data.search_data).to match(/america/)end- it "should update posts index when category name changes" do+ it "updates the post index when the category name changes" doexpect do category.update!(name: "some new name") end.to change {post.reload.post_search_data.version}.from(SearchIndexer::POST_INDEX_VERSION).to(SearchIndexer::REINDEX_VERSION).and change {@@ -577,7 +577,7 @@ RSpec.describe Search doexpect { Search.execute("evil trout") }.not_to raise_errorend- describe "users" do+ describe "user type filter" dolet!(:user) { Fabricate(:user) }let(:result) { Search.execute("bruce", type_filter: "user") }@@ -1661,7 +1661,7 @@ RSpec.describe Search doexpect(search.posts.map(&:id)).to contain_exactly(post2.id, child_post.id)end- it "should return the right categories" do+ it "returns matching categories and filters posts by category" dosearch = Search.execute("monkey")expect(search.categories).to contain_exactly(category, ignored_category)@@ -1733,7 +1733,7 @@ RSpec.describe Search dodescribe "categories with different priorities" dolet(:category2) { Fabricate(:category_with_definition) }- it "should return posts in the right order" do+ it "returns posts in ranked order" doraw = "The pure genuine evian"post = Fabricate(:post, topic: category.topic, raw: raw)post2 = Fabricate(:post, topic: category2.topic, raw: raw)@@ -2310,7 +2310,7 @@ RSpec.describe Search dolet!(:post) { Fabricate(:post, raw: "hi this is a test 123 123", topic: topic, user: user) }let!(:post_2) { Fabricate(:post, user: user_2) }- it "should not return any posts if group does not exist" do+ it "returns no posts if the group does not exist" dogroup.update!(visibility_level: Group.visibility_levels[:public],members_visibility_level: Group.visibility_levels[:public],@@ -2319,7 +2319,7 @@ RSpec.describe Search doexpect(Search.execute("group:99999").posts).to eq([])end- it "should return the right posts for a public group" do+ it "returns matching posts for a public group" dogroup.update!(visibility_level: Group.visibility_levels[:public],members_visibility_level: Group.visibility_levels[:public],@@ -2329,7 +2329,7 @@ RSpec.describe Search doexpect(Search.execute("group:#{group.id}").posts).to contain_exactly(post)end- it "should return the right posts for a public group with members' visibility restricted to logged on users" do+ it "respects member visibility for a public group" dogroup.update!(visibility_level: Group.visibility_levels[:public],members_visibility_level: Group.visibility_levels[:logged_on_users],@@ -2341,7 +2341,7 @@ RSpec.describe Search do).to contain_exactly(post)end- it "should return the right posts for a group with visibility restricted to logged on users with members' visibility restricted to members" do+ it "respects group and member visibility restrictions" dogroup.update!(visibility_level: Group.visibility_levels[:logged_on_users],members_visibility_level: Group.visibility_levels[:members],@@ -3097,7 +3097,7 @@ RSpec.describe Search doexpect(results.posts).to eq([])end- it "won't work for users that can't see unlisted topics" do+ it "excludes unlisted topics the user cannot see" dotopic = Fabricate(:topic, title: "I am testing a search", visible: false)_post = Fabricate(:post, topic: topic, raw: "this is the first post", post_number: 1)@@ -3341,7 +3341,7 @@ RSpec.describe Search dofab!(:group) { Fabricate(:group, name: "bruce-world-fans") }fab!(:topic) { Fabricate(:topic, title: "Bruce topic not a result") }- it "works" do+ it "returns matching users, categories, groups, and tags without posts" docategory = Fabricate(:category_with_definition, name: "bruceland", user: user)tag = Fabricate(:tag, name: "brucealicious")diff --git a/spec/lib/sidekiq/discourse_event_spec.rb b/spec/lib/sidekiq/discourse_event_spec.rbindex 7febd368202..a10142c052d 100644--- a/spec/lib/sidekiq/discourse_event_spec.rb+++ b/spec/lib/sidekiq/discourse_event_spec.rb@@ -2,7 +2,7 @@RSpec.describe Sidekiq::DiscourseEvent dodescribe "#call" do- it "should trigger the `sidekiq_job_ran` discourse event when successfully executing the block" do+ it "triggers sidekiq_job_ran after the block succeeds" docalled = falseevents =@@ -24,7 +24,7 @@ RSpec.describe Sidekiq::DiscourseEvent doexpect(event[:params][3]).to be_a(Float)end- it "should trigger `sidekiq_job_error` discourse event when an error occurs while executing the block" do+ it "triggers sidekiq_job_error when the block raises an error" docalled = falseevents =diff --git a/spec/lib/signal_trap_logger_spec.rb b/spec/lib/signal_trap_logger_spec.rbindex 634e4a028ec..372323e65ec 100644--- a/spec/lib/signal_trap_logger_spec.rb+++ b/spec/lib/signal_trap_logger_spec.rb@@ -2,7 +2,7 @@RSpec.describe SignalTrapLogger dodescribe "#log" do- it "should queue up messages to be logged which will then be logged by the logging thread" do+ it "queues messages for the logging thread" dofake_logger = FakeLogger.newSignalTrapLogger.instance.log(fake_logger, "message 1", level: :error)diff --git a/spec/lib/site_setting_extension_spec.rb b/spec/lib/site_setting_extension_spec.rbindex 727b327dd5c..6a5fc6f717e 100644--- a/spec/lib/site_setting_extension_spec.rb+++ b/spec/lib/site_setting_extension_spec.rb@@ -72,7 +72,7 @@ RSpec.describe SiteSettingExtension dosettings.refresh!end- it "will reset to default if provider vanishes" do+ it "resets to the default if the provider vanishes" dosettings.setting(:hello, 1)settings.hello = 100expect(settings.hello).to eq(100)@@ -83,7 +83,7 @@ RSpec.describe SiteSettingExtension doexpect(settings.hello).to eq(1)end- it "will set to new value if provider changes" do+ it "uses the new value if the provider changes" dosettings.setting(:hello, 1)settings.hello = 100expect(settings.hello).to eq(100)@@ -244,11 +244,11 @@ RSpec.describe SiteSettingExtension dosettings.refresh!end- it "should have a key in all_settings" do+ it "includes the setting in all_settings" doexpect(settings.all_settings.detect { |s| s[:setting] == :test_setting }).to be_presentend- it "should have the correct desc" do+ it "interpolates the base path in the setting description" doI18n.backend.store_translations(:en,site_settings: {@@ -265,7 +265,7 @@ RSpec.describe SiteSettingExtension do)end- it "should have the correct default" do+ it "returns the integer default" doexpect(settings.test_setting).to eq(77)end@@ -274,22 +274,22 @@ RSpec.describe SiteSettingExtension dosettings.remove_override!(:test_setting)end- it "should have the correct override" do+ it "returns the overridden value" dosettings.test_setting = 100expect(settings.test_setting).to eq(100)end- it "should coerce correct string to int" do+ it "coerces a numeric string to an integer" dosettings.test_setting = "101"expect(settings.test_setting).to eq(101)end- it "should coerce incorrect string to 0" do+ it "coerces a nonnumeric string to zero" dosettings.test_setting = "pie"expect(settings.test_setting).to eq(0)end- it "should not set default when reset" do+ it "preserves the override when the setting is redefined" dosettings.test_setting = 100settings.setting(:test_setting, 77)settings.refresh!@@ -301,7 +301,7 @@ RSpec.describe SiteSettingExtension doexpect(settings.test_setting).to eq(12)end- it "should publish changes to clients" do+ it "publishes changes to clients" dosettings.setting("test_setting", 100)settings.setting("test_setting", nil, client: true)@@ -340,7 +340,7 @@ RSpec.describe SiteSettingExtension dosettings.refresh!end- it "should have the correct default" do+ it "returns the string default" doexpect(settings.test_str).to eq("str")end@@ -349,7 +349,7 @@ RSpec.describe SiteSettingExtension dosettings.remove_override!(:test_str)end- it "should coerce int to string" do+ it "coerces an integer to a string" dosettings.test_str = 100expect(settings.test_str).to eq("100")end@@ -384,29 +384,29 @@ RSpec.describe SiteSettingExtension dosettings.refresh!end- it "should have the correct default" do+ it "returns the boolean default" doexpect(settings.test_hello?).to eq(false)endcontext "when overridden" doafter { settings.remove_override!(:test_hello?) }- it "should have the correct override" do+ it "returns the overridden boolean" dosettings.test_hello = trueexpect(settings.test_hello?).to eq(true)end- it "should coerce true strings to true" do+ it "coerces true strings to true" dosettings.test_hello = "true"expect(settings.test_hello?).to be(true)end- it "should coerce all other strings to false" do+ it "coerces all other strings to false" dosettings.test_hello = "f"expect(settings.test_hello?).to be(false)end- it "should not set default when reset" do+ it "preserves the override when the setting is redefined" dosettings.test_hello = truesettings.setting(:test_hello?, false)settings.refresh!@@ -431,7 +431,7 @@ RSpec.describe SiteSettingExtension doendend- it "should coerce correctly" do+ it "coerces an enum string to an integer" dosettings.setting(:test_int_enum, 1, enum: TestIntEnumClass)settings.test_int_enum = "2"settings.refresh!@@ -462,15 +462,15 @@ RSpec.describe SiteSettingExtension dosettings.refresh!end- it "should have the correct default" do+ it "returns the enum default" doexpect(settings.test_enum).to eq("en")end- it "should not hose all_settings" do+ it "includes the enum in all_settings" doexpect(settings.all_settings.detect { |s| s[:setting] == :test_enum }).to be_presentend- it "should report error when being set other values" do+ it "rejects values outside the enum" doexpect { settings.test_enum = "not_in_enum" }.to raise_error(Discourse::InvalidParameters)end@@ -498,7 +498,7 @@ RSpec.describe SiteSettingExtension dosettings.refresh!end- it "should return the category in all_settings" do+ it "returns the category in all_settings" doexpect(settings.all_settings.find { |s| s[:setting] == :test_setting }[:category]).to eq(:tests,)@@ -509,12 +509,12 @@ RSpec.describe SiteSettingExtension dosettings.remove_override!(:test_setting)end- it "should have the correct override" do+ it "returns the overridden value" dosettings.test_setting = 101expect(settings.test_setting).to eq(101)end- it "should still have the correct category" do+ it "preserves the category after overriding the value" dosettings.test_setting = 102expect(settings.all_settings.find { |s| s[:setting] == :test_setting }[:category]).to eq(:tests,@@ -531,7 +531,7 @@ RSpec.describe SiteSettingExtension dosettings.refresh!end- it "should allow to filter by area" do+ it "filters settings by area" doexpect(settings.all_settings(filter_area: "flags").map { |s| s[:setting].to_sym }).to eq(%i[default_locale test_setting test_setting2],)@@ -679,7 +679,7 @@ RSpec.describe SiteSettingExtension doexpect(UserHistory.last.new_value).to eq("[FILTERED]")end- it "works" do+ it "updates the setting and logs its previous and new values" dosettings.set_and_log("title", "Discourse v2")expect(settings.title).to eq("Discourse v2")expect(UserHistory.last.previous_value).to eq("Discourse v1")@@ -958,7 +958,7 @@ RSpec.describe SiteSettingExtension dosettings.refresh!end- it "should not add the key to the shadowed_settings collection" do+ it "does not add the key to shadowed_settings" doexpect(settings.shadowed_settings.include?(:trout_api_key)).to eq(false)end@@ -980,7 +980,7 @@ RSpec.describe SiteSettingExtension dosettings.refresh!end- it "should return default cause nothing is set" do+ it "returns the default when no value is set" doexpect(settings.nada).to eq("nothing")endend@@ -992,11 +992,11 @@ RSpec.describe SiteSettingExtension dosettings.refresh!end- it "should return default cause nothing is set" do+ it "returns the default when no value is set" doexpect(settings.bool).to eq(false)end- it "should not trigger any message bus work if you try to set it" do+ it "does not publish MessageBus updates when assigned" dom =MessageBus.track_publish("/site_settings") dosettings.bool = true@@ -1013,16 +1013,16 @@ RSpec.describe SiteSettingExtension dosettings.refresh!end- it "should return the global setting instead of default" do+ it "returns the global setting instead of the default" doexpect(settings.trout_api_key).to eq("purringcat")end- it "should return the global setting after a refresh" do+ it "returns the global setting after a refresh" dosettings.refresh!expect(settings.trout_api_key).to eq("purringcat")end- it "should add the key to the hidden_settings collection" do+ it "adds the key to hidden_settings" doexpect(settings.hidden_settings.include?(:trout_api_key)).to eq(true)["", nil].each_with_index do |setting, index|@@ -1033,7 +1033,7 @@ RSpec.describe SiteSettingExtension doendend- it "should add the key to the shadowed_settings collection" do+ it "adds the key to shadowed_settings" doexpect(settings.shadowed_settings.include?(:trout_api_key)).to eq(true)endend@@ -1199,7 +1199,7 @@ RSpec.describe SiteSettingExtension doenddescribe "uploads settings" do- it "should return the right values" do+ it "returns upload URLs for the current and default values" donegative_upload_id = [(Upload.minimum(:id) || 0) - 1, -10].minsystem_upload = Fabricate(:upload, id: negative_upload_id)settings.setting(:logo, system_upload.id, type: :upload)@@ -1220,7 +1220,7 @@ RSpec.describe SiteSettingExtension doenddescribe "objects settings with uploads" do- it "should hydrate upload IDs to URLs" do+ it "hydrates upload IDs to URLs" doupload1 = Fabricate(:upload)upload2 = Fabricate(:upload)upload3 = Fabricate(:upload)@@ -1269,7 +1269,7 @@ RSpec.describe SiteSettingExtension doexpect(value[0]["links"][0]["link_image"]).to eq(upload3.url)end- it "should batch uploads query" do+ it "batches the uploads query" doupload1 = Fabricate(:upload)upload2 = Fabricate(:upload)upload3 = Fabricate(:upload)@@ -1346,7 +1346,7 @@ RSpec.describe SiteSettingExtension doenddescribe ".client_settings_json_uncached" do- it "should return the right json value" do+ it "serializes client settings and upload URLs as JSON" doupload = Fabricate(:upload)settings.setting(:upload_type, upload.id.to_s, type: :upload, client: true)settings.setting(:string_type, "haha", client: true)@@ -1452,7 +1452,7 @@ RSpec.describe SiteSettingExtension dofab!(:upload)fab!(:upload2, :upload)- it "should return the upload record" do+ it "returns the upload record" dosettings.setting(:some_upload, upload.id.to_s, type: :upload)expect(settings.some_upload).to eq(upload)diff --git a/spec/lib/site_settings/type_supervisor_spec.rb b/spec/lib/site_settings/type_supervisor_spec.rbindex 3186ec9fc0c..36b5b76c507 100644--- a/spec/lib/site_settings/type_supervisor_spec.rb+++ b/spec/lib/site_settings/type_supervisor_spec.rb@@ -495,7 +495,7 @@ RSpec.describe SiteSettings::TypeSupervisor doexpect(settings.type_supervisor.to_rb_value(:type_custom, "2|3")).to eq "2|3"end- it "should not modify the types of settings" do+ it "does not modify setting types" dotypes = SiteSettings::TypeSupervisor.typessettings.type_supervisor.to_rb_value(:default_locale, "fr", types[:enum])expect(settings.type_supervisor.to_db_value(:default_locale, "en")).to eq(@@ -511,7 +511,7 @@ RSpec.describe SiteSettings::TypeSupervisor dosettings.setting(:type_upload, "", type: :upload)end- it "should return the right type that has been registered" do+ it "returns the registered type" doexpect(settings.type_supervisor.get_type(:type_null)).to eq(:null)expect(settings.type_supervisor.get_type(:type_upload)).to eq(:upload)enddiff --git a/spec/lib/site_settings/validations_spec.rb b/spec/lib/site_settings/validations_spec.rbindex 3f3a050e527..1bdd3e0165b 100644--- a/spec/lib/site_settings/validations_spec.rb+++ b/spec/lib/site_settings/validations_spec.rb@@ -14,7 +14,7 @@ RSpec.describe SiteSettings::Validations do}.not_to raise_errorend- it "won't allow you to input junk categories" do+ it "rejects invalid category IDs" doexpect { validations.validate_default_categories_watching("junk") }.to raise_error(Discourse::InvalidParameters,)@@ -45,22 +45,22 @@ RSpec.describe SiteSettings::Validations doSiteSetting.set(other_setting_name, value)end- it "shouldn't raise an error when both buckets are blank" do+ it "accepts two blank buckets" dochange_bucket_value("")validate("")end- it "shouldn't raise an error when only one bucket is set" do+ it "accepts a single configured bucket" dochange_bucket_value("")validate("my-awesome-bucket")end- it "shouldn't raise an error when both buckets are equal, but use a different path" do+ it "accepts the same bucket with different paths" dochange_bucket_value("my-awesome-bucket/foo")validate("my-awesome-bucket/bar")end- it "should raise an error when both buckets are equal" do+ it "rejects identical bucket locations" dochange_bucket_value("my-awesome-bucket")expect { validate("my-awesome-bucket") }.to raise_error(Discourse::InvalidParameters,@@ -68,7 +68,7 @@ RSpec.describe SiteSettings::Validations do)end- it "should raise an error when both buckets are equal except for a trailing slash" do+ it "rejects identical bucket locations with a trailing slash" dochange_bucket_value("my-awesome-bucket/")expect { validate("my-awesome-bucket") }.to raise_error(Discourse::InvalidParameters,@@ -92,7 +92,7 @@ RSpec.describe SiteSettings::Validations doit_behaves_like "s3 bucket validation"- it "shouldn't raise an error when the 's3_backup_bucket' is a subdirectory of 's3_upload_bucket'" do+ it "accepts a backup bucket below the upload bucket" doSiteSetting.s3_upload_bucket = "my-awesome-bucket"validate("my-awesome-bucket/backups")@@ -110,7 +110,7 @@ RSpec.describe SiteSettings::Validations doit_behaves_like "s3 bucket validation"- it "should raise an error when the 's3_upload_bucket' is a subdirectory of 's3_backup_bucket'" do+ it "rejects an upload bucket below the backup bucket" doSiteSetting.s3_backup_bucket = "my-awesome-bucket"expect { validate("my-awesome-bucket/uploads") }.to raise_error(Discourse::InvalidParameters,@@ -144,7 +144,7 @@ RSpec.describe SiteSettings::Validations dobefore { SiteSetting.enable_local_logins = false }- it "should raise an error" do+ it "rejects enforcement when local logins are disabled" doexpect { validations.validate_enforce_second_factor("t") }.to raise_error(Discourse::InvalidParameters,error_message,@@ -155,7 +155,7 @@ RSpec.describe SiteSettings::Validations docontext "when local logins are enabled" dobefore { SiteSetting.enable_local_logins = true }- it "should be ok" do+ it "allows enforcement with local logins enabled" doexpect { validations.validate_enforce_second_factor("t") }.not_to raise_errorendend@@ -173,7 +173,7 @@ RSpec.describe SiteSettings::Validations doSiteSetting.enable_discourse_connect = trueend- it "should raise an error" do+ it "rejects enforcement when SSO is enabled" doexpect { validations.validate_enforce_second_factor("t") }.to raise_error(Discourse::InvalidParameters,error_message,@@ -191,7 +191,7 @@ RSpec.describe SiteSettings::Validations docontext "when enforce second factor is enabled" dobefore { SiteSetting.enforce_second_factor = "all" }- it "should raise an error" do+ it "rejects disabling local logins" doexpect { validations.validate_enable_local_logins("f") }.to raise_error(Discourse::InvalidParameters,error_message,@@ -202,14 +202,14 @@ RSpec.describe SiteSettings::Validations docontext "when enforce second factor is disabled" dobefore { SiteSetting.enforce_second_factor = "no" }- it "should be ok" do+ it "allows disabling local logins" doexpect { validations.validate_enable_local_logins("f") }.not_to raise_errorendendendcontext "when the new value is true" do- it "should be ok" do+ it "allows enabling local logins" doexpect { validations.validate_enable_local_logins("t") }.not_to raise_errorendend@@ -221,7 +221,7 @@ RSpec.describe SiteSettings::Validations doendcontext "when the new value has trailing slash" do- it "should raise an error" do+ it "rejects an origin with a trailing slash" doexpect { validations.validate_cors_origins("https://www.rainbows.com/") }.to raise_error(Discourse::InvalidParameters,error_message,@@ -303,7 +303,7 @@ RSpec.describe SiteSettings::Validations docontext "when s3 uploads are not already globally enabled" dobefore { GlobalSetting.stubs(:use_s3?).returns(false) }- it "should be ok" do+ it "allows enabling S3 uploads" doexpect { validations.validate_enable_s3_uploads("t") }.not_to raise_errorendend@@ -324,7 +324,7 @@ RSpec.describe SiteSettings::Validations docontext "when the s3_upload_bucket is not blank" dobefore { SiteSetting.s3_upload_bucket = "some-bucket" }- it "should be ok" do+ it "allows enabling S3 uploads" doexpect { validations.validate_enable_s3_uploads("t") }.not_to raise_errorendend@@ -403,7 +403,7 @@ RSpec.describe SiteSettings::Validations docontext "when composer_media_optimization_image_enabled is enabled" dobefore { SiteSetting.composer_media_optimization_image_enabled = true }- it "should raise an error" do+ it "rejects disabling metadata stripping" doexpect { validations.validate_strip_image_metadata("f") }.to raise_error(Discourse::InvalidParameters,error_message,@@ -414,14 +414,14 @@ RSpec.describe SiteSettings::Validations docontext "when composer_media_optimization_image_enabled is disabled" dobefore { SiteSetting.composer_media_optimization_image_enabled = false }- it "should be ok" do+ it "allows disabling metadata stripping" doexpect { validations.validate_strip_image_metadata("f") }.not_to raise_errorendendendcontext "when the new value is true" do- it "should be ok" do+ it "allows enabling metadata stripping" doexpect { validations.validate_strip_image_metadata("t") }.not_to raise_errorendenddiff --git a/spec/lib/spam_handler_spec.rb b/spec/lib/spam_handler_spec.rbindex e4b9ef9eebf..b4b8cd2f2eb 100644--- a/spec/lib/spam_handler_spec.rb+++ b/spec/lib/spam_handler_spec.rb@@ -4,7 +4,7 @@ require "spam_handler"RSpec.describe SpamHandler dodescribe "#should_prevent_registration_from_ip?" do- it "works" do+ it "flags spam and silences the user" do# max_new_accounts_per_registration_ip = 0 disables the checkSiteSetting.max_new_accounts_per_registration_ip = 0diff --git a/spec/lib/stylesheet/importer_spec.rb b/spec/lib/stylesheet/importer_spec.rbindex 6fbcaad3217..f102ce8692e 100644--- a/spec/lib/stylesheet/importer_spec.rb+++ b/spec/lib/stylesheet/importer_spec.rb@@ -68,12 +68,12 @@ RSpec.describe Stylesheet::Importer doendend- it "should include color definitions in the theme" do+ it "includes color definitions from the theme" dostyles = Stylesheet::Importer.new({ theme_id: theme.id }).import_color_definitionsexpect(styles).to include(output_scss)end- it "should include color definitions from components" do+ it "includes color definitions from components" dotheme.add_relative_theme!(:child, child)theme.save!@@ -83,7 +83,7 @@ RSpec.describe Stylesheet::Importer doexpect(styles).to include("--custom-color-rgb: 0, 0, 128")end- it "should include default theme color definitions" do+ it "includes default theme color definitions" doSiteSetting.default_theme_id = theme.idstyles = Stylesheet::Importer.new({}).import_color_definitionsexpect(styles).to include(output_scss)@@ -91,14 +91,14 @@ RSpec.describe Stylesheet::Importer doenddescribe "#import_wcag_overrides" do- it "should do nothing on a regular scheme" do+ it "does nothing for a regular scheme" doscheme = ColorScheme.create_from_base(name: "Regular")expect(Stylesheet::Importer.new({ color_scheme_id: scheme.id }).import_wcag_overrides).to eq("",)end- it "should include WCAG overrides for WCAG based scheme" do+ it "includes WCAG overrides for a WCAG-based scheme" doscheme =ColorScheme.create_from_base(name: "WCAG New",diff --git a/spec/lib/system_message_spec.rb b/spec/lib/system_message_spec.rbindex 53fedd0f181..0bf960c9f80 100644--- a/spec/lib/system_message_spec.rb+++ b/spec/lib/system_message_spec.rb@@ -10,7 +10,7 @@ RSpec.describe SystemMessage dobefore { SiteSetting.site_contact_username = admin.username }- it "should create a post correctly" do+ it "creates the expected post" dosystem_message = SystemMessage.new(user)post = system_message.create(:welcome_invite)topic = post.topicdiff --git a/spec/lib/text_sentinel_spec.rb b/spec/lib/text_sentinel_spec.rbindex b3864068c56..0a12604d94e 100644--- a/spec/lib/text_sentinel_spec.rb+++ b/spec/lib/text_sentinel_spec.rb@@ -96,11 +96,11 @@ RSpec.describe TextSentinel doexpect(TextSentinel.new(valid_string.upcase)).to be_validend- it "enforces the minimum entropy" do+ it "accepts text at the minimum entropy" doexpect(TextSentinel.new(valid_string, min_entropy: 16)).to be_validend- it "enforces the minimum entropy" do+ it "rejects text below the minimum entropy" doexpect(TextSentinel.new(valid_string, min_entropy: 17)).not_to be_validenddiff --git a/spec/lib/theme_settings_parser_spec.rb b/spec/lib/theme_settings_parser_spec.rbindex be17a4b4b4f..5132b02d921 100644--- a/spec/lib/theme_settings_parser_spec.rb+++ b/spec/lib/theme_settings_parser_spec.rb@@ -72,7 +72,7 @@ RSpec.describe ThemeSettingsParser doenddescribe "enum setting" do- it "should never have less than 1 choices" do+ it "retains at least one choice" dochoices = loader.find_by_name(:enum_setting)[:opts][:choices]expect(choices.class).to eq(Array)expect(choices.length).to eq(3)diff --git a/spec/lib/topic_creator_spec.rb b/spec/lib/topic_creator_spec.rbindex 06df9dc61b9..6d1b515e00a 100644--- a/spec/lib/topic_creator_spec.rb+++ b/spec/lib/topic_creator_spec.rb@@ -32,11 +32,11 @@ RSpec.describe TopicCreator doSiteSetting.duplicate_topic_titles = "allowed"end- it "should be possible for an admin to create a topic" do+ it "allows an admin to create a topic" doexpect(TopicCreator.create(admin, Guardian.new(admin), valid_attrs)).to be_validend- it "should be possible for a moderator to create a topic" do+ it "allows a moderator to create a topic" doexpect(TopicCreator.create(moderator, Guardian.new(moderator), valid_attrs)).to be_validend@@ -51,11 +51,11 @@ RSpec.describe TopicCreator docontext "with regular user" dobefore { SiteSetting.create_topic_allowed_groups = Group::AUTO_GROUPS[:trust_level_0] }- it "should be possible for a regular user to create a topic" do+ it "allows a regular user to create a topic" doexpect(TopicCreator.create(user, Guardian.new(user), valid_attrs)).to be_validend- it "should be possible for a regular user to create a topic with blank auto_close_time" do+ it "allows a regular user to create a topic with a blank auto_close_time" doexpect(TopicCreator.create(user, Guardian.new(user), valid_attrs.merge(auto_close_time: "")),).to be_valid@@ -555,7 +555,7 @@ RSpec.describe TopicCreator doSiteSetting.enable_staged_users = trueend- it "should be possible for a regular user to send private message" do+ it "allows a regular user to send a private message" doexpect(TopicCreator.create(user, Guardian.new(user), pm_valid_attrs)).to be_validend@@ -577,7 +577,7 @@ RSpec.describe TopicCreator doendcontext "with failure cases" do- it "should be rollback the changes when email is invalid" do+ it "rolls back the changes when the email is invalid" doSiteSetting.manual_polling_enabled = trueSiteSetting.reply_by_email_address = "sam+%{reply_key}@sam.com"SiteSetting.reply_by_email_enabled = truediff --git a/spec/lib/topic_publisher_spec.rb b/spec/lib/topic_publisher_spec.rbindex 6ff75c7f8f8..deb9855f70b 100644--- a/spec/lib/topic_publisher_spec.rb+++ b/spec/lib/topic_publisher_spec.rb@@ -23,7 +23,7 @@ RSpec.describe TopicPublisher doop.reloadend- it "will publish the topic properly" do+ it "publishes the topic" dopublished_at = 1.hour.from_now.change(usec: 0)freeze_time(published_at) doTopicPublisher.new(topic, moderator, shared_draft.category_id).publish!@@ -54,7 +54,7 @@ RSpec.describe TopicPublisher doendend- it "will notify users watching tag" do+ it "notifies users watching the tag" doJobs.run_immediately!TagUser.create!(diff --git a/spec/lib/topic_query/private_message_lists_spec.rb b/spec/lib/topic_query/private_message_lists_spec.rbindex d28de251c50..cd30b0d874a 100644--- a/spec/lib/topic_query/private_message_lists_spec.rb+++ b/spec/lib/topic_query/private_message_lists_spec.rb@@ -118,7 +118,7 @@ RSpec.describe TopicQuery::PrivateMessageLists doenddescribe "#list_private_messages_group" do- it "should return the right list for a group user" do+ it "returns the group's messages for a group member" dogroup.add(user_2)topics =@@ -127,7 +127,7 @@ RSpec.describe TopicQuery::PrivateMessageLists doexpect(topics).to contain_exactly(group_message)end- it "should return the right list for an admin not part of the group" do+ it "returns the group's messages for an admin outside the group" dogroup.update!(name: group.name.capitalize)topics =@@ -139,7 +139,7 @@ RSpec.describe TopicQuery::PrivateMessageLists doexpect(topics).to contain_exactly(group_message)end- it "should not allow a moderator not part of the group to view the group's messages" do+ it "prevents moderators outside the group from viewing its messages" dotopics =TopicQuery.new(nil, group_name: group.name)@@ -149,7 +149,7 @@ RSpec.describe TopicQuery::PrivateMessageLists doexpect(topics).to eq([])end- it "should not allow a user not part of the group to view the group's messages" do+ it "prevents users outside the group from viewing its messages" dotopics =TopicQuery.new(nil, group_name: group.name)diff --git a/spec/lib/topic_query_spec.rb b/spec/lib/topic_query_spec.rbindex 3c93e10b25d..61e546f147d 100644--- a/spec/lib/topic_query_spec.rb+++ b/spec/lib/topic_query_spec.rb@@ -780,12 +780,12 @@ RSpec.describe TopicQuery dobefore { SiteSetting.mute_all_categories_by_default = true }- it "should remove all topics from new and latest lists by default" do+ it "removes all topics from new and latest lists by default" doexpect(topic_query.list_new.topics.map(&:id)).not_to include(topic.id)expect(topic_query.list_latest.topics.map(&:id)).not_to include(topic.id)end- it "should include tracked category topics in new and latest lists" do+ it "includes tracked-category topics in new and latest lists" dotopic = Fabricate(:topic, category: category)CategoryUser.create!(user_id: user.id,@@ -796,17 +796,17 @@ RSpec.describe TopicQuery doexpect(topic_query.list_latest.topics.map(&:id)).to include(topic.id)end- it "should include default watched category topics in latest list for anonymous users" do+ it "includes default watched-category topics for anonymous users" doSiteSetting.default_categories_watching = category.id.to_sexpect(TopicQuery.new.list_latest.topics.map(&:id)).to include(topic.id)end- it "should include default regular category topics in latest list for anonymous users" do+ it "includes default regular-category topics for anonymous users" doSiteSetting.default_categories_normal = category.id.to_sexpect(TopicQuery.new.list_latest.topics.map(&:id)).to include(topic.id)end- it "should include topics when filtered by category" do+ it "includes topics when filtered by category" dotopic_query = TopicQuery.new(user, category: topic.category_id)expect(topic_query.list_latest.topics.map(&:id)).to include(topic.id)end@@ -1190,7 +1190,7 @@ RSpec.describe TopicQuery doexpect(topic_ids - [topic_category.id]).to eq([topic_in_cat1.id, topic_in_cat2.id])end- it "should apply default sort order to latest and unseen filters only" do+ it "applies the default sort order only to latest and unseen filters" docategory.update!(sort_order: "created", sort_ascending: true)topic1 =@@ -1591,11 +1591,11 @@ RSpec.describe TopicQuery dolet(:topic) { Fabricate(:topic) }let!(:new_topic) { Fabricate(:post, user: creator).topic }- it "should return the new topic" do+ it "returns the new topic" doexpect(TopicQuery.new.list_suggested_for(topic).topics).to eq([new_topic])end- it "should return the nothing when random topics excluded" do+ it "returns nothing when random topics are excluded" doexpect(TopicQuery.new.list_suggested_for(topic, include_random: false).topics).to eq([])endend@@ -1607,7 +1607,7 @@ RSpec.describe TopicQuery dolet!(:archived_topic) { Fabricate(:topic, user: creator, archived: true) }let!(:invisible_topic) { Fabricate(:topic, user: creator, visible: false) }- it "should omit the closed/archived/invisible topics from suggested" do+ it "omits closed, archived, and invisible topics from suggestions" doexpect(TopicQuery.new.list_suggested_for(topic).topics).to eq([regular_topic])endend@@ -1636,7 +1636,7 @@ RSpec.describe TopicQuery dolet(:plugin) { plugin_class.new }- it "should return suggested defined by the custom provider" do+ it "returns suggestions from the custom provider" doDiscoursePluginRegistry.register_list_suggested_for_provider(plugin_class.method(:custom_suggested_topics),plugin,@@ -1656,7 +1656,7 @@ RSpec.describe TopicQuery doafter { clear_cache! }context "when there are no new topics for user" do- it "should return random topics excluding topics that are muted by user and not older than `suggested_topics_max_days_old` site setting" do+ it "returns recent random topics that are not muted by the user" dotopic2 = Fabricate(:topic, user: user)topic3 = Fabricate(:topic, user: user)_topic4 = Fabricate(:topic, user: user, created_at: 8.days.ago)@@ -1739,7 +1739,7 @@ RSpec.describe TopicQuery dobefore { topic.update!(category:) }- it "should return new topics for user ordered by topics that user has created first, in the same category as the topic and then topic's bumped at" do+ it "orders new topics by authorship, category, and bumped_at" doexpect(topic_query.list_suggested_for(topic, include_random: false).topics.map(&:id),).to eq(@@ -1784,7 +1784,7 @@ RSpec.describe TopicQuery dosuggested_for(tt)end- it "should return empty results when there is nothing to find" do+ it "returns empty results when nothing matches" doexpect(suggested_topics).to be_blankend@@ -1860,7 +1860,7 @@ RSpec.describe TopicQuery docontext "as user not part of group" dolet!(:user) { Fabricate(:user) }- it "should not return topics by the group user" do+ it "does not return topics by the group user" doexpect(suggested_topics).to eq([private_message.id])endend@@ -1868,7 +1868,7 @@ RSpec.describe TopicQuery docontext "as user part of group" dolet!(:user) { group_user }- it "should return the group topics" do+ it "returns the group's topics" doexpect(suggested_topics).to match_array([private_group_topic.id, private_message.id])end@@ -1877,7 +1877,7 @@ RSpec.describe TopicQuery doSiteSetting.personal_message_enabled_groups = Group::AUTO_GROUPS[:trust_level_4]end- it "should not return topics by the group user" do+ it "does not return topics by the group user" doexpect(suggested_topics).to eq(nil)endend@@ -1887,7 +1887,7 @@ RSpec.describe TopicQuery dolet(:tag) { Fabricate(:tag) }let!(:user) { group_user }- it "should return only tagged topics" do+ it "returns only tagged topics" doFabricate(:topic_tag, topic: private_message, tag: tag)Fabricate(:topic_tag, topic: private_group_topic)@@ -1995,13 +1995,13 @@ RSpec.describe TopicQuery dolet!(:topic5) { Fabricate(:topic, user: user, visible: false) }let!(:topic6) { Fabricate(:topic, user: user2) }- it "should return the right lists for anon user" do+ it "returns the expected lists for an anonymous user" dotopics = TopicQuery.new.list_group_topics(group).topicsexpect(topics).to contain_exactly(topic1, topic2, topic6)end- it "should return the right list for users in the same group" do+ it "returns the expected list for users in the same group" dotopics = TopicQuery.new(user).list_group_topics(group).topicsexpect(topics).to contain_exactly(topic1, topic2, topic3, topic6)@@ -2011,7 +2011,7 @@ RSpec.describe TopicQuery doexpect(topics).to contain_exactly(topic1, topic2, topic3, topic6)end- it "should return the right list for user no in the group" do+ it "returns the expected list for a user outside the group" dotopics = TopicQuery.new(user3).list_group_topics(group).topicsexpect(topics).to contain_exactly(topic1, topic2, topic6)@@ -2467,13 +2467,13 @@ RSpec.describe TopicQuery do)end- it "should not return any topics if the user is anonymous" do+ it "returns no topics when the user is anonymous" doexpect(TopicQuery.new(nil, state: "watching_first_post").list_latest.topics.map(&:id),).to eq([])end- it "should return the union of topics in watched categories and topics with watched tags" do+ it "returns the union of watched-category and watched-tag topics" doids = TopicQuery.new(test_user, state: "watching_first_post").list_latest.topics.map(&:id)expect(ids).to contain_exactly(@@ -2483,7 +2483,7 @@ RSpec.describe TopicQuery do)end- it "should work when combined with other filters" do+ it "combines with other filters" dotopic_in_watched_category.update!(closed: true)ids =diff --git a/spec/lib/topic_retriever_spec.rb b/spec/lib/topic_retriever_spec.rbindex 7ebf56fae20..c1021255a9d 100644--- a/spec/lib/topic_retriever_spec.rb+++ b/spec/lib/topic_retriever_spec.rb@@ -10,7 +10,7 @@ RSpec.describe TopicRetriever doenddescribe "#retrieve" do- context "when host is invalid" do+ context "when the URL itself is invalid" dobefore { topic_retriever.stubs(:invalid_url?).returns(true) }it "does not perform_retrieve" dodiff --git a/spec/lib/topic_view_spec.rb b/spec/lib/topic_view_spec.rbindex a7c2b96b71c..fba4853eda7 100644--- a/spec/lib/topic_view_spec.rb+++ b/spec/lib/topic_view_spec.rb@@ -310,7 +310,7 @@ RSpec.describe TopicView dofab!(:p2) { Fabricate(:post, topic: topic, user: evil_trout, percent_rank: 0.5) }fab!(:p3) { Fabricate(:post, topic: topic, user: first_poster, percent_rank: 0) }- it "it can find the best responses" do+ it "finds the best responses" dobest2 = TopicView.new(topic.id, evil_trout, best: 2)expect(best2.posts.count).to eq(2)expect(best2.posts[0].id).to eq(p2.id)@@ -510,7 +510,7 @@ RSpec.describe TopicView dobefore { TopicView.stubs(:chunk_size).returns(2) }- it "should return the next page" do+ it "returns the next page" doexpect(TopicView.new(topic.id, user, { post_number: post.post_number }).next_page).to eql(3)endend@@ -581,7 +581,7 @@ RSpec.describe TopicView doendend- describe "#bookmarks" do+ describe "#bookmarks for regular bookmarks" dolet!(:user) { Fabricate(:user) }let!(:bookmark1) doFabricate(:bookmark, bookmarkable: Fabricate(:post, topic: topic), user: user)@@ -602,7 +602,7 @@ RSpec.describe TopicView doendend- describe "#bookmarks" do+ describe "#bookmarks for next-business-day reminders" dolet!(:user) { Fabricate(:user) }let!(:bookmark1) doFabricate(:bookmark_next_business_day_reminder, bookmarkable: topic.first_post, user: user)@@ -718,7 +718,7 @@ RSpec.describe TopicView doenddescribe "contains_gaps?" do- it "works" do+ it "returns the requested topic view" do# does not contain contains_gaps with default filteringexpect(topic_view.contains_gaps?).to eq(false)# contains contains_gaps when filtered by username" do@@ -768,7 +768,7 @@ RSpec.describe TopicView dodescribe "ascending" dolet(:asc) { true }- it "should return the right posts" do+ it "returns the expected posts" dotopic_view = create_topic_view(p3.post_number)expect(topic_view.posts).to eq([p5])@@ -781,7 +781,7 @@ RSpec.describe TopicView dodescribe "descending" dolet(:asc) { false }- it "should return the right posts" do+ it "returns the expected posts" dotopic_view = create_topic_view(p7.post_number)expect(topic_view.posts).to eq([p5, p3, p2])@@ -1056,12 +1056,12 @@ RSpec.describe TopicView dolet!(:post2) { Fabricate(:post, topic: topic, user: evil_trout, created_at: 6.hours.ago) }let!(:post3) { Fabricate(:post, topic: topic, user: first_poster) }- it "should return the right columns" do+ it "returns the expected columns" doexpect(topic_view.filtered_post_stream).to eq([[post.id, 1], [post2.id, 0], [post3.id, 0]])enddescribe "for mega topics" do- it "should return the right columns" do+ it "returns the expected columns" dostub_const(TopicView, "MEGA_TOPIC_POSTS_COUNT", 2) doexpect(topic_view.filtered_post_stream).to eq([post.id, post2.id, post3.id])end@@ -1070,7 +1070,7 @@ RSpec.describe TopicView doenddescribe "#filtered_post_id" do- it "should return the right id" do+ it "returns the expected ID" dopost = Fabricate(:post, topic: topic)expect(topic_view.filtered_post_id(nil)).to eq(nil)@@ -1085,7 +1085,7 @@ RSpec.describe TopicView dobefore { [p1, p2, p3].each_with_index { |post, index| post.update!(sort_order: index + 1) } }- it "should return the right id" do+ it "returns the expected ID" doexpect(topic_view.last_post_id).to eq(p3.id)endend@@ -1102,7 +1102,7 @@ RSpec.describe TopicView dotopic_view.topic.reloadend- it "should return the right read time" do+ it "returns the expected read time" doSiteSetting.read_time_word_count = 500expect(topic_view.read_time).to eq(1)diff --git a/spec/lib/topics_filter_spec.rb b/spec/lib/topics_filter_spec.rbindex 4d564226f70..f905443e5ba 100644--- a/spec/lib/topics_filter_spec.rb+++ b/spec/lib/topics_filter_spec.rb@@ -8,7 +8,7 @@ RSpec.describe TopicsFilter dodescribe "#option_info" dolet(:options) { TopicsFilter.option_info(Guardian.new) }- it "should return a correct hash with name and description keys for all" do+ it "returns name and description keys for every option" doexpect(options).to be_an(Array)expect(options).to all(be_a(Hash))expect(options).to all(include(:name, :description))@@ -17,7 +17,7 @@ RSpec.describe TopicsFilter doexpect(options.length).to be > 10end- it "should include nothing about tags when disabled" do+ it "does not include tag options when tagging is disabled" doSiteSetting.tagging_enabled = falsetag_options = options.find { |o| o[:name].include? "tag" }@@ -30,7 +30,7 @@ RSpec.describe TopicsFilter doexpect(tag_options).not_to be_nilend- it "should advertise the - prefix for the group: option" do+ it "advertises the - prefix for the group: option" dogroup_option = options.find { |o| o[:name] == "group:" }expect(group_option[:prefixes]).to contain_exactly(@@ -38,7 +38,7 @@ RSpec.describe TopicsFilter do)end- it "should not include user-specific options for anonymous users" do+ it "does not include user-specific options for anonymous users" doanon_options = TopicsFilter.option_info(Guardian.new)logged_in_options = TopicsFilter.option_info(user.guardian)@@ -63,7 +63,7 @@ RSpec.describe TopicsFilter douser_specific_options.each { |option| expect(logged_in_option_names).to include(option) }end- it "should apply the topics_filter_options modifier for authenticated users" do+ it "applies the topics_filter_options modifier for authenticated users" doplugin_instance = Plugin::Instance.newDiscoursePluginRegistry.register_modifier(plugin_instance,@@ -354,7 +354,7 @@ RSpec.describe TopicsFilter dofab!(:topic_with_tag2) { Fabricate(:topic, tags: [tag2]) }fab!(:closed_topic_with_tag2) { Fabricate(:topic, tags: [tag2], closed: true) }- it "should return the right topics when query string is `status:closed tags:tag1,tag2`" do+ it "returns matching topics for `status:closed tags:tag1,tag2`" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -376,7 +376,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `in:pinned`" do- it "should return topics that are pinned" do+ it "returns pinned topics" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -385,7 +385,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(pinned_topic.id)end- it "should not return pinned topics that have expired" do+ it "does not return expired pinned topics" dofreeze_time(2.hours.from_now) doexpect(TopicsFilter@@ -481,7 +481,7 @@ RSpec.describe TopicsFilter do)end- it "should not return any topics when user is anonymous" do+ it "returns no topics for an anonymous user" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -490,7 +490,7 @@ RSpec.describe TopicsFilter do).to eq([])end- it "should return topics that are bookmarked" do+ it "returns bookmarked topics" doexpect(TopicsFilter.new(guardian: Guardian.new(user))@@ -501,7 +501,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `in:bookmarked in:pinnned`" do- it "should return topics that are bookmarked and pinned" do+ it "returns topics that are bookmarked and pinned" doexpect(TopicsFilter.new(guardian: Guardian.new(user))@@ -535,7 +535,7 @@ RSpec.describe TopicsFilter doendend- it "should not return any topics if the user is anonymous" do+ it "returns no topics when the user is anonymous" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -544,7 +544,7 @@ RSpec.describe TopicsFilter do).to eq([])end- it "should return topics that the user has notification level set to #{notification_level}" do+ it "returns topics set to the #{notification_level} notification level" doexpect(TopicsFilter.new(guardian: Guardian.new(user))@@ -587,7 +587,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `in:muted,invalid`" do- it "should ignore the invalid notification level" do+ it "ignores the invalid notification level" doexpect(TopicsFilter.new(guardian: Guardian.new(user))@@ -598,7 +598,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `in:muted in:tracking`" do- it "should return topics that the user is tracking or has muted" do+ it "returns topics that the user is tracking or has muted" doexpect(TopicsFilter.new(guardian: Guardian.new(user))@@ -609,7 +609,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `in:muted,tracking" do- it "should return topics that the user is tracking or has muted" do+ it "returns tracked or muted topics" doexpect(TopicsFilter.new(guardian: Guardian.new(user))@@ -649,7 +649,7 @@ RSpec.describe TopicsFilter do)end- it "should not return any topics if the user is anonymous" do+ it "returns no topics when the user is anonymous" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -658,7 +658,7 @@ RSpec.describe TopicsFilter do).to be_emptyend- it "should return the union of topics in watched categories and topics with watched tags" do+ it "returns the union of watched-category and watched-tag topics" doids =TopicsFilter.new(guardian: Guardian.new(user))@@ -672,7 +672,7 @@ RSpec.describe TopicsFilter do)end- it "should work when combined with other filters" do+ it "combines with other filters" dotopic_in_watched_category.update!(closed: true)ids =@@ -684,7 +684,7 @@ RSpec.describe TopicsFilter doexpect(ids).to contain_exactly(topic_in_watched_category.id)end- it "should work with comma-separated notification levels" do+ it "accepts comma-separated notification levels" douser_watching_topic =Fabricate(:topic).tap do |topic|TopicUser.change(@@ -766,7 +766,7 @@ RSpec.describe TopicsFilter dofab!(:topic_in_category2_subcategory) { Fabricate(:topic, category: category2_subcategory) }describe "when query string is `category:category`" do- it "should return topics from specified category and its subcategories" do+ it "returns topics from the specified category and its subcategories" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -775,7 +775,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_in_category.id, topic_in_category_subcategory.id)end- it "should return topics from specified category, its subcategories and sub-subcategories" do+ it "returns topics from the specified category and all descendant categories" doSiteSetting.max_category_nesting = 3category_subcategory_subcategory =@@ -802,7 +802,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `category:category,category2`" do- it "should return topics from any of the specified categories and its subcategories" do+ it "returns topics from any specified category and its subcategories" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -818,7 +818,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `category:category category:category2`" do- it "should return topics from any of the specified categories and its subcategories" do+ it "returns topics from any specified category and its descendants" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -834,7 +834,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `category:category =category:category2`" do- it "should return topics and subcategory topics from category but only topics from category2" do+ it "includes descendants only for categories marked with the subcategory option" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -849,7 +849,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `-category:category`" do- it "should not return any topics from specified category or its subcategories" do+ it "excludes topics from the specified category and its subcategories" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -860,7 +860,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `-category:category2,category`" do- it "should not return any topics from either specified categories or their subcategories" do+ it "excludes topics from either specified category and their subcategories" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -871,7 +871,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `-category:category -category:category2-subcategory`" do- it "should not return any topics from either specified category or their subcategories" do+ it "excludes topics from each specified category and its descendants" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -882,7 +882,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `-=category:category`" do- it "should not return any topics from the specified category only" do+ it "excludes topics only from the specified category" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -897,7 +897,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `-=category:category,category2`" do- it "should not return any topics from the specified categories only" do+ it "excludes topics only from the specified categories" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -908,7 +908,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `=category:category`" do- it "should not return topics from subcategories`" do+ it "does not return topics from subcategories" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -919,7 +919,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `=category:category,category2`" do- it "should not return topics from subcategories" do+ it "excludes subcategory topics" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -930,7 +930,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `category:category2 -=category:category2-subcategory`" do- it "should return topics from category2 and its subcategories but not from the category2-subcategory" do+ it "returns category2 descendants except the excluded subcategory" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -953,7 +953,7 @@ RSpec.describe TopicsFilter dobefore { SiteSetting.max_category_nesting = 3 }- it "should return topics from category2, category2's sub-categories and category2's sub-sub-categories but not from the category2-subcategory only" do+ it "returns category2 descendants except topics directly in the excluded subcategory" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -976,7 +976,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `category:日本語`" do- it 'should return topics from category with slug "日本語"' do+ it 'returns topics from the category with slug "日本語"' doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -989,7 +989,7 @@ RSpec.describe TopicsFilter dodescribe "when query string is `category:日本語:안녕하세요`" dobefore { category_subcategory.update!(name: "안녕하세요 ", slug: "안녕하세요 ") }- it "should return topics from category with slug '안녕하세요'" do+ it "returns topics from the category with slug '안녕하세요'" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1013,7 +1013,7 @@ RSpec.describe TopicsFilter dofab!(:topic_in_category2_subcategory) { Fabricate(:topic, category: category2_subcategory) }describe "when query string is `category:subcategory`" do- it "should return topics from subcategories of both categories" do+ it "returns topics from subcategories of both categories" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1027,7 +1027,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `category:category:subcategory`" do- it "should return topics from subcategories of the specified category" do+ it "returns topics from subcategories of the specified category" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1038,7 +1038,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `category:category2:subcategory`" do- it "should return topics from subcategories of the specified category" do+ it "returns matching topics from the specified category's subcategories" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1049,7 +1049,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `category:category:subcategory,category2:subcategory`" do- it "should return topics from either subcategory" do+ it "returns topics from either subcategory" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1188,7 +1188,7 @@ RSpec.describe TopicsFilter doendend- it "should only return topics that have not been closed or archived when query string is `status:open`" do+ it "returns only open topics for `status:open`" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1197,7 +1197,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic.id)end- it "should only return topics that have been deleted when query string is `status:deleted` and user can see deleted topics" do+ it "returns only deleted topics for authorized users with `status:deleted`" doexpect(TopicsFilter.new(guardian: Guardian.new(admin))@@ -1206,7 +1206,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(deleted_topic_id)end- it "should ignore status filter when query string is `status:deleted` and user cannot see deleted topics" do+ it "ignores `status:deleted` when the user cannot see deleted topics" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1215,7 +1215,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic.id, closed_topic.id, archived_topic.id, foobar_topic.id)end- it "should only return topics that have been archived when query string is `status:archived`" do+ it "returns only archived topics for `status:archived`" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1224,7 +1224,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(archived_topic.id)end- it "should only return topics that are visible when query string is `status:listed`" do+ it "returns only visible topics for `status:listed`" doTopic.update_all(visible: false)topic.update!(visible: true)@@ -1236,7 +1236,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic.id)end- it "should only return topics that are not visible when query string is `status:unlisted`" do+ it "returns only unlisted topics for `status:unlisted`" doTopic.update_all(visible: true)topic.update!(visible: false)@@ -1248,7 +1248,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic.id)end- it "should only return topics that are not in any read-restricted category when query string is `status:public`" do+ it "returns only unrestricted topics for `status:public`" doprivate_category = Fabricate(:private_category, group: group)topic_in_private_category = Fabricate(:topic, category: private_category)@@ -1267,7 +1267,7 @@ RSpec.describe TopicsFilter dodescribe "when query string is `status:closed status:unlisted`" dofab!(:closed_and_unlisted_topic) { Fabricate(:topic, closed: true, visible: false) }- it "should only return topics that have been closed and are not visible" do+ it "returns only closed and unlisted topics" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1281,7 +1281,7 @@ RSpec.describe TopicsFilter dofab!(:topic_without_replies) { Fabricate(:topic, posts_count: 1) }fab!(:topic_with_replies) { Fabricate(:topic, posts_count: 2) }- it "should only return topics that have no replies" do+ it "returns only topics without replies" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1295,7 +1295,7 @@ RSpec.describe TopicsFilter dofab!(:single_user_topic) { Fabricate(:topic, participant_count: 1) }fab!(:multi_user_topic) { Fabricate(:topic, participant_count: 2) }- it "should only return topics that have a single participant" do+ it "returns only topics with one participant" dotopic_ids =TopicsFilter.new(guardian: Guardian.new)@@ -1334,7 +1334,7 @@ RSpec.describe TopicsFilter dofab!(:tag_synonym) { Fabricate(:tag, name: "synonym1", target_tag_id: tag.id) }describe "when filtering by a tag synonym" do- it "should return topics tagged with the target tag when query string is `tag:synonym1`" do+ it "returns topics with the target tag for `tag:synonym1`" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1343,7 +1343,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_with_tag.id, topic_with_tag_and_tag2.id)end- it "should return topics tagged with the target tag or other tags when query string is `tags:synonym1,tag2`" do+ it "returns topics with the target or other tags for `tags:synonym1,tag2`" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1352,7 +1352,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_with_tag.id, topic_with_tag_and_tag2.id, topic_with_tag2.id)end- it "should exclude topics tagged with the target tag when query string is `-tag:synonym1`" do+ it "excludes topics with the target tag for `-tag:synonym1`" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1366,7 +1366,7 @@ RSpec.describe TopicsFilter doendend- it "should not filter any topics by tags when tagging is disabled" do+ it "does not filter topics by tag when tagging is disabled" doSiteSetting.tagging_enabled = falseexpect(@@ -1384,7 +1384,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `tag:tag1+tag2`" do- it "should only return topics that are tagged with all of the specified tags" do+ it "returns only topics with all specified tags" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1394,7 +1394,7 @@ RSpec.describe TopicsFilter doendend- it "should only return topics that are tagged with all of the specified tags when query string is `tags:tag1+tag2`" do+ it "returns only topics with all tags for `tags:tag1+tag2`" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1403,7 +1403,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_with_tag_and_tag2.id)end- it "should return topics tagged with period-delimited tag names" do+ it "returns topics with period-delimited tag names" dotag_with_period = Fabricate(:tag, name: "node.js")topic_with_period_tag = Fabricate(:topic, tags: [tag_with_period])@@ -1415,7 +1415,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_with_period_tag.id)end- it "should only return topics that are tagged with tag1 and tag2 when query string is `tags:tag1 tags:tag2`" do+ it "returns only topics with tag1 and tag2 for repeated tag filters" dotopic_with_tag_and_tag2_and_tag3 = Fabricate(:topic, tags: [tag, tag2, tag3])expect(@@ -1432,7 +1432,7 @@ RSpec.describe TopicsFilter dofab!(:pri_high) { Fabricate(:tag, name: "pri-high") }fab!(:pri_low) { Fabricate(:tag, name: "pri-low") }- it "should only return topics that are tagged with front-end+pri-high, front-end+pri-low, back-end+pri-high, back-end+pri-low" do+ it "returns topics matching each requested tag combination" dotopic_with_front_end_pri_high = Fabricate(:topic, tags: [front_end, pri_high])topic_with_front_end_pri_low = Fabricate(:topic, tags: [front_end, pri_low])topic_with_back_end_pri_high = Fabricate(:topic, tags: [back_end, pri_high])@@ -1456,7 +1456,7 @@ RSpec.describe TopicsFilter do)end- it "should return topics that are tagged with front-end+back-end+pri-low or front-end+back-end+pri-high" do+ it "returns topics matching either requested tag combination" dotopic_with_front_end_back_end_pri_low =Fabricate(:topic, tags: [front_end, back_end, pri_low])topic_with_front_end_back_end_pri_high =@@ -1484,7 +1484,7 @@ RSpec.describe TopicsFilter dofab!(:pri_high) { Fabricate(:tag, name: "pri-high") }fab!(:pri_low) { Fabricate(:tag, name: "pri-low") }- it "should only return topics tagged with front-end and or pri-high or pri-low" do+ it "returns topics with front-end and either priority tag" dotopic_with_front_end_pri_high = Fabricate(:topic, tags: [front_end, pri_high])topic_with_front_end_pri_low = Fabricate(:topic, tags: [front_end, pri_low])topic_with_front_end_pri_high_pri_low =@@ -1522,7 +1522,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `tags:tag1,tag2,tag3`" do- it "should only return topics that are tagged with either tag1, tag2 or tag3" do+ it "returns only topics with tag1, tag2, or tag3" dotopic_with_tag3 = Fabricate(:topic, tags: [tag3])expect(@@ -1540,7 +1540,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `tags:tag1+tag2+tag3`" do- it "should only return topics that are tagged with tag1, tag2 and tag3" do+ it "returns only topics with tag1, tag2, and tag3" dotopic_with_tag_tag2_tag3 = Fabricate(:topic, tags: [tag, tag2, tag3])expect(@@ -1552,7 +1552,7 @@ RSpec.describe TopicsFilter doendend- it "should only return topics that are tagged with tag1 and tag2 but not tag3 when query string is `tags:tag1 tags:tag2 -tags:tag3`" do+ it "returns topics with tag1 and tag2 but without tag3" do_topic_with_tag_and_tag2_and_tag3 = Fabricate(:topic, tags: [tag, tag2, tag3])expect(@@ -1563,7 +1563,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_with_tag_and_tag2.id)end- it "should only return topics that are tagged with any of the specified tags when query string is `tags:tag1,tag2`" do+ it "returns topics with any specified tag for `tags:tag1,tag2`" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1572,7 +1572,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_with_tag.id, topic_with_tag_and_tag2.id, topic_with_tag2.id)end- it "should not return any topics when query string is `tags:tag1+tag2+invalid`" do+ it "returns no topics when an AND tag filter includes an invalid tag" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1581,7 +1581,7 @@ RSpec.describe TopicsFilter do).to eq([])end- it "should still filter topics by specificed tags when query string is `tags:tag1,tag2,invalid`" do+ it "filters by valid tags when an OR tag filter includes an invalid tag" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1590,7 +1590,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_with_tag_and_tag2.id, topic_with_tag.id, topic_with_tag2.id)end- it "should not return any topics when query string is `tags:group-only-tag` because specified tag is hidden to user" do+ it "returns no topics when the specified tag is hidden from the user" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1599,7 +1599,7 @@ RSpec.describe TopicsFilter do).to eq([])end- it "should return the right topics when query string is `tags:group-only-tag` and user has access to specified tag" do+ it "returns matching topics when the user can access the specified tag" dogroup.add(admin)expect(@@ -1610,7 +1610,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_with_group_only_tag.id)end- it "should only return topics that are not tagged with specified tag when query string is `-tags:tag1`" do+ it "returns only topics without the specified tag for `-tags:tag1`" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1619,7 +1619,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_without_tag.id, topic_with_tag2.id, topic_with_group_only_tag.id)end- it "should only return topics that are not tagged with all of the specified tags when query string is `-tags:tag1+tag2`" do+ it "excludes topics with all specified tags for `-tags:tag1+tag2`" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1633,7 +1633,7 @@ RSpec.describe TopicsFilter do)end- it "should only return topics that are not tagged with any of the specified tags when query string is `-tags:tag1,tag2`" do+ it "excludes topics with any specified tag for `-tags:tag1,tag2`" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1645,7 +1645,7 @@ RSpec.describe TopicsFilter dodescribe "when query string is tag:日べé1" dobefore { tag.update!(name: "日べé1") }- it "should return topics that are tagged with the specified tag" do+ it "returns topics with the specified tag" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1658,7 +1658,7 @@ RSpec.describe TopicsFilter dodescribe "when query string is `tags:tag_name`" dobefore { tag.update!(name: "tag_with_underscore") }- it "should return topics even when tag contains underscore" do+ it "returns topics when the tag contains an underscore" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1674,7 +1674,7 @@ RSpec.describe TopicsFilter dotag2.update!(name: "tag_two")end- it "should return topics when filtering with comma-separated underscore tags" do+ it "returns topics for comma-separated tags containing underscores" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1683,7 +1683,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_with_tag.id, topic_with_tag_and_tag2.id, topic_with_tag2.id)end- it "should return topics when filtering with plus-separated underscore tags" do+ it "returns topics for plus-separated tags containing underscores" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1722,7 +1722,7 @@ RSpec.describe TopicsFilter dofab!(:topic_with_staff_only_tag) { Fabricate(:topic, tags: [staff_only_tag]) }- it "should only return topics that are tagged with any of the specified tag_group when query string is tag_group:tag_group_name" do+ it "returns topics with any tag in the specified tag group" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1731,7 +1731,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_with_tag.id, topic_with_tag_and_tag2.id, topic_with_tag2.id)end- it "should only return topics that are not excluded by the specified tag_group when query string is -tag_group:tag_group_name" do+ it "excludes topics with tags in the specified excluded tag group" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1740,7 +1740,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_with_tag3.id, topic_without_tag.id, topic_with_staff_only_tag.id)end- it "should return the right topics when query string is `tag_group:staff_tag_group` and user has access to specified tag" do+ it "returns matching topics when the user can access the tag group" dogroup.add(admin)expect(@@ -1751,7 +1751,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_with_staff_only_tag.id)end- it "should not return any topics when query string is `tag_group:staff_tag_group` because specified tag is hidden to user" do+ it "returns no topics when the tag group is hidden from the user" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1775,7 +1775,7 @@ RSpec.describe TopicsFilter dofab!(:topic_with_tag) { Fabricate(:topic, tags: [tag]) }fab!(:topic_without_tag, :topic)- it "should filter by tag group name with spaces using double quotes" do+ it "filters a double-quoted tag group name containing spaces" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1784,7 +1784,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_with_tag.id)end- it "should filter by tag group name with spaces using single quotes" do+ it "filters a single-quoted tag group name containing spaces" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1793,7 +1793,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_with_tag.id)end- it "should filter by tag group name with ampersand" do+ it "filters a tag group name containing an ampersand" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1802,7 +1802,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_with_tag.id)end- it "should filter by tag group name with parentheses" do+ it "filters a tag group name containing parentheses" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1811,7 +1811,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_with_tag.id)end- it "should perform case-insensitive tag group lookup" do+ it "looks up tag groups case-insensitively" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1820,7 +1820,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_with_tag.id)end- it "should handle exclude prefix with quoted tag group names" do+ it "handles the exclusion prefix with quoted tag group names" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1829,7 +1829,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_without_tag.id)end- it "should maintain backward compatibility with unquoted tag group names" do+ it "supports unquoted tag group names" dosimple_tag = Fabricate(:tag, name: "simple-tag")_simple_group = Fabricate(:tag_group, name: "simple", tag_names: [simple_tag.name])topic_simple = Fabricate(:topic, tags: [simple_tag])@@ -1850,7 +1850,7 @@ RSpec.describe TopicsFilter dofab!(:no_locale_topic, :topic)describe "when query string is `locale:en`" do- it "should only return topics with locale en" do+ it "returns only topics with the en locale" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1861,7 +1861,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `locale:ja,es`" do- it "should return topics with locale ja or es" do+ it "returns topics with the ja or es locale" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1872,7 +1872,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `locale:ja locale:es`" do- it "should return topics with locale ja or es" do+ it "returns topics matching either ja or es locale filter" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1883,7 +1883,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `-locale:en`" do- it "should return topics without locale en" do+ it "returns topics without the en locale" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1894,7 +1894,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `-locale:en,ja`" do- it "should return topics without locale en or ja" do+ it "returns topics without the en or ja locale" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1905,7 +1905,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `locale:invalid`" do- it "should return no topics" do+ it "returns no topics" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1918,7 +1918,7 @@ RSpec.describe TopicsFilter dodescribe "when combining with other filters" dobefore { en_topic.update!(closed: true) }- it "should work with status:closed" do+ it "combines with status:closed" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1936,7 +1936,7 @@ RSpec.describe TopicsFilter dofab!(:topic_by_user2) { Fabricate(:topic, user: user2) }describe "when query string is `created-by:@username`" do- it "should return the topics created by the specified user" do+ it "returns topics created by the specified user" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1947,7 +1947,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `created-by:@username2`" do- it "should return the topics created by the specified user" do+ it "returns topics created by the named user" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1958,7 +1958,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `created-by:@username created-by:@username2`" do- it "should return the topics created by either of the specified users" do+ it "returns topics created by either specified user" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1971,7 +1971,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `created-by:@username,invalid`" do- it "should only return the topics created by the user with the valid username" do+ it "returns only topics created by the user with a valid username" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1982,7 +1982,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `created-by:@username,@username2`" do- it "should return the topics created by either of the specified users" do+ it "returns topics created by any valid specified user" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -1993,7 +1993,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `created-by:@invalid`" do- it "should not return any topics" do+ it "returns no topics" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2004,7 +2004,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `created-by:me`" do- it "should return the topics created by the current user" do+ it "returns topics created by the current user" doexpect(TopicsFilter.new(guardian: Guardian.new(user))@@ -2013,7 +2013,7 @@ RSpec.describe TopicsFilter do).to contain_exactly(topic_by_user.id, topic2_by_user.id)end- it "should not return any topics when there is no current user" do+ it "returns no topics when there is no current user" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2042,7 +2042,7 @@ RSpec.describe TopicsFilter dofab!(:topic_by_both_groups_user) { Fabricate(:topic, user: user_in_both_groups) }describe "when query string is `created-by:group1`" do- it "should return topics created by users in the specified group" do+ it "returns topics created by users in the specified group" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2053,7 +2053,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `created-by:group2`" do- it "should return topics created by users in the specified group" do+ it "returns topics from members of the named group" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2064,7 +2064,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `created-by:group1,group2`" do- it "should return topics created by users in any of the specified groups" do+ it "returns topics created by users in any specified group" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2079,7 +2079,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `created-by:invalid`" do- it "should not return any topics" do+ it "returns no topics" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2090,7 +2090,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `created-by:group1,invalid`" do- it "should only return topics created by users in the valid group" do+ it "returns only topics created by users in the valid group" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2124,7 +2124,7 @@ RSpec.describe TopicsFilter dofab!(:topic_by_super_private_group_user) doFabricate(:topic, user: user_in_super_private_group)end- it "should not return topics when user cannot see the group" do+ it "returns no topics when the user cannot see the group" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2133,7 +2133,7 @@ RSpec.describe TopicsFilter do).to eq([])end- it "should return topics when user is a member of the private group" do+ it "returns topics when the user belongs to the private group" doprivate_group.add(user)expect(@@ -2169,7 +2169,7 @@ RSpec.describe TopicsFilter doshared_examples "filtering for topics by counts" do |filter|describe "when query string is `#{filter}-min:1`" do- it "should only return topics with at least 1 #{filter}" do+ it "returns only topics with at least one #{filter}" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2180,7 +2180,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `#{filter}-min:3`" do- it "should only return topics with at least 3 #{filter}" do+ it "returns only topics with at least three #{filter}" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2191,7 +2191,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `#{filter}-max:1`" do- it "should only return topics with at most 1 #{filter}" do+ it "returns only topics with at most one #{filter}" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2202,7 +2202,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `#{filter}-max:3`" do- it "should only return topics with at most 3 #{filter}" do+ it "returns only topics with at most three #{filter}" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2213,7 +2213,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `#{filter}-min:1 #{filter}-max:2`" do- it "should only return topics with at least 1 like and at most 2 #{filter}" do+ it "returns topics with at least one like and at most two #{filter}" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2224,7 +2224,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `#{filter}-min:3 #{filter}-min:2 #{filter}-max:1 #{filter}-max:3`" do- it "should only return topics with at least 2 #{filter} and at most 3 #{filter} as it ignores earlier filters which are duplicated" do+ it "uses the last duplicate filters to constrain the #{filter} count" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2237,7 +2237,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `#{filter}-min:invalid #{filter}-max:invalid`" do- it "should ignore the filters with invalid values" do+ it "ignores filters with invalid values" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2304,7 +2304,7 @@ RSpec.describe TopicsFilter dofab!(:topic2) { Fabricate(:topic, column => Time.zone.local(2023, 5, 12)) }describe "when query string is `#{filter}-after:invalid-date-test`" do- it "should ignore the filter" do+ it "ignores the filter" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2315,7 +2315,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `#{filter}-after:2022-01-01`" do- it "should only return topics with #{description} after 2022-01-01" do+ it "returns only topics with #{description} after 2022-01-01" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2326,7 +2326,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `#{filter}-after:2023-01-1`" do- it "should only return topics with #{description} after 2023-01-01" do+ it "returns only topics with #{description} after 2023-01-01" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2337,7 +2337,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `#{filter}-after:2023-6-01`" do- it "should only return topics with #{description} after 2023-06-01" do+ it "returns only topics with #{description} after 2023-06-01" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2348,7 +2348,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `#{filter}-before:2023-01-01`" do- it "should only return topics with #{description} before 2023-01-01" do+ it "returns only topics with #{description} before 2023-01-01" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2359,7 +2359,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `#{filter}-before:2023-1-1`" do- it "should only return topics with #{description} before 2023-01-01" do+ it "returns only matching topics with #{description} before 2023-01-01" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2370,7 +2370,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `#{filter}-before:2000-01-01`" do- it "should only return topics with #{description} before 2000-01-01" do+ it "returns only topics with #{description} before 2000-01-01" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2381,7 +2381,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `#{filter}-after:1`" do- it "should only return topics with #{description} after 1 day ago" do+ it "returns only topics with #{description} after one day ago" dofreeze_time do_old_topic = Fabricate(:topic, column => 2.days.ago)recent_topic = Fabricate(:topic, column => Time.zone.now)@@ -2397,7 +2397,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `#{filter}-before:1`" do- it "should only return topics with #{description} before 1 day ago" do+ it "returns only topics with #{description} before one day ago" dofreeze_time doold_topic = Fabricate(:topic, column => 2.days.ago)recent_topic = Fabricate(:topic, column => Time.zone.now)@@ -2415,7 +2415,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `#{filter}-after:0`" do- it "should only return topics with #{description} after today" do+ it "returns only topics with #{description} after today" dofreeze_time do_old_topic = Fabricate(:topic, column => 2.days.ago)recent_topic = Fabricate(:topic, column => Time.zone.now)@@ -2622,7 +2622,7 @@ RSpec.describe TopicsFilter do# when ordered by the given filter in descending order.shared_examples "ordering topics filters" do |order, order_description|describe "when query string is `order:#{order}`" do- it "should return topics ordered by #{order_description} in descending order" do+ it "returns topics ordered by #{order_description} descending" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2633,7 +2633,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `order:#{order}-asc`" do- it "should return topics ordered by #{order_description} in ascending order" do+ it "returns topics ordered by #{order_description} ascending" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2644,7 +2644,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `order:#{order}-invalid`" do- it "should return topics ordered by the database's default order" do+ it "returns topics in the database's default order" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2763,7 +2763,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `order:read`" do- it "should return topics ordered by last visited date in descending order for logged in users" do+ it "orders topics by last visit descending for logged-in users" doexpect(TopicsFilter.new(guardian: Guardian.new(user))@@ -2772,7 +2772,7 @@ RSpec.describe TopicsFilter do).to eq([topic2.id, topic.id, topic3.id])end- it "should not apply any special ordering for anonymous users" do+ it "does not apply special ordering for anonymous users" dotopics =TopicsFilter.new(guardian: Guardian.new)@@ -2784,7 +2784,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `order:read-asc`" do- it "should return topics ordered by last visited date in ascending order for logged in users" do+ it "orders topics by last visit ascending for logged-in users" doexpect(TopicsFilter.new(guardian: Guardian.new(user))@@ -2801,7 +2801,7 @@ RSpec.describe TopicsFilter dofab!(:topic3) { Fabricate(:topic, created_at: Time.zone.local(2024, 1, 1), views: 1) }describe "when query string is `order:created,views`" do- it "should return topics ordered by creation date in descending order and then number of views in descending order" do+ it "orders topics by creation date and view count descending" doexpect(TopicsFilter.new(guardian: Guardian.new)@@ -2812,7 +2812,7 @@ RSpec.describe TopicsFilter doenddescribe "when query string is `order:created order:views`" do- it "should return topics ordered by creation date in descending order and then number of views in descending order" do+ it "uses creation date and view count as descending tie-breakers" doexpect(TopicsFilter.new(guardian: Guardian.new)diff --git a/spec/lib/truncate_logs_formatter_spec.rb b/spec/lib/truncate_logs_formatter_spec.rbindex c1df6ea0f86..6aab6539a03 100644--- a/spec/lib/truncate_logs_formatter_spec.rb+++ b/spec/lib/truncate_logs_formatter_spec.rb@@ -6,23 +6,23 @@ RSpec.describe TruncateLogsFormatter dolet(:formatter) { TruncateLogsFormatter.new(log_line_max_chars: 10) }describe "when the messages is 5 characters long" do- it "should not carry out any truncation of the message" do+ it "does not truncate the message" doexpect(formatter.call(nil, nil, nil, "abcde")).to eq("abcde")endenddescribe "when the message is 10 characters long" do- it "should not carry out any truncation of the message" do+ it "does not truncate the message" doexpect(formatter.call(nil, nil, nil, "aaaaaaaaaa")).to eq("aaaaaaaaaa")endenddescribe "when the message is 11 characters long" do- it "should truncate the message with the right postfix" do+ it "truncates the message with the configured postfix" doexpect(formatter.call(nil, nil, nil, "aaaaaaaaaaa")).to eq("aaaaaaaaaa...(truncated)")end- it "should truncate the message with the right postfix while preserving newlines" do+ it "truncates the message while preserving newlines" doexpect(formatter.call(nil, nil, nil, "aaaaaaaaaaa\n")).to eq("aaaaaaaaaa...(truncated)\n")endenddiff --git a/spec/lib/turbo_tests/flaky/manager_spec.rb b/spec/lib/turbo_tests/flaky/manager_spec.rbindex c6cc28e651c..e66392da309 100644--- a/spec/lib/turbo_tests/flaky/manager_spec.rb+++ b/spec/lib/turbo_tests/flaky/manager_spec.rb@@ -54,7 +54,7 @@ RSpec.describe TurboTests::Flaky::Manager doenddescribe ".potential_flaky_tests" do- it "should return the failed examples' `location_rerun_argument`" do+ it "returns the failed examples' location_rerun_argument" dowith_fake_path doTurboTests::Flaky::Manager.log_potential_flaky_tests([fake_example_1, fake_example_2])@@ -69,7 +69,7 @@ RSpec.describe TurboTests::Flaky::Manager doenddescribe ".log_potential_flaky_tests" do- it "should log the failed examples correctly" do+ it "logs the failed examples" dowith_fake_path doTurboTests::Flaky::Manager.log_potential_flaky_tests([fake_example_1, fake_example_2])@@ -105,7 +105,7 @@ RSpec.describe TurboTests::Flaky::Manager doenddescribe ".remove_example" do- it "should remove the from the log file" do+ it "removes the examples from the log file" dowith_fake_path doTurboTests::Flaky::Manager.log_potential_flaky_tests([fake_example_1, fake_example_2])TurboTests::Flaky::Manager.remove_example([rspec_example_1])@@ -117,7 +117,7 @@ RSpec.describe TurboTests::Flaky::Manager doendend- it "should delete the log file if there are no more examples" do+ it "deletes the log file when no examples remain" dowith_fake_path doTurboTests::Flaky::Manager.log_potential_flaky_tests([fake_example_1, fake_example_2])TurboTests::Flaky::Manager.remove_example([rspec_example_1, rspec_example_2])diff --git a/spec/lib/unread_spec.rb b/spec/lib/unread_spec.rbindex c5409fe9a23..ea73a21adc7 100644--- a/spec/lib/unread_spec.rb+++ b/spec/lib/unread_spec.rb@@ -23,7 +23,7 @@ RSpec.describe Unread doenddescribe "staff counts" do- it "should correctly return based on staff post number" do+ it "calculates unread posts from the staff post number" doSiteSetting.whispers_allowed_groups = "#{Group::AUTO_GROUPS[:staff]}"user.grant_admin!@@ -34,7 +34,7 @@ RSpec.describe Unread doenddescribe "unread_posts" do- it "should have 0 unread posts if the user has read all posts" do+ it "returns zero unread posts when the user has read every post" dotopic_user.last_read_post_number = 13expect(unread.unread_posts).to eq(0)end@@ -57,7 +57,7 @@ RSpec.describe Unread doexpect(unread.unread_posts).to eq(5)end- it "should have 0 unread posts if the user has read more posts than exist (deleted)" do+ it "returns zero unread posts when deleted posts exceed the remaining unread count" dotopic_user.last_read_post_number = 14expect(unread.unread_posts).to eq(0)enddiff --git a/spec/lib/upload_creator_spec.rb b/spec/lib/upload_creator_spec.rbindex c9af39f403b..90e539511c9 100644--- a/spec/lib/upload_creator_spec.rb+++ b/spec/lib/upload_creator_spec.rb@@ -98,7 +98,7 @@ RSpec.describe UploadCreator dolet(:filename) { "utf-8.txt" }let(:file) { file_from_fixtures(filename, "encodings") }- it "should store the upload with the right extension" do+ it "stores the upload with the expected extension" doexpect do UploadCreator.new(file, "utf-8\n.txt").create_for(user.id) end.to change {Upload.count}.by(1)@@ -125,7 +125,7 @@ RSpec.describe UploadCreator dolet(:longextension) { "fake.long-FileExtension" }let(:file2) { file_from_fixtures(longextension) }- it "should truncate long extension names" do+ it "truncates long extension names" doexpect doUploadCreator.new(file2, "fake.long-FileExtension").create_for(user.id)end.to change { Upload.count }.by(1)@@ -143,7 +143,7 @@ RSpec.describe UploadCreator dobefore { SiteSetting.authorized_extensions = "jpg" }- it "should create the right upload" do+ it "creates the expected upload" doupload =UploadCreator.new(file, filename, for_site_setting: true).create_for(Discourse.system_user.id,@@ -180,7 +180,7 @@ RSpec.describe UploadCreator dolet(:filename) { "tiff_as.bin" }let(:file) { file_from_fixtures(filename) }- it "should not correct the coerce filename" do+ it "does not correct the coerced filename" doexpect do UploadCreator.new(file, filename).create_for(user.id) end.to change {Upload.count}.by(1)@@ -317,7 +317,7 @@ RSpec.describe UploadCreator dolet(:filename) { "pngquant.png" }let(:file) { file_from_fixtures(filename) }- it "should apply pngquant to optimized images" do+ it "applies pngquant to optimized images" doupload =UploadCreator.new(file, filename, pasted: true, force_optimize: true).create_for(user.id)@@ -354,7 +354,7 @@ RSpec.describe UploadCreator dobefore { SiteSetting.png_to_jpg_quality = 1 }- it "should not store file as jpeg if it does not meet absolute byte saving requirements" do+ it "does not store a JPEG when the absolute byte savings are insufficient" do# logo.png is 2297 bytes, converting to jpeg saves 30% but does not meet# the absolute savings required of 25_000 bytes, if you save less than that# skip this@@ -375,7 +375,7 @@ RSpec.describe UploadCreator doexpect(upload.original_filename).to eq("logo.png")end- it "should store the upload with the right extension" do+ it "stores the upload with the expected extension" doexpect doUploadCreator.new(file, filename, pasted: true, force_optimize: true).create_for(user.id)end.to change { Upload.count }.by(1)@@ -389,7 +389,7 @@ RSpec.describe UploadCreator doexpect(FastImage.size(Discourse.store.path_for(upload))).to eq([303, 231])end- it "should not convert to jpeg when the image is uploaded from site setting" do+ it "does not convert site-setting images to JPEG" doupload =UploadCreator.new(large_file,@@ -403,7 +403,7 @@ RSpec.describe UploadCreator doexpect(upload.original_filename).to eq("large_and_unoptimized.png")end- it "should not convert to jpeg for admin asset upload types" do+ it "does not convert admin asset uploads to JPEG" doupload =UploadCreator.new(large_file,@@ -424,7 +424,7 @@ RSpec.describe UploadCreator doSiteSetting.image_preview_jpg_quality = 10end- it "should alter the image quality" do+ it "alters the image quality" doupload = UploadCreator.new(file, filename, force_optimize: true).create_for(user.id)expect(image_quality(upload.url)).to eq(SiteSetting.recompress_original_jpg_quality)@@ -437,7 +437,7 @@ RSpec.describe UploadCreator do)end- it "should not convert animated images" do+ it "does not convert animated images" doexpect doUploadCreator.new(animated_file, animated_filename, force_optimize: true).create_for(user.id,@@ -458,7 +458,7 @@ RSpec.describe UploadCreator doSiteSetting.image_preview_jpg_quality = 10end- it "should not convert to jpeg when png_to_jpg_quality is 100" do+ it "does not convert to JPEG when png_to_jpg_quality is 100" doupload =UploadCreator.new(large_file, large_filename, force_optimize: true).create_for(user.id,@@ -469,7 +469,7 @@ RSpec.describe UploadCreator doexpect(upload.original_filename).to eq("large_and_unoptimized.png")end- it "should not convert pasted images to jpeg when png_to_jpg_quality is 100" do+ it "does not convert pasted images when png_to_jpg_quality is 100" doupload =UploadCreator.new(large_file,@@ -484,7 +484,7 @@ RSpec.describe UploadCreator doendend- it "should not convert animated WEBP images" do+ it "does not convert animated WebP images" doexpect doUploadCreator.new(animated_webp_file,@@ -506,7 +506,7 @@ RSpec.describe UploadCreator dolet(:filename) { "should_be_jpeg.heic" }let(:file) { file_from_fixtures(filename, "images") }- it "should store the upload with the right extension" do+ it "stores the upload with the expected extension" doexpect doUploadCreator.new(file, filename, force_optimize: true).create_for(user.id)end.to change { Upload.count }.by(1)@@ -532,14 +532,14 @@ RSpec.describe UploadCreator doSiteSetting.authorized_extensions = "pdf|svg|jpg"end- it "should mark attachments as secure" do+ it "marks attachments as secure" doupload = UploadCreator.new(file, filename, opts).create_for(user.id)stored_upload = Upload.lastexpect(stored_upload.secure?).to eq(true)end- it "should not mark theme uploads as secure" do+ it "does not mark theme uploads as secure" dofname = "custom-theme-icon-sprite.svg"upload = UploadCreator.new(file_from_fixtures(fname), fname, for_theme: true).create_for(-1)@@ -570,7 +570,7 @@ RSpec.describe UploadCreator dostub_s3_storeend- it "should store the file and return etag" do+ it "stores the file and returns its ETag" doexpect { UploadCreator.new(file, filename).create_for(user.id) }.to change {Upload.count}.by(1)@@ -580,7 +580,7 @@ RSpec.describe UploadCreator doexpect(upload.etag).to eq("ETag")end- it "should return signed URL for secure attachments in S3" do+ it "returns a signed URL for secure S3 attachments" doSiteSetting.authorized_extensions = "pdf"SiteSetting.secure_uploads = true@@ -593,7 +593,7 @@ RSpec.describe UploadCreator doexpect(signed_url).to match(/Amz-Credential/)end- it "should return CDN URL when enabled" do+ it "returns the CDN URL when enabled" doSiteSetting.s3_use_cdn_url_for_all_uploads = trueSiteSetting.authorized_extensions = "pdf"SiteSetting.s3_cdn_url = "https://example-cdn.com"@@ -795,7 +795,7 @@ RSpec.describe UploadCreator dolet(:animated_filename) { "animated.gif" }let(:animated_file) { file_from_fixtures(animated_filename) }- it "should not be cropped if animated" do+ it "does not crop animated images" doupload =UploadCreator.new(animated_file,@@ -858,7 +858,7 @@ RSpec.describe UploadCreator dolet(:zero_sized_svg_filename) { "zero_sized.svg" }let(:zero_sized_svg_file) { file_from_fixtures(zero_sized_svg_filename) }- it "should be viewable when a dimension is a fraction of a unit" do+ it "remains viewable when a dimension is fractional" doupload =UploadCreator.new(tiny_svg_file, tiny_svg_filename, force_optimize: true).create_for(user.id,@@ -871,7 +871,7 @@ RSpec.describe UploadCreator doexpect(upload.thumbnail_height).to be <= SiteSetting.max_image_heightend- it "should not be larger than the maximum thumbnail size" do+ it "does not exceed the maximum thumbnail size" doupload =UploadCreator.new(massive_svg_file, massive_svg_filename, force_optimize: true).create_for(user.id,@@ -884,7 +884,7 @@ RSpec.describe UploadCreator doexpect(upload.thumbnail_height).to be <= SiteSetting.max_image_heightend- it "should handle zero dimension files" do+ it "handles files with a zero dimension" doupload =UploadCreator.new(zero_sized_svg_file,diff --git a/spec/lib/url_helper_spec.rb b/spec/lib/url_helper_spec.rbindex 2d29593db6d..142dc8f3acf 100644--- a/spec/lib/url_helper_spec.rb+++ b/spec/lib/url_helper_spec.rb@@ -176,7 +176,7 @@ RSpec.describe UrlHelper dolet(:url) { "/#{Discourse.store.upload_path}/1X/575bcc2886bf7a39684b57ca90be85f7d399bbc7.png" }let(:asset_host) { "//my.awesome.cdn" }- it "should return correct cdn url for local relative urls" do+ it "returns CDN URLs for local relative URLs" doset_cdn_url asset_hostcdn_url = UrlHelper.local_cdn_url(url)expect(cdn_url).to eq("#{asset_host}#{url}")@@ -271,42 +271,42 @@ RSpec.describe UrlHelper doenddescribe ".is_valid_url?" do- it "should return true for a valid HTTP URL" do+ it "accepts a valid HTTP URL" doexpect(described_class.is_valid_url?("http://www.example.com")).to eq(true)end- it "should return true for a valid HTTPS URL" do+ it "accepts a valid HTTPS URL" doexpect(described_class.is_valid_url?("https://www.example.com")).to eq(true)end- it "should return true for a valid FTP URL" do+ it "accepts a valid FTP URL" doexpect(described_class.is_valid_url?("ftp://example.com")).to eq(true)end- it "should return true for a valid mailto URL" do+ it "accepts a valid mailto URL" doexpect(described_class.is_valid_url?("mailto:[email protected]")).to eq(true)end- it "should return true for a valid LDAP URL" do+ it "accepts a valid LDAP URL" doexpect(described_class.is_valid_url?("ldap://ldap.example.com/dc=example;dc=com?quer")).to eq(true,)end- it "should return true for a path" do+ it "accepts a path" doexpect(described_class.is_valid_url?("/some/path")).to eq(true)end- it "should return true for a path with query params" do+ it "accepts a path with query parameters" doexpect(described_class.is_valid_url?("/some/path?query=param")).to eq(true)end- it "should return true for anchor links" do+ it "accepts anchor links" doexpect(described_class.is_valid_url?("#anchor")).to eq(true)expect(described_class.is_valid_url?("#")).to eq(true)end- it "should return false for invalid urls" do+ it "rejects invalid URLs" doexpect(described_class.is_valid_url?("")).to eq(false)expect(described_class.is_valid_url?("http//www.example.com")).to eq(false)expect(described_class.is_valid_url?("http:/www.example.com")).to eq(false)diff --git a/spec/lib/user_name_suggester_spec.rb b/spec/lib/user_name_suggester_spec.rbindex cdfea5d5a09..fd79e663a8e 100644--- a/spec/lib/user_name_suggester_spec.rb+++ b/spec/lib/user_name_suggester_spec.rb@@ -122,7 +122,7 @@ RSpec.describe UserNameSuggester doexpect(UserNameSuggester.suggest("Darth_-_Vader")).to eq("Darth_Vader")end- it "should handle typical facebook usernames" do+ it "handles typical Facebook usernames" doexpect(UserNameSuggester.suggest("roger.nelson.3344913")).to eq("roger.nelson.33")enddiff --git a/spec/lib/validators/allowed_ip_address_validator_spec.rb b/spec/lib/validators/allowed_ip_address_validator_spec.rbindex 69c3fb3b23a..f217c28ecd4 100644--- a/spec/lib/validators/allowed_ip_address_validator_spec.rb+++ b/spec/lib/validators/allowed_ip_address_validator_spec.rb@@ -7,7 +7,7 @@ RSpec.describe AllowedIpAddressValidator dolet(:validator) { described_class.new(attributes: :ip_address) }context "when ip address should be blocked" do- it "should add an error" do+ it "adds an error" doScreenedIpAddress.stubs(:should_block?).returns(true)validateexpect(record.errors[:ip_address]).to be_present@@ -18,7 +18,7 @@ RSpec.describe AllowedIpAddressValidator doendcontext "when ip address isn't allowed for registration" do- it "should add an error" do+ it "adds an error" doSpamHandler.stubs(:should_prevent_registration_from_ip?).returns(true)validateexpect(record.errors[:ip_address]).to be_present@@ -31,7 +31,7 @@ RSpec.describe AllowedIpAddressValidator doendcontext "when ip address should not be blocked" do- it "shouldn't add an error" do+ it "does not add an error" doScreenedIpAddress.stubs(:should_block?).returns(false)validateexpect(record.errors[:ip_address]).not_to be_present@@ -39,7 +39,7 @@ RSpec.describe AllowedIpAddressValidator doendcontext "when ip_address is nil" do- it "shouldn't add an error" do+ it "does not add an error" doScreenedIpAddress.expects(:should_block?).neverrecord.ip_address = nilvalidatediff --git a/spec/lib/validators/category_search_priority_weights_validator_spec.rb b/spec/lib/validators/category_search_priority_weights_validator_spec.rbindex 3bafa112add..15b0a874ad6 100644--- a/spec/lib/validators/category_search_priority_weights_validator_spec.rb+++ b/spec/lib/validators/category_search_priority_weights_validator_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe CategorySearchPriorityWeightsValidator do- it "should validate the results correctly" do+ it "validates category search priority weights" do[1, 1.1].each do |value|expect do SiteSetting.category_search_priority_low_weight = value end.to raise_error(Discourse::InvalidParameters,diff --git a/spec/lib/validators/email_address_validator_spec.rb b/spec/lib/validators/email_address_validator_spec.rbindex a51d6373ac5..52225017544 100644--- a/spec/lib/validators/email_address_validator_spec.rb+++ b/spec/lib/validators/email_address_validator_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe EmailAddressValidator do- it "should match valid emails" do+ it "matches valid email addresses" do[@@ -10,7 +10,7 @@ RSpec.describe EmailAddressValidator do].each { |email| expect(EmailAddressValidator.valid_value?(email)).to eq(true) }end- it "should not match invalid emails" do+ it "rejects invalid email addresses" do["testdiscourse.org","frank@invalid_host.contoso.com",diff --git a/spec/lib/validators/enable_discourse_id_validator_spec.rb b/spec/lib/validators/enable_discourse_id_validator_spec.rbindex ec6fd3eaf8d..99174f74a2b 100644--- a/spec/lib/validators/enable_discourse_id_validator_spec.rb+++ b/spec/lib/validators/enable_discourse_id_validator_spec.rb@@ -11,13 +11,13 @@ RSpec.describe EnableDiscourseIdValidator doenddescribe "when value is false" do- it "should be valid" do+ it "accepts disabling Discourse ID" doexpect(validator.valid_value?("f")).to eq(true)endenddescribe "when value is true" do- it "should be valid" do+ it "accepts enabling Discourse ID" doexpect(validator.valid_value?("t")).to eq(true)endend@@ -27,20 +27,20 @@ RSpec.describe EnableDiscourseIdValidator dobefore { SiteSetting.discourse_id_client_id = "" }describe "when value is false" do- it "should be valid" do+ it "accepts disabling Discourse ID" doexpect(validator.valid_value?("f")).to eq(true)endenddescribe "when value is true" do- it "should automatically register" do+ it "registers automatically" doallow(DiscourseId::Register).to receive(:call).and_return(instance_double(Service::Base::Context, success?: true),)expect(validator.valid_value?("t")).to eq(true)end- it "should show an appropriate error message when something went wrong" do+ it "returns the registration error message" dofailed_context = Service::Base::Context.newfailed_context.fail(error: "an error")allow(DiscourseId::Register).to receive(:call).and_return(failed_context)@@ -66,7 +66,7 @@ RSpec.describe EnableDiscourseIdValidator dobefore { SiteSetting.discourse_id_client_secret = "" }describe "when value is false" do- it "should be valid" do+ it "accepts disabling Discourse ID" doexpect(validator.valid_value?("f")).to eq(true)endenddiff --git a/spec/lib/validators/enable_local_logins_via_email_validator_spec.rb b/spec/lib/validators/enable_local_logins_via_email_validator_spec.rbindex ff68d47a608..a3be95a830a 100644--- a/spec/lib/validators/enable_local_logins_via_email_validator_spec.rb+++ b/spec/lib/validators/enable_local_logins_via_email_validator_spec.rb@@ -8,13 +8,13 @@ RSpec.describe EnableLocalLoginsViaEmailValidator dobefore { SiteSetting.enable_local_logins = false }describe "when val is false" do- it "should be valid" do+ it "accepts the setting value" doexpect(validator.valid_value?("f")).to eq(true)endenddescribe "when value is true" do- it "should not be valid" do+ it "rejects the setting value" doexpect(validator.valid_value?("t")).to eq(false)expect(validator.error_message).to eq(@@ -28,13 +28,13 @@ RSpec.describe EnableLocalLoginsViaEmailValidator dobefore { SiteSetting.enable_local_logins = true }describe "when val is false" do- it "should be valid" do+ it "accepts the setting value" doexpect(validator.valid_value?("f")).to eq(true)endenddescribe "when value is true" do- it "should be valid" do+ it "accepts the setting value" doexpect(validator.valid_value?("t")).to eq(true)endenddiff --git a/spec/lib/validators/enable_sso_validator_spec.rb b/spec/lib/validators/enable_sso_validator_spec.rbindex eb218792f20..eb89f680f4b 100644--- a/spec/lib/validators/enable_sso_validator_spec.rb+++ b/spec/lib/validators/enable_sso_validator_spec.rb@@ -8,13 +8,13 @@ RSpec.describe EnableSsoValidator dobefore { SiteSetting.discourse_connect_url = "" }describe "when val is false" do- it "should be valid" do+ it "accepts disabling DiscourseConnect" doexpect(validator.valid_value?("f")).to eq(true)endenddescribe "when value is true" do- it "should not be valid" do+ it "rejects enabling DiscourseConnect without a URL" doexpect(validator.valid_value?("t")).to eq(false)expect(validator.error_message).to eq(@@ -31,13 +31,13 @@ RSpec.describe EnableSsoValidator doenddescribe "when value is false" do- it "should be valid" do+ it "accepts disabling DiscourseConnect" doexpect(validator.valid_value?("f")).to eq(true)endenddescribe "when value is true" do- it "should be valid" do+ it "accepts enabling DiscourseConnect" doexpect(validator.valid_value?("t")).to eq(true)endend@@ -47,13 +47,13 @@ RSpec.describe EnableSsoValidator dobefore { SiteSetting.discourse_connect_url = "https://www.example.com/sso" }describe "when val is false" do- it "should be valid" do+ it "accepts disabling DiscourseConnect" doexpect(validator.valid_value?("f")).to eq(true)endenddescribe "when value is true" do- it "should not be valid" do+ it "rejects enabling DiscourseConnect without a secret" doexpect(validator.valid_value?("t")).to eq(false)expect(validator.error_message).to eq(@@ -70,7 +70,7 @@ RSpec.describe EnableSsoValidator doenddescribe "when value is true" do- it "should not be valid" do+ it "rejects enabling DiscourseConnect with a short secret" doexpect(validator.valid_value?("t")).to eq(false)expect(validator.error_message).to eq(@@ -86,13 +86,13 @@ RSpec.describe EnableSsoValidator doSiteSetting.discourse_connect_secret = "x" * 10end- it "should be invalid" do+ it "rejects enabling DiscourseConnect when second factor is enforced" doSiteSetting.enforce_second_factor = "all"expect(validator.valid_value?("t")).to eq(false)end- it "should be valid" do+ it "accepts enabling DiscourseConnect when second factor is optional" doSiteSetting.enforce_second_factor = "no"expect(validator.valid_value?("t")).to eq(true)diff --git a/spec/lib/validators/ip_address_format_validator_spec.rb b/spec/lib/validators/ip_address_format_validator_spec.rbindex d0c5abc71bb..371d5cffb5f 100644--- a/spec/lib/validators/ip_address_format_validator_spec.rb+++ b/spec/lib/validators/ip_address_format_validator_spec.rb@@ -7,20 +7,20 @@ RSpec.describe IpAddressFormatValidator dolet(:validator) { described_class.new(attributes: :ip_address) }%w[99.232.23.123 99.232.0.0/16 fd12:db8::ff00:42:8329 fc00::/7].each do |arg|- it "should not add an error for #{arg}" do+ it "accepts #{arg}" dorecord.ip_address = argvalidateexpect(record.errors[:ip_address]).not_to be_presentendend- it "should add an error for nil IP address" do+ it "adds an error for a nil IP address" dorecord.ip_address = nilvalidateexpect(record.errors[:ip_address]).to be_presentend- it "should add an error for invalid IP address" do+ it "adds an error for an invalid IP address" dorecord.ip_address = "99.99.99"validateexpect(record.errors[:ip_address]).to be_presentdiff --git a/spec/lib/validators/linkedin_oidc_credentials_validator_spec.rb b/spec/lib/validators/linkedin_oidc_credentials_validator_spec.rbindex e3419dbe181..63f7f088e16 100644--- a/spec/lib/validators/linkedin_oidc_credentials_validator_spec.rb+++ b/spec/lib/validators/linkedin_oidc_credentials_validator_spec.rb@@ -11,13 +11,13 @@ RSpec.describe LinkedinOidcCredentialsValidator doenddescribe "when val is false" do- it "should be valid" do+ it "accepts the setting value" doexpect(validator.valid_value?("f")).to eq(true)endenddescribe "when value is true" do- it "should be valid" do+ it "accepts the setting value" doexpect(validator.valid_value?("t")).to eq(true)endend@@ -30,13 +30,13 @@ RSpec.describe LinkedinOidcCredentialsValidator doenddescribe "when value is false" do- it "should be valid" do+ it "accepts the setting value" doexpect(validator.valid_value?("f")).to eq(true)endenddescribe "when value is true" do- it "should not be valid" do+ it "rejects the setting value" doexpect(validator.valid_value?("t")).to eq(false)expect(validator.error_message).to eq(diff --git a/spec/lib/validators/post_validator_spec.rb b/spec/lib/validators/post_validator_spec.rbindex 3bc1490255c..8cbdb3c74af 100644--- a/spec/lib/validators/post_validator_spec.rb+++ b/spec/lib/validators/post_validator_spec.rb@@ -6,7 +6,7 @@ RSpec.describe PostValidator dolet(:validator) { PostValidator.new({}) }describe "post_body_validator" do- it "should not allow a post with an empty raw" do+ it "rejects a post with an empty body" dopost.raw = ""validator.post_body_validator(post)expect(post.errors).to_not be_empty@@ -15,7 +15,7 @@ RSpec.describe PostValidator docontext "when empty raw can bypass validation" dolet(:validator) { PostValidator.new(skip_post_body: true) }- it "should be allowed for empty raw based on site setting" do+ it "accepts an empty body when enabled in site settings" dopost.raw = ""validator.post_body_validator(post)expect(post.errors).to be_empty@@ -36,7 +36,7 @@ RSpec.describe PostValidator do)end- it "should allow a post with an empty raw" do+ it "accepts a post with an empty body" dopost = Fabricate.build(:post, topic: topic)post.raw = ""validator.post_body_validator(post)@@ -138,20 +138,20 @@ RSpec.describe PostValidator doenddescribe "max_posts_validator" do- it "should be invalid when the user has posted too much" do+ it "rejects new posts when the user exceeds the posting limit" dopost.user.expects(:posted_too_much_in_topic?).returns(true)validator.max_posts_validator(post)expect(post.errors.count).to be > 0end- it "should be allowed to edit when the user has posted too much" do+ it "allows edits when the user exceeds the posting limit" dopost.user.stubs(:posted_too_much_in_topic?).returns(true)post.expects(:new_record?).returns(false)validator.max_posts_validator(post)expect(post.errors.count).to be(0)end- it "should be valid when the user hasn't posted too much" do+ it "accepts posts within the user's posting limit" dopost.user.expects(:posted_too_much_in_topic?).returns(false)validator.max_posts_validator(post)expect(post.errors.count).to be(0)@@ -183,12 +183,12 @@ RSpec.describe PostValidator docontext "when post is unique" dolet(:new_post) { Fabricate.build(:post, user: user, raw: "unique content", topic: topic) }- it "should not add an error" do+ it "does not add a validation error" dovalidator.unique_post_validator(new_post)expect(new_post.errors.count).to eq(0)end- it "should not add an error when changing an existing post" do+ it "does not add an error when changing an existing post" dopost.raw = "changing raw"validator.unique_post_validator(post)@@ -206,21 +206,21 @@ RSpec.describe PostValidator do)end- it "should add an error for post dupes" do+ it "adds an error for duplicate posts" donew_post = build_post(is_pm: false, raw: post.raw)validator.unique_post_validator(new_post)expect(new_post.errors.to_hash.keys).to contain_exactly(:raw)end- it "should add an error for pm dupes" do+ it "adds an error for duplicate PMs" donew_post = build_post(is_pm: true, raw: pm_post.raw)validator.unique_post_validator(new_post)expect(new_post.errors.to_hash.keys).to contain_exactly(:raw)end- it "should not add an error for cross PM / topic dupes" do+ it "allows duplicate content across PMs and topics" donew_post = build_post(is_pm: true, raw: post.raw)validator.unique_post_validator(new_post)@@ -232,7 +232,7 @@ RSpec.describe PostValidator doexpect(new_post.errors.count).to eq(0)end- it "should not add an error if post.skip_unique_check is true" do+ it "skips duplicate validation when post.skip_unique_check is true" donew_post = build_post(is_pm: false, raw: post.raw)new_post.skip_unique_check = true@@ -248,28 +248,28 @@ RSpec.describe PostValidator doSiteSetting.max_mentions_per_post = 3end- it "should be invalid when new user exceeds max mentions limit" do+ it "rejects new users exceeding the mention limit" dopost.acting_user = build(:newuser)post.expects(:raw_mentions).returns(%w[jake finn jake_old])validator.max_mention_validator(post)expect(post.errors.count).to be > 0end- it "should be invalid when leader user exceeds max mentions limit" do+ it "rejects leader users exceeding the mention limit" dopost.acting_user = build(:trust_level_4)post.expects(:raw_mentions).returns(%w[jake finn jake_old jake_new])validator.max_mention_validator(post)expect(post.errors.count).to be > 0end- it "should be valid when new user does not exceed max mentions limit" do+ it "accepts new users within the mention limit" dopost.acting_user = build(:newuser)post.expects(:raw_mentions).returns(%w[jake finn])validator.max_mention_validator(post)expect(post.errors.count).to be(0)end- it "should be valid when new user exceeds max mentions limit in PM" do+ it "accepts new users exceeding the mention limit in a PM" dopost.acting_user = build(:newuser)post.topic.expects(:private_message?).returns(true)post.expects(:raw_mentions).returns(%w[jake finn jake_old])@@ -277,21 +277,21 @@ RSpec.describe PostValidator doexpect(post.errors.count).to be(0)end- it "should be valid when leader user does not exceed max mentions limit" do+ it "accepts leader users within the mention limit" dopost.acting_user = build(:trust_level_4)post.expects(:raw_mentions).returns(%w[jake finn jake_old])validator.max_mention_validator(post)expect(post.errors.count).to be(0)end- it "should be valid for moderator in all cases" do+ it "exempts moderators from the mention limit" dopost.acting_user = build(:moderator)post.expects(:raw_mentions).nevervalidator.max_mention_validator(post)expect(post.errors.count).to be(0)end- it "should be valid for admin in all cases" do+ it "exempts admins from the mention limit" dopost.acting_user = build(:admin)post.expects(:raw_mentions).nevervalidator.max_mention_validator(post)@@ -348,21 +348,21 @@ RSpec.describe PostValidator doSiteSetting.newuser_max_embedded_media = 2end- it "should be invalid when new user exceeds max mentions limit" do+ it "rejects new users exceeding the mention limit" dopost.acting_user = new_userpost.expects(:embedded_media_count).returns(3)validator.max_embedded_media_validator(post)expect(post.errors.count).to be > 0end- it "should be valid when new user does not exceed max mentions limit" do+ it "accepts new users within the mention limit" dopost.acting_user = new_userpost.expects(:embedded_media_count).returns(2)validator.max_embedded_media_validator(post)expect(post.errors.count).to be(0)end- it "should be invalid when user trust level is not sufficient" do+ it "rejects users with insufficient trust level" doSiteSetting.embedded_media_post_allowed_groups = Group::AUTO_GROUPS[:trust_level_4]post.acting_user = Fabricate(:leader, groups: [])post.expects(:embedded_media_count).returns(2)@@ -370,14 +370,14 @@ RSpec.describe PostValidator doexpect(post.errors.count).to be > 0end- it "should be valid for moderator in all cases" do+ it "accepts moderator posts" dopost.acting_user = Fabricate(:moderator)post.expects(:embedded_media_count).nevervalidator.max_embedded_media_validator(post)expect(post.errors.count).to be(0)end- it "should be valid for admin in all cases" do+ it "accepts admin posts" dopost.acting_user = Fabricate(:admin)post.expects(:embedded_media_count).nevervalidator.max_embedded_media_validator(post)@@ -390,28 +390,28 @@ RSpec.describe PostValidator dobefore { SiteSetting.newuser_max_attachments = 2 }- it "should be invalid when new user exceeds max attachments limit" do+ it "rejects new users exceeding the attachment limit" dopost.acting_user = new_userpost.expects(:attachment_count).returns(3)validator.max_attachments_validator(post)expect(post.errors.count).to be > 0end- it "should be valid when new user does not exceed max attachments limit" do+ it "accepts new users within the attachment limit" dopost.acting_user = new_userpost.expects(:attachment_count).returns(2)validator.max_attachments_validator(post)expect(post.errors.count).to be(0)end- it "should be valid for moderator in all cases" do+ it "exempts moderators from the attachment limit" dopost.acting_user = Fabricate(:moderator)post.expects(:attachment_count).nevervalidator.max_attachments_validator(post)expect(post.errors.count).to be(0)end- it "should be valid for admin in all cases" do+ it "exempts admins from the attachment limit" dopost.acting_user = Fabricate(:admin)post.expects(:attachment_count).nevervalidator.max_attachments_validator(post)@@ -424,14 +424,14 @@ RSpec.describe PostValidator dobefore { SiteSetting.newuser_max_links = 2 }- it "should be invalid when new user exceeds max links limit" do+ it "rejects new users exceeding the link limit" dopost.acting_user = new_userpost.stubs(:link_count).returns(3)validator.max_links_validator(post)expect(post.errors.count).to be > 0end- it "should be valid when new user does not exceed max links limit" do+ it "accepts new users within the link limit" dopost.acting_user = new_userpost.stubs(:link_count).returns(2)validator.max_links_validator(post)@@ -446,7 +446,7 @@ RSpec.describe PostValidator dobefore { SiteSetting.max_consecutive_replies = 2 }- it "should always allow original poster to post" do+ it "allows the original poster to post" do[user, user, user, other_user, user, user, user].each_with_index do |u, i|post = Post.new(user: u, topic: topic, raw: "post number #{i}")validator.force_edit_last_validator(post)@@ -455,7 +455,7 @@ RSpec.describe PostValidator doendend- it "should allow category moderators to post more than 2 consecutive replies" do+ it "allows category moderators to post more than two consecutive replies" doSiteSetting.enable_category_group_moderation = truegroup = Fabricate(:group)GroupUser.create(group: group, user: user)@@ -472,7 +472,7 @@ RSpec.describe PostValidator doexpect(post.errors.count).to eq(0)end- it "should not allow posting more than 2 consecutive replies" do+ it "rejects more than two consecutive replies" doPost.create!(user: user, topic: topic, raw: "post number 2", post_number: 2)Post.create!(user: user, topic: topic, raw: "post number 3", post_number: 3)Post.create!(user: other_user, topic: topic, raw: "post number 1", post_number: 1)@@ -482,7 +482,7 @@ RSpec.describe PostValidator doexpect(post.errors.count).to eq(1)end- it "should always allow editing" do+ it "allows editing regardless of consecutive replies" dopost = Fabricate(:post, user: user, topic: topic)post = Fabricate(:post, user: user, topic: topic)@@ -490,7 +490,7 @@ RSpec.describe PostValidator dorevisor.revise!(post.user, raw: "hello world123456789")end- it "should allow posting more than 2 replies" do+ it "allows posting more than two replies" do3.times dopost = Fabricate(:post, user: user, topic: topic)Fabricate(:post, user: other_user, topic: topic)diff --git a/spec/lib/validators/regex_presence_validator_spec.rb b/spec/lib/validators/regex_presence_validator_spec.rbindex cac2332a2aa..5dc8ec7ded1 100644--- a/spec/lib/validators/regex_presence_validator_spec.rb+++ b/spec/lib/validators/regex_presence_validator_spec.rb@@ -19,7 +19,7 @@ RSpec.describe RegexPresenceValidator doenddescribe "when value is empty" do- it "should not be valid" do+ it "is invalid" doexpect(validator.valid_value?("")).to eq(false)expect(validator.error_message).to eq(I18n.t("site_settings.errors.must_include_latest"))diff --git a/spec/lib/validators/sso_overrides_email_validator_spec.rb b/spec/lib/validators/sso_overrides_email_validator_spec.rbindex 14cb29b36f7..92e4fa18ec0 100644--- a/spec/lib/validators/sso_overrides_email_validator_spec.rb+++ b/spec/lib/validators/sso_overrides_email_validator_spec.rb@@ -13,13 +13,13 @@ RSpec.describe SsoOverridesEmailValidator doenddescribe "when val is false" do- it "should be valid" do+ it "is valid" doexpect(validator.valid_value?("f")).to eq(true)endenddescribe "when value is true" do- it "should not be valid" do+ it "is invalid" doexpect(validator.valid_value?("t")).to eq(false)expect(validator.error_message).to eq(@@ -38,13 +38,13 @@ RSpec.describe SsoOverridesEmailValidator doenddescribe "when value is false" do- it "should be valid" do+ it "is valid" doexpect(validator.valid_value?("f")).to eq(true)endenddescribe "when value is true" do- it "should be valid" do+ it "is valid" doexpect(validator.valid_value?("t")).to eq(true)endenddiff --git a/spec/lib/wizard/step_updater_spec.rb b/spec/lib/wizard/step_updater_spec.rbindex 1252fda6091..5ed99754898 100644--- a/spec/lib/wizard/step_updater_spec.rb+++ b/spec/lib/wizard/step_updater_spec.rb@@ -28,7 +28,7 @@ RSpec.describe Wizard::StepUpdater doexpect(wizard.completed_steps?("setup")).to eq(true)end- it "won't allow updates to the default value when required" do+ it "prevents updates to a required default value" doupdater =wizard.create_updater("setup",diff --git a/spec/lib/wizard/wizard_builder_spec.rb b/spec/lib/wizard/wizard_builder_spec.rbindex b333cf8a4ee..361ef1f8289 100644--- a/spec/lib/wizard/wizard_builder_spec.rb+++ b/spec/lib/wizard/wizard_builder_spec.rb@@ -35,7 +35,7 @@ RSpec.describe Wizard::Builder dodescribe "setup step" dolet(:setup_step) { wizard.steps.find { |s| s.id == "setup" } }- it "should not prefill default site setting values" do+ it "does not prefill default site setting values" dofields = setup_step.fieldstitle_field = fields.first@@ -43,7 +43,7 @@ RSpec.describe Wizard::Builder doexpect(title_field.value).to eq("")end- it "should prefill overridden site setting values" do+ it "prefills overridden site setting values" doSiteSetting.title = "foobar"fields = setup_step.fields@@ -53,7 +53,7 @@ RSpec.describe Wizard::Builder doexpect(title_field.value).to eq("foobar")end- it "should set the right default value for privacy fields" do+ it "sets the default privacy field values" doSiteSetting.login_required = trueSiteSetting.invite_only = falseSiteSetting.must_approve_users = truediff --git a/spec/mailers/test_mailer_spec.rb b/spec/mailers/test_mailer_spec.rbindex f612d283dfd..e1f993736d3 100644--- a/spec/mailers/test_mailer_spec.rb+++ b/spec/mailers/test_mailer_spec.rb@@ -2,7 +2,7 @@RSpec.describe TestMailer dodescribe "send_test" do- it "works" do+ it "builds the test email" dotest_mailer = TestMailer.send_test("[email protected]")expect(test_mailer.from).to eq([SiteSetting.notification_email])diff --git a/spec/mailers/user_notifications_spec.rb b/spec/mailers/user_notifications_spec.rbindex af18031a1f4..26c6dc80439 100644--- a/spec/mailers/user_notifications_spec.rb+++ b/spec/mailers/user_notifications_spec.rb@@ -64,7 +64,7 @@ RSpec.describe UserNotifications dolet(:email_html) { Email::Renderer.new(email).html }- it "works" do+ it "addresses the signup email to the user with a subject and body" doexpect(email.to).to eq([user.email])expect(email.subject).to be_presentexpect(email.from).to eq([SiteSetting.notification_email])@@ -80,7 +80,7 @@ RSpec.describe UserNotifications dodescribe ".forgot_password" dosubject(:email) { UserNotifications.forgot_password(user) }- it "works" do+ it "addresses the password reset email to the user with a subject and body" doexpect(email.to).to eq([user.email])expect(email.subject).to be_presentexpect(email.from).to eq([SiteSetting.notification_email])@@ -103,7 +103,7 @@ RSpec.describe UserNotifications dodescribe ".post_approved" dofab!(:post)- it "works" do+ it "addresses the post approval email to the user with a subject and body" dosubject =UserNotifications.post_approved(user, { notification_data_hash: { post_url: post.url } })@@ -225,7 +225,7 @@ RSpec.describe UserNotifications dolet!(:another_post) { Fabricate(:post, topic: another_popular_topic, post_number: 1) }- it "works" do+ it "builds the digest with content, topic headers, and unsubscribe headers" doexpect(email.to).to eq([user.email])expect(email.subject).to be_presentexpect(email.from).to eq([SiteSetting.notification_email])@@ -660,7 +660,7 @@ RSpec.describe UserNotifications dodescribe "max_tags_per_email_subject siteSetting enabled" dobefore { SiteSetting.enable_max_tags_per_email_subject = true }- it "should match max_tags_per_email_subject" do+ it "limits subject tags to max_tags_per_email_subject" doSiteSetting.email_subject ="[%{site_name}] %{optional_pm}%{optional_cat}%{optional_tags}%{topic_title}"SiteSetting.max_tags_per_topic = 1@@ -683,7 +683,7 @@ RSpec.describe UserNotifications dodescribe "max_tags_per_email_subject siteSetting disabled" dobefore { SiteSetting.enable_max_tags_per_email_subject = false }- it "should match max_tags_per_topic" do+ it "limits subject tags to max_tags_per_topic" doSiteSetting.email_subject ="[%{site_name}] %{optional_pm}%{optional_cat}%{optional_tags}%{topic_title}"SiteSetting.max_tags_per_topic = 2@@ -705,7 +705,7 @@ RSpec.describe UserNotifications doenddescribe "optional placeholders in email body" do- it "should render optional_tags, optional_cat, optional_pm, and optional_re in body templates" do+ it "renders optional_tags, optional_cat, optional_pm, and optional_re in body templates" docustom_body = <<~BODYYou got a reply!@@ -1142,7 +1142,7 @@ RSpec.describe UserNotifications doshared_examples "supports reply by email" docontext "with reply_by_email" do- it "should have allow_reply_by_email set when that feature is enabled" do+ it "sets allow_reply_by_email when the feature is enabled" doexpects_build_with(has_entry(:allow_reply_by_email, true))endend@@ -1271,23 +1271,23 @@ RSpec.describe UserNotifications doexpects_build_with(has_key(:topic_id))end- it "should have user name as from_alias" do+ it "uses the user's name as from_alias" doSiteSetting.enable_names = trueSiteSetting.display_name_on_posts = trueexpects_build_with(has_entry(:from_alias, user.name))end- it "should not have user name as from_alias if display_name_on_posts is disabled" do+ it "omits the user's name from from_alias when display_name_on_posts is disabled" doSiteSetting.enable_names = falseSiteSetting.display_name_on_posts = falseexpects_build_with(has_entry(:from_alias, "walterwhite"))end- it "should explain how to respond" do+ it "explains how to respond" doexpects_build_with(Not(has_entry(:include_respond_instructions, false)))end- it "should not explain how to respond if the user is suspended" do+ it "omits response instructions for suspended users" doUser.any_instance.stubs(:suspended?).returns(true)expects_build_with(has_entry(:include_respond_instructions, false))end@@ -1314,7 +1314,7 @@ RSpec.describe UserNotifications do)end- it "shouldn't use the default html_override" do+ it "does not use the default html_override" doexpects_build_with(Not(has_key(:html_override)))endend@@ -1401,7 +1401,7 @@ RSpec.describe UserNotifications donotification.save!end- it "should include the group name" do+ it "includes the group name" doexpects_build_with(has_entry(:group_name, group.name))end@@ -1450,7 +1450,7 @@ RSpec.describe UserNotifications do)end- it "sends the email as the inviter" do+ it "uses the inviter's username when names are disabled" doSiteSetting.enable_names = falseexpect(mailer.message.to_s).to include(@@ -1458,7 +1458,7 @@ RSpec.describe UserNotifications do)end- it "sends the email as the inviter" do+ it "uses the inviter's name as the sender" doexpect(mailer.message.to_s).to include("From: #{inviter.name} <#{SiteSetting.notification_email}>",)diff --git a/spec/mailers/version_mailer_spec.rb b/spec/mailers/version_mailer_spec.rbindex 9e2da3c2203..ca507178618 100644--- a/spec/mailers/version_mailer_spec.rb+++ b/spec/mailers/version_mailer_spec.rb@@ -14,7 +14,7 @@ RSpec.describe VersionMailer docontext "when contact_email is set" dobefore { SiteSetting.contact_email = "[email protected]" }- it "works" do+ it "addresses the version email with a subject" doexpect(mail.to).to eq(["[email protected]"])expect(mail.subject).to be_presentexpect(mail.from).to eq([SiteSetting.notification_email])diff --git a/spec/models/api_key_scope_spec.rb b/spec/models/api_key_scope_spec.rbindex f6a917e93a2..81f81026c18 100644--- a/spec/models/api_key_scope_spec.rb+++ b/spec/models/api_key_scope_spec.rb@@ -2,13 +2,13 @@RSpec.describe ApiKeyScope dodescribe ".find_urls" do- it "should return the right urls" do+ it "returns the URL and method for creating posts" doexpect(ApiKeyScope.find_urls(actions: ["posts#create"], methods: [])).to contain_exactly("/posts (POST)",)end- it "should return logster urls" do+ it "returns Logster URLs" doexpect(ApiKeyScope.find_urls(actions: [Logster::Web], methods: [])).to contain_exactly("/logs/messages.json (POST)","/logs/show/:id.json (GET)",diff --git a/spec/models/category_featured_topic_spec.rb b/spec/models/category_featured_topic_spec.rbindex 79b55fbc3d0..e6ba81b885f 100644--- a/spec/models/category_featured_topic_spec.rb+++ b/spec/models/category_featured_topic_spec.rb@@ -35,7 +35,7 @@ RSpec.describe CategoryFeaturedTopic doexpect(CategoryFeaturedTopic.where(topic_id: post2.topic_id).count).to eq(1)end- it "should feature topics for a secure category" do+ it "features topics for a secure category" do# so much dancing, I am thinking fixures make sense here.user.change_trust_level!(TrustLevel[1])@@ -49,7 +49,7 @@ RSpec.describe CategoryFeaturedTopic doexpect(CategoryFeaturedTopic.count).to be(1)end- it "should not include invisible topics" do+ it "does not include invisible topics" doinvisible_post =PostCreator.create(user,@@ -62,7 +62,7 @@ RSpec.describe CategoryFeaturedTopic doexpect(CategoryFeaturedTopic.count).to be(1)end- it "should feature stuff in the correct order" do+ it "features topics in the correct order" docategory = Fabricate(:category, num_featured_topics: 2)_t5 = Fabricate(:topic, category_id: category.id, bumped_at: 12.minutes.ago)t4 = Fabricate(:topic, category_id: category.id, bumped_at: 10.minutes.ago)diff --git a/spec/models/category_list_spec.rb b/spec/models/category_list_spec.rbindex a7f3aceb8c4..023744cad7b 100644--- a/spec/models/category_list_spec.rb+++ b/spec/models/category_list_spec.rb@@ -191,7 +191,7 @@ RSpec.describe CategoryList dolet(:topic) { Fabricate(:topic, category: topic_category) }let(:category) { category_list.categories.find { |c| c.id == topic_category.id } }- it "should return the category" do+ it "returns the topic's category" doexpect(category).to be_presentexpect(category.id).to eq(topic_category.id)expect(category.featured_topics.include?(topic)).to eq(true)diff --git a/spec/models/category_spec.rb b/spec/models/category_spec.rbindex d93f37620f7..0fab201507b 100644--- a/spec/models/category_spec.rb+++ b/spec/models/category_spec.rb@@ -123,7 +123,7 @@ RSpec.describe Category doexpect { Fabricate(:category) }.to change { CategorySetting.count }.by(1)end- it "should delete associated sidebar_section_links when category is destroyed" do+ it "deletes associated sidebar_section_links when the category is destroyed" docategory_sidebar_section_link = Fabricate(:category_sidebar_section_link)category_sidebar_section_link_2 =Fabricate(:category_sidebar_section_link, linkable: category_sidebar_section_link.linkable)@@ -730,13 +730,13 @@ RSpec.describe Category doexpect(permalink.url).to eq(old_url[1..-1])end- it "should not set its description topic to auto-close" do+ it "does not set its description topic to auto-close" docategory = Fabricate(:category_with_definition, name: "Closing Topics", auto_close_hours: 1)expect(category.topic.public_topic_timer).to eq(nil)enddescribe "creating a new category with the same slug" do- it "should have a blank slug if at the same level" do+ it "has a blank slug at the same level" docategory = Fabricate(:category_with_definition, name: "Amazing Categóry")expect(category.slug).to be_blankexpect(category.slug_for_url).to eq("#{category.id}-category")@@ -786,7 +786,7 @@ RSpec.describe Category doenddescribe "update" do- it "should enforce uniqueness of slug" do+ it "enforces slug uniqueness" doFabricate(:category_with_definition, slug: "the-slug")c2 = Fabricate(:category_with_definition, slug: "different-slug")c2.slug = "the-slug"@@ -824,7 +824,7 @@ RSpec.describe Category doenddescribe "latest" do- it "should be updated correctly" do+ it "updates correctly" docategory = freeze_time(1.minute.ago) { Fabricate(:category_with_definition) }post = create_post(category: category.id, created_at: 15.seconds.ago)@@ -1017,14 +1017,14 @@ RSpec.describe Category doenddescribe ".query_parent_category" do- it "should return the parent category id given a parent slug" do+ it "returns the parent category ID for a parent slug" doparent_category.name = "Amazing Category"expect(parent_category.id).to eq(Category.query_parent_category(parent_category.slug))endenddescribe ".query_category" do- it "should return the category" do+ it "returns the category" docategory =Fabricate(:category_with_definition,@@ -1125,7 +1125,7 @@ RSpec.describe Category doenddescribe "auto bump" do- it "should correctly automatically bump topics" do+ it "automatically bumps topics correctly" dofreeze_timecategory = Fabricate(:category_with_definition, created_at: 1.minute.ago)category.clear_auto_bump_cache!@@ -1169,7 +1169,7 @@ RSpec.describe Category doexpect(Category.auto_bump_topic!).to eq(false)end- it "should not auto-bump the same topic within the cooldown" do+ it "does not auto-bump the same topic during the cooldown" dofreeze_timecategory =Fabricate(@@ -1203,7 +1203,7 @@ RSpec.describe Category doexpect(Topic.where(bumped_at: time).count).to eq(1)end- it "should not automatically bump topics with a bump scheduled" do+ it "does not auto-bump topics with a scheduled bump" dofreeze_timecategory = Fabricate(:category_with_definition, created_at: 1.second.ago)category.clear_auto_bump_cache!@@ -1251,7 +1251,7 @@ RSpec.describe Category doendcontext "when changing subcategory permissions" do- it "it is not valid if permissions are less restrictive" do+ it "is invalid when permissions are less restrictive" dosubcategory.set_permissions(group => :readonly)subcategory.save!@@ -1347,13 +1347,13 @@ RSpec.describe Category doSQLdescribe "#depth_of_descendants" do- it "should produce max_depth" do+ it "produces max_depth" doexpect(category.depth_of_descendants(3)).to eq(3)endenddescribe "#height_of_ancestors" do- it "should produce max_height" do+ it "produces max_height" doexpect(category.height_of_ancestors(3)).to eq(3)endend@@ -1363,13 +1363,13 @@ RSpec.describe Category dobefore { category.parent_category_id = category.id }describe "#depth_of_descendants" do- it "should produce max_depth" do+ it "produces max_depth" doexpect(category.depth_of_descendants(3)).to eq(3)endenddescribe "#height_of_ancestors" do- it "should produce max_height" do+ it "produces max_height" doexpect(category.height_of_ancestors(3)).to eq(3)endend@@ -1379,34 +1379,34 @@ RSpec.describe Category dobefore { category.parent_category_id = subcategory.id }describe "#depth_of_descendants" do- it "should produce max_depth" do+ it "produces max_depth" doexpect(category.depth_of_descendants(3)).to eq(3)endenddescribe "#height_of_ancestors" do- it "should produce max_height" do+ it "produces max_height" doexpect(category.height_of_ancestors(3)).to eq(3)endendenddescribe "#depth_of_descendants" do- it "should be 0 when the category has no descendants" do+ it "is 0 when the category has no descendants" doexpect(subcategory.depth_of_descendants).to eq(0)end- it "should be 1 when the category has a descendant" do+ it "is 1 when the category has a descendant" doexpect(category.depth_of_descendants).to eq(1)endenddescribe "#height_of_ancestors" do- it "should be 0 when the category has no ancestors" do+ it "is 0 when the category has no ancestors" doexpect(category.height_of_ancestors).to eq(0)end- it "should be 1 when the category has an ancestor" do+ it "is 1 when the category has an ancestor" doexpect(subcategory.height_of_ancestors).to eq(1)endend@@ -1512,7 +1512,7 @@ RSpec.describe Category dofab!(:category)describe "when category is uncategorized" do- it "should return the reason" do+ it "returns the reason" docategory = Category.find(SiteSetting.uncategorized_category_id)expect(category.cannot_delete_reason).to eq(I18n.t("category.cannot_delete.uncategorized"))@@ -1520,7 +1520,7 @@ RSpec.describe Category doenddescribe "when category has subcategories" do- it "should return the right reason" do+ it "returns the expected reason" docategory.subcategories << Fabricate(:category)expect(category.cannot_delete_reason).to eq(@@ -1530,7 +1530,7 @@ RSpec.describe Category doenddescribe "when category has topics" do- it "should return the right reason" do+ it "returns the expected reason" dotopic =Fabricate(:topic,@@ -1555,7 +1555,7 @@ RSpec.describe Category dodescribe "#deleting the general category" dofab!(:category)- it "should empty out the general_category_id site_setting" do+ it "clears the general_category_id site setting" doSiteSetting.general_category_id = category.idcategory.destroydiff --git a/spec/models/category_user_spec.rb b/spec/models/category_user_spec.rbindex 16e9aafad39..c2293b89b6a 100644--- a/spec/models/category_user_spec.rb+++ b/spec/models/category_user_spec.rb@@ -30,13 +30,13 @@ RSpec.describe CategoryUser do).pluck(:category_id)end- it "should add new records where required" do+ it "adds missing category notification records" doCategoryUser.batch_set(user, :watching, [category.id])expect(category_ids_at_level(:watching)).to eq([category.id])end- it "should change existing records where required" do+ it "updates existing category notification records" doCategoryUser.create!(user_id: user.id,category_id: category.id,@@ -49,7 +49,7 @@ RSpec.describe CategoryUser doexpect(category_ids_at_level(:muted)).to eq([])end- it "should delete extraneous records where required" do+ it "deletes extraneous category notification records" doCategoryUser.create!(user_id: user.id,category_id: category.id,@@ -61,18 +61,18 @@ RSpec.describe CategoryUser doexpect(category_ids_at_level(:watching)).to eq([])end- it "should return true when something changed" do+ it "returns true when something changes" doexpect(CategoryUser.batch_set(user, :watching, [category.id])).to eq(true)end- it "should return false when nothing changed" do+ it "returns false when nothing changes" doCategoryUser.batch_set(user, :watching, [category.id])expect(CategoryUser.batch_set(user, :watching, [category.id])).to eq(false)endend- it "should correctly auto_track" do+ it "automatically tracks topics according to category preferences" dotracking_user = Fabricate(:user)topic = Fabricate(:post).topic@@ -128,7 +128,7 @@ RSpec.describe CategoryUser doNotificationEmailer.enableend- it "should operate correctly" do+ it "applies watched, muted, and tracked category preferences to topics" dowatched_category = Fabricate(:category)muted_category = Fabricate(:category)tracked_category = Fabricate(:category)diff --git a/spec/models/discourse_connect_spec.rb b/spec/models/discourse_connect_spec.rbindex 784d0df9b78..fdd3623944d 100644--- a/spec/models/discourse_connect_spec.rb+++ b/spec/models/discourse_connect_spec.rb@@ -497,7 +497,7 @@ RSpec.describe DiscourseConnect doexpect(user.username).to eq "testuser"end- it "should preserve username when several users login with the same username" do+ it "preserves usernames when several users log in with the same username" doSiteSetting.auth_overrides_username = true# if several users have username "bill" on the external site,diff --git a/spec/models/draft_sequence_spec.rb b/spec/models/draft_sequence_spec.rbindex f2c2d731644..f185bba67b9 100644--- a/spec/models/draft_sequence_spec.rb+++ b/spec/models/draft_sequence_spec.rb@@ -6,12 +6,12 @@ RSpec.describe DraftSequence dolet!(:topic_draft_key) { Draft::NEW_TOPIC + "_0001" }describe ".next" do- it "should produce next sequence for a key" do+ it "produces the next sequence for a key" doexpect(DraftSequence.next!(user, topic_draft_key)).to eq 1expect(DraftSequence.next!(user, topic_draft_key)).to eq 2end- it "should not produce next sequence for non-human user" do+ it "does not produce a sequence for a non-human user" douser.id = -99_9992.times { expect(DraftSequence.next!(user, "test")).to eq(0) }end@@ -43,16 +43,16 @@ RSpec.describe DraftSequence doenddescribe ".current" do- it "should return 0 by default" do+ it "returns zero by default" doexpect(DraftSequence.current(user, "test")).to eq 0end- it "should return nil for non-human user" do+ it "returns nil for a non-human user" douser.id = -99_999expect(DraftSequence.current(user, "test")).to eq(0)end- it "should return the right sequence" do+ it "returns the current sequence" doexpect(DraftSequence.next!(user, "test")).to eq(1)expect(DraftSequence.current(user, "test")).to eq(1)enddiff --git a/spec/models/draft_spec.rb b/spec/models/draft_spec.rbindex 18286de9989..52999a34c48 100644--- a/spec/models/draft_spec.rb+++ b/spec/models/draft_spec.rb@@ -68,26 +68,26 @@ RSpec.describe Draft doexpect(Draft.get(Fabricate(:user), "test", 0)).to eq nilend- it "should overwrite draft data correctly" do+ it "overwrites draft data correctly" doseq = Draft.set(user, "test", 0, "data")seq = Draft.set(user, "test", seq, "new data")expect(Draft.get(user, "test", seq)).to eq "new data"end- it "should increase the sequence on every save" do+ it "increments the sequence on every save" doseq = Draft.set(user, "test", 0, "data")expect(seq).to eq(0)seq = Draft.set(user, "test", 0, "data")expect(seq).to eq(1)end- it "should clear drafts on request" do+ it "clears drafts on request" doDraft.set(user, "test", 0, "data")Draft.clear(user, "test", 0)expect(Draft.get(user, "test", 0)).to eq nilend- it "should cross check with DraftSequence table" do+ it "cross-checks the DraftSequence table" doDraft.set(user, "test", 0, "old")expect(Draft.get(user, "test", 0)).to eq "old"@@ -111,7 +111,7 @@ RSpec.describe Draft do)end- it "should disregard old draft if sequence decreases" do+ it "disregards an old draft when the sequence decreases" doDraft.set(user, "test", 0, "data")DraftSequence.next!(user, "test")Draft.set(user, "test", 1, "hello")@@ -123,7 +123,7 @@ RSpec.describe Draft doexpect(Draft.get(user, "test", 1)).to eq "hello"end- it "should disregard draft sequence if force_save is true" do+ it "disregards the draft sequence when force_save is true" doDraft.set(user, "test", 0, "data")DraftSequence.next!(user, "test")Draft.set(user, "test", 1, "hello")@@ -193,19 +193,19 @@ RSpec.describe Draft dolet(:stream) { Draft.stream(user: user) }- it "should include the correct number of drafts in the stream" do+ it "includes the correct number of drafts in the stream" doDraft.set(user, "test", 0, '{"reply":"hey.","action":"createTopic","title":"Hey"}')Draft.set(user, "test2", 0, '{"reply":"howdy"}')expect(stream.count).to eq(2)end- it "should include the right topic id in a draft reply in the stream" do+ it "includes the expected topic ID for a draft reply in the stream" doDraft.set(user, "topic_#{public_topic.id}", 0, '{"reply":"hi"}')draft_row = stream.firstexpect(draft_row.topic_id).to eq(public_topic.id)end- it "should include the right draft username in the stream" do+ it "includes the expected draft username in the stream" doDraft.set(user, "topic_#{public_topic.id}", 0, '{"reply":"hey"}')draft_row = stream.firstexpect(draft_row.user.username).to eq(user.username)diff --git a/spec/models/email_change_request_spec.rb b/spec/models/email_change_request_spec.rbindex 273d2a5b0cd..0f2eae9f143 100644--- a/spec/models/email_change_request_spec.rb+++ b/spec/models/email_change_request_spec.rb@@ -4,7 +4,7 @@ RSpec.describe EmailChangeRequest dodescribe "Validations" dodescribe "#new_email" dodescribe "when email is invalid" do- it "should not be valid" do+ it "is invalid" doemail_change_request =Fabricate.build(:email_change_request, new_email: "testdiscourse.org")expect(email_change_request).to_not be_validdiff --git a/spec/models/email_log_spec.rb b/spec/models/email_log_spec.rbindex 90f738aeace..b62aa72d1ec 100644--- a/spec/models/email_log_spec.rb+++ b/spec/models/email_log_spec.rb@@ -116,7 +116,7 @@ RSpec.describe EmailLog doenddescribe "#bounce_key" do- it "should format the bounce_key correctly" do+ it "formats the bounce_key correctly" dohex = SecureRandom.hexemail_log = Fabricate(:email_log, user: user, bounce_key: hex)diff --git a/spec/models/email_token_spec.rb b/spec/models/email_token_spec.rbindex 3f1de4eadf5..7e0edce999b 100644--- a/spec/models/email_token_spec.rb+++ b/spec/models/email_token_spec.rb@@ -10,11 +10,11 @@ RSpec.describe EmailToken dolet!(:original_token) { user.email_tokens.first }let!(:email_token) { Fabricate(:email_token, user: user, email: "[email protected]") }- it "should create the email token" do+ it "creates the email token" doexpect(email_token).to be_presentend- it "should downcase the email" do+ it "downcases the email address" dotoken = Fabricate(:email_token, user: user, email: "[email protected]")expect(token.email).to eq "[email protected]"end@@ -99,7 +99,7 @@ RSpec.describe EmailToken doexpect(email_token).to be_confirmedend- it "will not confirm again" do+ it "does not confirm the email again" doexpect(EmailToken.confirm(email_token.token)).to be_blankendenddiff --git a/spec/models/emoji_spec.rb b/spec/models/emoji_spec.rbindex f0e006ef83c..0dc6f01f259 100644--- a/spec/models/emoji_spec.rb+++ b/spec/models/emoji_spec.rb@@ -92,7 +92,7 @@ RSpec.describe Emoji doendend- describe ".lookup_unicode" do+ describe ".lookup_unicode for ZWJ sequences" dobefore { Emoji.clear_cache }it "returns correct unicode for skin tone and gendered ZWJ sequences" do@@ -110,7 +110,7 @@ RSpec.describe Emoji doendend- describe ".lookup_unicode" do+ describe ".lookup_unicode for names and aliases" doit "returns unicode for emoji, aliases, and skin tones" doexpect(Emoji.lookup_unicode("trade_mark")).to eq("™")expect(Emoji.lookup_unicode("blonde_man")).to eq("👱♂️")diff --git a/spec/models/form_template_spec.rb b/spec/models/form_template_spec.rbindex c1ef5703cc0..a62c6896b4c 100644--- a/spec/models/form_template_spec.rb+++ b/spec/models/form_template_spec.rb@@ -38,7 +38,7 @@ RSpec.describe FormTemplate, type: :model do)end- it "should update validation limits when the site setting has been changed" do+ it "updates validation limits when the site setting changes" doSiteSetting.max_form_template_content_length = 100SiteSetting.max_form_template_title_length = 100diff --git a/spec/models/group_archived_message_spec.rb b/spec/models/group_archived_message_spec.rbindex 58e31093060..b25665dd9a0 100644--- a/spec/models/group_archived_message_spec.rb+++ b/spec/models/group_archived_message_spec.rb@@ -19,7 +19,7 @@ RSpec.describe GroupArchivedMessage doenddescribe ".move_to_inbox!" do- it "should unarchive the topic correctly" do+ it "unarchives the topic correctly" dodescribed_class.archive!(group.id, group_message)messages =@@ -57,7 +57,7 @@ RSpec.describe GroupArchivedMessage doenddescribe ".archive!" do- it "should archive the topic correctly" do+ it "archives the topic correctly" domessages =MessageBus.track_publish(PrivateMessageTopicTrackingState.group_channel(group.id)) dodescribed_class.archive!(group.id, group_message)diff --git a/spec/models/group_history_spec.rb b/spec/models/group_history_spec.rbindex 387820be131..eab92b8196b 100644--- a/spec/models/group_history_spec.rb+++ b/spec/models/group_history_spec.rb@@ -12,11 +12,11 @@ RSpec.describe GroupHistory doenddescribe ".with_filters" do- it "should return the right records" do+ it "returns the expected records" doexpect(described_class.with_filters(group_history.group)).to eq([group_history])end- it "should filter by action correctly" do+ it "filters by action correctly" doother_group_historyexpect(@@ -24,7 +24,7 @@ RSpec.describe GroupHistory do).to eq([other_group_history])end- it "should filter by subject correctly" do+ it "filters by subject correctly" doother_group_history.update!(subject: "test")expect(described_class.with_filters(group_history.group, subject: "test")).to eq(@@ -32,7 +32,7 @@ RSpec.describe GroupHistory do)end- it "should filter by multiple filters correctly" do+ it "combines multiple filters correctly" dogroup_history.update!(action: GroupHistory.actions[:remove_user_from_group])other_group_history.update!(subject: "test")@@ -45,7 +45,7 @@ RSpec.describe GroupHistory do).to eq([other_group_history])end- it "should filter by target_user and acting_user correctly" do+ it "filters by target_user and acting_user correctly" dogroup_historyother_group_historydiff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rbindex 61d08bbf12f..c537972d42a 100644--- a/spec/models/group_spec.rb+++ b/spec/models/group_spec.rb@@ -14,7 +14,7 @@ RSpec.describe Group dodescribe "#grant_trust_level" dodescribe "when trust level is not valid" do- it "should not be valid" do+ it "is invalid" dogroup.grant_trust_level = 123_456expect(group.valid?).to eq(false)@@ -28,7 +28,7 @@ RSpec.describe Group dodescribe "#name" docontext "when a user with a similar name exists" do- it "should not be valid" do+ it "is invalid" donew_group = Fabricate.build(:group, name: admin.username.upcase)expect(new_group).to_not be_valid@@ -40,7 +40,7 @@ RSpec.describe Group doendcontext "when a group with a similar name exists" do- it "should not be valid" do+ it "is invalid" donew_group = Fabricate.build(:group, name: group.name.upcase)expect(new_group).to_not be_valid@@ -52,7 +52,7 @@ RSpec.describe Group doendcontext "when a group with a reserved name is created" do- it "should not be valid" do+ it "is invalid" donew_group = Fabricate.build(:group, name: "by-id")expect(new_group).to_not be_valid@@ -217,7 +217,7 @@ RSpec.describe Group docontext "when a group has no owners" dodescribe "group has not been persisted" do- it "should not allow membership requests" do+ it "does not allow membership requests" dogroup = Fabricate.build(:group, allow_membership_requests: true)expect(group.valid?).to eq(false)@@ -232,7 +232,7 @@ RSpec.describe Group doendend- it "should not allow membership requests" do+ it "does not allow membership requests" dogroup.allow_membership_requests = trueexpect(group.valid?).to eq(false)@@ -731,7 +731,7 @@ RSpec.describe Group dobefore { group.add(user) }- it "it deleted correctly" do+ it "deletes the group and its associations" dogroup.destroy!expect(User.where(id: user.id).count).to eq 1expect(GroupUser.where(group_id: group.id).count).to eq 0@@ -983,7 +983,7 @@ RSpec.describe Group dobefore { user.user_stat.update!(topics_entered: 999, posts_read_count: 999, time_read: 999) }- it "should not demote the user" do+ it "does not demote the user" dogroup.add(user)group2.add(user)@@ -1034,7 +1034,7 @@ RSpec.describe Group doendend- it "should cook the bio" do+ it "cooks the group biography" dogroup = Fabricate(:group)group.update!(bio_raw: "This is a group for :unicorn: lovers")@@ -1334,7 +1334,7 @@ RSpec.describe Group dobefore { group.update!(public_exit: true) }- it "should publish category removal when category is read-restricted to the group" do+ it "publishes category removal when the group loses read access" docategory.set_permissions(group => :full)category.save!group.update!(categories: [category])@@ -1346,7 +1346,7 @@ RSpec.describe Group doexpect(message.user_ids).to eq([user.id])end- it "should publish updated category permissions when category is readable by everyone" do+ it "publishes updated permissions for a publicly readable category" docategory.set_permissions(:everyone => :readonly, group => :full)category.save!group.update!(categories: [category])@@ -1360,7 +1360,7 @@ RSpec.describe Group doenddescribe "when group belongs to more than #{Group::PUBLISH_CATEGORIES_LIMIT} categories" do- it "should publish a message to refresh the user's client" do+ it "publishes a client refresh for the user" dogroup.categories += Fabricate.times(Group::PUBLISH_CATEGORIES_LIMIT + 1, :category)message = MessageBus.track_publish { group.remove(user) }.first@@ -1429,7 +1429,7 @@ RSpec.describe Group docontext "when adding a user into a public group" dofab!(:category)- it "should publish the group's categories to the client" do+ it "publishes the group's categories to the client" dogroup.update!(public_admission: true, categories: [category])message = MessageBus.track_publish("/categories") { group.add(user) }.first@@ -1440,7 +1440,7 @@ RSpec.describe Group doenddescribe "when group belongs to more than #{Group::PUBLISH_CATEGORIES_LIMIT} categories" do- it "should publish a message to refresh the user's client" do+ it "publishes a client refresh for the user" dogroup.categories += Fabricate.times(Group::PUBLISH_CATEGORIES_LIMIT + 1, :category)message = MessageBus.track_publish { group.add(user) }.first@@ -1458,7 +1458,7 @@ RSpec.describe Group doGroup.search_groups(name, sort: :auto).map(&:name)end- it "should return the right groups" do+ it "returns the matching groups" doGroup.delete_allgroup_name =@@ -1475,7 +1475,7 @@ RSpec.describe Group doexpect(search_group_names("test2")).to eq([])end- it "should prioritize prefix matches on group's name or fullname" do+ it "prioritizes prefix matches on the group's name or full name" doFabricate(:group, name: "pears_11", full_name: "fred apple")Fabricate(:group, name: "apples", full_name: "jane orange")Fabricate(:group, name: "oranges2", full_name: "nothing")@@ -1800,7 +1800,7 @@ RSpec.describe Group dodescribe "#automatic_group_membership" dolet(:group) { Fabricate(:group, automatic_membership_email_domains: "example.com") }- it "should be triggered on create and update" do+ it "runs on create and update" doexpect { group }.to change { Jobs::AutomaticGroupMembership.jobs.size }.by(1)job = Jobs::AutomaticGroupMembership.jobs.last@@ -1822,7 +1822,7 @@ RSpec.describe Group dodescribe "Unicode usernames and group names" dobefore { SiteSetting.unicode_usernames = true }- it "should normalize the name" do+ it "normalizes the group name" dogroup = Fabricate(:group, name: "Bücherwurm") # NFDexpect(group.name).to eq("Bücherwurm") # NFCenddiff --git a/spec/models/invite_redeemer_spec.rb b/spec/models/invite_redeemer_spec.rbindex 052f99a496c..7d0d4e8f3d5 100644--- a/spec/models/invite_redeemer_spec.rb+++ b/spec/models/invite_redeemer_spec.rb@@ -99,7 +99,7 @@ RSpec.describe InviteRedeemer doenddescribe ".create_user_from_invite" do- it "should be created correctly" do+ it "creates the user correctly" doinvite = Fabricate(:invite, email: "[email protected]")user =InviteRedeemer.create_user_from_invite(@@ -153,7 +153,7 @@ RSpec.describe InviteRedeemer doexpect(error.record.errors.errors[0].attribute).to eq :"user_password.password"end- it "should unstage user" do+ it "unstages the user" dostaged_user =Fabricate(:staged,@@ -305,7 +305,7 @@ RSpec.describe InviteRedeemer docontext "when must_approve_users setting is enabled" dobefore { SiteSetting.must_approve_users = true }- it "should redeem an invite but not approve the user when invite is created by a staff user" do+ it "redeems a staff invite without approving the user" doinviter = invite.invited_byinviter.update!(admin: true)user = invite_redeemer.redeem@@ -318,7 +318,7 @@ RSpec.describe InviteRedeemer doexpect(inviter.notifications.count).to eq(1)end- it "should redeem the invite but not approve the user when invite is created by a regular user" do+ it "redeems a regular-user invite without approving the user" doinviter = invite.invited_byuser = invite_redeemer.redeem@@ -330,7 +330,7 @@ RSpec.describe InviteRedeemer doexpect(inviter.notifications.count).to eq(1)end- it "should redeem the invite and approve the user when user email is in auto_approve_email_domains setting" do+ it "redeems the invite and approves an email from an auto-approved domain" doSiteSetting.auto_approve_email_domains = "example.com"user = invite_redeemer.redeem@@ -341,7 +341,7 @@ RSpec.describe InviteRedeemer doendend- it "should redeem the invite if invited by non staff and approve if staff not required to approve" do+ it "redeems and approves a non-staff invite when staff approval is not required" doinviter = invite.invited_byuser = invite_redeemer.redeem@@ -352,7 +352,7 @@ RSpec.describe InviteRedeemer doexpect(user.approved).to eq(false)end- it "should delete invite if invited_by user has been removed" do+ it "deletes the invite when its inviter has been removed" doinvite.invited_by.destroy!expect { invite.reload }.to raise_error(ActiveRecord::RecordNotFound)end@@ -491,7 +491,7 @@ RSpec.describe InviteRedeemer doexpect(another_user).to eq(nil)end- it "should correctly update the invite redeemed_at date" do+ it "updates the invite redeemed_at date" doSiteSetting.invite_expiry_days = 2invite.update!(created_at: 10.days.ago)@@ -626,7 +626,7 @@ RSpec.describe InviteRedeemer do)end- it "should redeem the invite if InvitedUser record does not exists for email" do+ it "redeems the invite without an InvitedUser record for the email" doinvite_redeemer.redeeminvite_link.reloaddiff --git a/spec/models/invite_spec.rb b/spec/models/invite_spec.rbindex 929126fe9b0..bbb4c2fcecf 100644--- a/spec/models/invite_spec.rb+++ b/spec/models/invite_spec.rb@@ -244,7 +244,7 @@ RSpec.describe Invite docontext "when adding to another topic" dofab!(:another_topic) { Fabricate(:topic, user: topic.user) }- it "should be the same invite" do+ it "returns the same invite" donew_invite = Invite.generate(topic.user, email: "[email protected]", topic: another_topic)expect(invite).to eq(new_invite)expect(invite.topics).to contain_exactly(topic, another_topic)@@ -390,7 +390,7 @@ RSpec.describe Invite dodescribe "#redeem" dofab!(:invite)- it "works" do+ it "redeems the invite" douser = invite.redeemexpect(invite.invited_users.map(&:user)).to contain_exactly(user)expect(user.is_a?(User)).to eq(true)@@ -443,14 +443,14 @@ RSpec.describe Invite doendcontext "as a moderator" do- it "will give the user a moderator flag" do+ it "gives the user a moderator flag" doinvite.update!(moderator: true, invited_by: Fabricate(:admin))user = invite.redeemexpect(user).to be_moderatorend- it "will not give the user a moderator flag if the inviter is not staff" do+ it "does not give the user a moderator flag when the inviter is not staff" do# update_columns skips the ensure_valid_moderator_invite validation so we# can exercise the redeemer's own inviter check in isolationinvite.update_columns(moderator: true)@@ -473,7 +473,7 @@ RSpec.describe Invite doexpect(user.groups).to contain_exactly(group)end- it "should not raise error when both group & site tag preferences same" do+ it "does not raise an error when group and site tag preferences match" dotag = Fabricate(:tag)group.tracking_tags = [tag.name]group.save!diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rbindex 4399cde5b2a..26c5c4a8fb9 100644--- a/spec/models/notification_spec.rb+++ b/spec/models/notification_spec.rb@@ -1,977 +1,997 @@# frozen_string_literal: trueRSpec.describe Notification do- fab!(:user)- fab!(:coding_horror)-- before { NotificationEmailer.enable }-- it { is_expected.to validate_presence_of :notification_type }- it { is_expected.to validate_presence_of :data }-- it { is_expected.to belong_to :user }- it { is_expected.to belong_to :topic }-- describe "#types" do- subject(:types) { Notification.types }-- context "when verifying enum sequence" do- it "has a correct position for each type" do- expect(types[:mentioned]).to eq(1)- expect(types[:replied]).to eq(2)- expect(types[:quoted]).to eq(3)- expect(types[:edited]).to eq(4)- expect(types[:liked]).to eq(5)- expect(types[:private_message]).to eq(6)- expect(types[:invited_to_private_message]).to eq(7)- expect(types[:invitee_accepted]).to eq(8)- expect(types[:posted]).to eq(9)- expect(types[:moved_post]).to eq(10)- expect(types[:linked]).to eq(11)- expect(types[:granted_badge]).to eq(12)- expect(types[:invited_to_topic]).to eq(13)- expect(types[:custom]).to eq(14)- expect(types[:group_mentioned]).to eq(15)- expect(types[:group_message_summary]).to eq(16)- expect(types[:watching_first_post]).to eq(17)- expect(types[:topic_reminder]).to eq(18)- expect(types[:liked_consolidated]).to eq(19)- expect(types[:post_approved]).to eq(20)- expect(types[:code_review_commit_approved]).to eq(21)- expect(types[:membership_request_accepted]).to eq(22)- expect(types[:membership_request_consolidated]).to eq(23)- expect(types[:bookmark_reminder]).to eq(24)- expect(types[:reaction]).to eq(25)- expect(types[:votes_released]).to eq(26)- expect(types[:event_reminder]).to eq(27)- expect(types[:event_invitation]).to eq(28)- expect(types[:chat_mention]).to eq(29)- expect(types[:chat_message]).to eq(30)- expect(types[:assigned]).to eq(34)+ context "with the notification observer enabled" do+ fab!(:user)+ fab!(:coding_horror)++ before { NotificationEmailer.enable }++ it { is_expected.to validate_presence_of :notification_type }+ it { is_expected.to validate_presence_of :data }++ it { is_expected.to belong_to :user }+ it { is_expected.to belong_to :topic }++ describe "#types" do+ subject(:types) { Notification.types }++ context "when verifying enum sequence" do+ it "has a correct position for each type" do+ expect(types[:mentioned]).to eq(1)+ expect(types[:replied]).to eq(2)+ expect(types[:quoted]).to eq(3)+ expect(types[:edited]).to eq(4)+ expect(types[:liked]).to eq(5)+ expect(types[:private_message]).to eq(6)+ expect(types[:invited_to_private_message]).to eq(7)+ expect(types[:invitee_accepted]).to eq(8)+ expect(types[:posted]).to eq(9)+ expect(types[:moved_post]).to eq(10)+ expect(types[:linked]).to eq(11)+ expect(types[:granted_badge]).to eq(12)+ expect(types[:invited_to_topic]).to eq(13)+ expect(types[:custom]).to eq(14)+ expect(types[:group_mentioned]).to eq(15)+ expect(types[:group_message_summary]).to eq(16)+ expect(types[:watching_first_post]).to eq(17)+ expect(types[:topic_reminder]).to eq(18)+ expect(types[:liked_consolidated]).to eq(19)+ expect(types[:post_approved]).to eq(20)+ expect(types[:code_review_commit_approved]).to eq(21)+ expect(types[:membership_request_accepted]).to eq(22)+ expect(types[:membership_request_consolidated]).to eq(23)+ expect(types[:bookmark_reminder]).to eq(24)+ expect(types[:reaction]).to eq(25)+ expect(types[:votes_released]).to eq(26)+ expect(types[:event_reminder]).to eq(27)+ expect(types[:event_invitation]).to eq(28)+ expect(types[:chat_mention]).to eq(29)+ expect(types[:chat_message]).to eq(30)+ expect(types[:assigned]).to eq(34)+ endendend- end- describe "post" do- let(:topic) { Fabricate(:topic) }- let(:post_args) { { user: topic.user, topic: topic } }+ describe "post" do+ let(:topic) { Fabricate(:topic) }+ let(:post_args) { { user: topic.user, topic: topic } }- describe "replies" do- def process_alerts(post)- PostAlerter.post_created(post)- end+ describe "replies" do+ def process_alerts(post)+ PostAlerter.post_created(post)+ end- let(:post) { process_alerts(Fabricate(:post, post_args.merge(raw: "Hello @CodingHorror"))) }+ let(:post) { process_alerts(Fabricate(:post, post_args.merge(raw: "Hello @CodingHorror"))) }- it "notifies the poster on reply" do- expect {- reply = Fabricate(:basic_reply, user: coding_horror, topic: post.topic)- process_alerts(reply)- }.to change(post.user.notifications, :count).by(1)- end+ it "notifies the poster on reply" do+ expect {+ reply = Fabricate(:basic_reply, user: coding_horror, topic: post.topic)+ process_alerts(reply)+ }.to change(post.user.notifications, :count).by(1)+ end- it "doesn't notify the poster when they reply to their own post" do- expect {- reply = Fabricate(:basic_reply, user: post.user, topic: post.topic)- process_alerts(reply)- }.not_to change(post.user.notifications, :count)+ it "doesn't notify the poster when they reply to their own post" do+ expect {+ reply = Fabricate(:basic_reply, user: post.user, topic: post.topic)+ process_alerts(reply)+ }.not_to change(post.user.notifications, :count)+ endend- end- describe "watching" do- it "does notify watching users of new posts" do- post = PostAlerter.post_created(Fabricate(:post, post_args))- user2 = coding_horror- post_args[:topic].notify_watch!(user2)- expect {- PostAlerter.post_created(Fabricate(:post, user: post.user, topic: post.topic))- }.to change(user2.notifications, :count).by(1)+ describe "watching" do+ it "does notify watching users of new posts" do+ post = PostAlerter.post_created(Fabricate(:post, post_args))+ user2 = coding_horror+ post_args[:topic].notify_watch!(user2)+ expect {+ PostAlerter.post_created(Fabricate(:post, user: post.user, topic: post.topic))+ }.to change(user2.notifications, :count).by(1)+ endend- end- describe "muting" do- it "does not notify users of new posts" do- post = Fabricate(:post, post_args)- user = post_args[:user]- user2 = coding_horror+ describe "muting" do+ it "does not notify users of new posts" do+ post = Fabricate(:post, post_args)+ user = post_args[:user]+ user2 = coding_horror- post_args[:topic].notify_muted!(user)- expect {- Fabricate(:post, user: user2, topic: post.topic, raw: "hello @" + user.username)- }.not_to change(user.notifications, :count)+ post_args[:topic].notify_muted!(user)+ expect {+ Fabricate(:post, user: user2, topic: post.topic, raw: "hello @" + user.username)+ }.not_to change(user.notifications, :count)+ endendend- end- describe "high priority creation" do- fab!(:user)+ describe "high priority creation" do+ fab!(:user)- it "automatically marks the notification as high priority if it is a high priority type" do- notif =- Notification.create(- user: user,- notification_type: Notification.types[:bookmark_reminder],- data: {- },- )- expect(notif.high_priority).to eq(true)- notif =- Notification.create(- user: user,- notification_type: Notification.types[:private_message],- data: {- },- )- expect(notif.high_priority).to eq(true)- notif =- Notification.create(user: user, notification_type: Notification.types[:liked], data: {})- expect(notif.high_priority).to eq(false)- end+ it "automatically marks the notification as high priority if it is a high priority type" do+ notif =+ Notification.create(+ user: user,+ notification_type: Notification.types[:bookmark_reminder],+ data: {+ },+ )+ expect(notif.high_priority).to eq(true)+ notif =+ Notification.create(+ user: user,+ notification_type: Notification.types[:private_message],+ data: {+ },+ )+ expect(notif.high_priority).to eq(true)+ notif =+ Notification.create(user: user, notification_type: Notification.types[:liked], data: {})+ expect(notif.high_priority).to eq(false)+ end- it "allows manually specifying a notification is high priority" do- notif =- Notification.create(- user: user,- notification_type: Notification.types[:liked],- data: {- },- high_priority: true,- )- expect(notif.high_priority).to eq(true)+ it "allows manually specifying a notification is high priority" do+ notif =+ Notification.create(+ user: user,+ notification_type: Notification.types[:liked],+ data: {+ },+ high_priority: true,+ )+ expect(notif.high_priority).to eq(true)+ endend- end- describe "unread counts" do- fab!(:user)+ describe "unread counts" do+ fab!(:user)- context "with a regular notification" do- it "increases unread_notifications" do- expect {- Fabricate(:notification, user: user)- user.reload- }.to change(user, :unread_notifications)- end+ context "with a regular notification" do+ it "increases unread_notifications" do+ expect {+ Fabricate(:notification, user: user)+ user.reload+ }.to change(user, :unread_notifications)+ end- it "increases total_unread_notifications" do- expect {- Fabricate(:notification, user: user)- user.reload- }.to change(user, :total_unread_notifications)- end+ it "increases total_unread_notifications" do+ expect {+ Fabricate(:notification, user: user)+ user.reload+ }.to change(user, :total_unread_notifications)+ end- it "doesn't increase unread_high_priority_notifications" do- expect {- Fabricate(:notification, user: user)- user.reload- }.not_to change(user, :unread_high_priority_notifications)+ it "doesn't increase unread_high_priority_notifications" do+ expect {+ Fabricate(:notification, user: user)+ user.reload+ }.not_to change(user, :unread_high_priority_notifications)+ endend- end- context "with a private message" do- it "doesn't increase unread_notifications" do- expect {- Fabricate(:private_message_notification, user: user)- user.reload- }.not_to change(user, :unread_notifications)- end+ context "with a private message" do+ it "doesn't increase unread_notifications" do+ expect {+ Fabricate(:private_message_notification, user: user)+ user.reload+ }.not_to change(user, :unread_notifications)+ end++ it "increases total_unread_notifications" do+ expect {+ Fabricate(:notification, user: user)+ user.reload+ }.to change(user, :total_unread_notifications)+ end- it "increases total_unread_notifications" do- expect {- Fabricate(:notification, user: user)- user.reload- }.to change(user, :total_unread_notifications)+ it "increases unread_high_priority_notifications" do+ expect {+ Fabricate(:private_message_notification, user: user)+ user.reload+ }.to change(user, :unread_high_priority_notifications)+ endend- it "increases unread_high_priority_notifications" do- expect {- Fabricate(:private_message_notification, user: user)- user.reload- }.to change(user, :unread_high_priority_notifications)+ context "with a bookmark reminder message" do+ it "doesn't increase unread_notifications" do+ expect {+ Fabricate(:bookmark_reminder_notification, user: user)+ user.reload+ }.not_to change(user, :unread_notifications)+ end++ it "increases total_unread_notifications" do+ expect {+ Fabricate(:notification, user: user)+ user.reload+ }.to change(user, :total_unread_notifications)+ end++ it "increases unread_high_priority_notifications" do+ expect {+ Fabricate(:bookmark_reminder_notification, user: user)+ user.reload+ }.to change(user, :unread_high_priority_notifications)+ endendend- context "with a bookmark reminder message" do- it "doesn't increase unread_notifications" do- expect {- Fabricate(:bookmark_reminder_notification, user: user)- user.reload- }.not_to change(user, :unread_notifications)- end+ describe "message bus" do+ fab!(:user) { Fabricate(:user, last_seen_at: 1.day.ago) }- it "increases total_unread_notifications" do- expect {- Fabricate(:notification, user: user)- user.reload- }.to change(user, :total_unread_notifications)+ it "updates the notification count on create" do+ Notification.any_instance.expects(:refresh_notification_count).returns(nil)+ Fabricate(:notification)end- it "increases unread_high_priority_notifications" do- expect {- Fabricate(:bookmark_reminder_notification, user: user)- user.reload- }.to change(user, :unread_high_priority_notifications)+ it "publishes the updated unread count for each new notification" do+ messages =+ MessageBus.track_publish do+ user.notifications.create!(+ notification_type: Notification.types[:mentioned],+ data: "{}",+ )+ user.notifications.create!(+ notification_type: Notification.types[:mentioned],+ data: "{}",+ )+ end++ expect(messages.size).to eq(2)+ expect(messages[0].channel).to eq("/notification/#{user.id}")+ expect(messages[0].data[:unread_notifications]).to eq(1)+ expect(messages[1].channel).to eq("/notification/#{user.id}")+ expect(messages[1].data[:unread_notifications]).to eq(2)end- end- end- describe "message bus" do- fab!(:user) { Fabricate(:user, last_seen_at: 1.day.ago) }+ it "works for partial model instances" do+ NotificationEmailer.disable+ partial_user = User.select(:id).find_by(id: user.id)+ partial_user.notifications.create!(+ notification_type: Notification.types[:mentioned],+ data: "{}",+ )+ end- it "updates the notification count on create" do- Notification.any_instance.expects(:refresh_notification_count).returns(nil)- Fabricate(:notification)- end+ context "when destroying" do+ let!(:notification) { Fabricate(:notification) }- it "works" do- messages =- MessageBus.track_publish do- user.notifications.create!(notification_type: Notification.types[:mentioned], data: "{}")- user.notifications.create!(notification_type: Notification.types[:mentioned], data: "{}")+ it "updates the notification count on destroy" do+ Notification.any_instance.expects(:refresh_notification_count).returns(nil)+ notification.destroy!end-- expect(messages.size).to eq(2)- expect(messages[0].channel).to eq("/notification/#{user.id}")- expect(messages[0].data[:unread_notifications]).to eq(1)- expect(messages[1].channel).to eq("/notification/#{user.id}")- expect(messages[1].data[:unread_notifications]).to eq(2)+ endend- it "works for partial model instances" do- NotificationEmailer.disable- partial_user = User.select(:id).find_by(id: user.id)- partial_user.notifications.create!(- notification_type: Notification.types[:mentioned],- data: "{}",- )- end+ describe "private message" do+ let(:topic) { Fabricate(:private_message_topic) }+ let(:post) { Fabricate(:post, topic:, user: topic.user) }+ let(:target) do+ post.topic.topic_allowed_users.reject { |a| a.user_id == post.user_id }[0].user+ end- context "when destroying" do- let!(:notification) { Fabricate(:notification) }+ before do+ TopicUser.change(+ target.id,+ topic.id,+ notification_level: TopicUser.notification_levels[:watching],+ )- it "updates the notification count on destroy" do- Notification.any_instance.expects(:refresh_notification_count).returns(nil)- notification.destroy!+ PostAlerter.post_created(post)end- end- end- describe "private message" do- let(:topic) { Fabricate(:private_message_topic) }- let(:post) { Fabricate(:post, topic:, user: topic.user) }- let(:target) { post.topic.topic_allowed_users.reject { |a| a.user_id == post.user_id }[0].user }-- before do- TopicUser.change(- target.id,- topic.id,- notification_level: TopicUser.notification_levels[:watching],- )+ it "creates and rolls up private message notifications" do+ expect(target.notifications.first.notification_type).to eq(+ Notification.types[:private_message],+ )+ expect(post.user.unread_notifications).to eq(0)+ expect(post.user.total_unread_notifications).to eq(0)+ expect(target.unread_high_priority_notifications).to eq(1)- PostAlerter.post_created(post)+ Fabricate(:post, topic:, user: topic.user)+ target.reload+ expect(target.unread_high_priority_notifications).to eq(1)+ endend- it "should create and roll up private message notifications" do- expect(target.notifications.first.notification_type).to eq(- Notification.types[:private_message],- )- expect(post.user.unread_notifications).to eq(0)- expect(post.user.total_unread_notifications).to eq(0)- expect(target.unread_high_priority_notifications).to eq(1)-- Fabricate(:post, topic:, user: topic.user)- target.reload- expect(target.unread_high_priority_notifications).to eq(1)- end- end+ describe ".post" do+ let(:post) { Fabricate(:post) }+ let!(:notification) do+ Fabricate(:notification, user: post.user, topic: post.topic, post_number: post.post_number)+ end- describe ".post" do- let(:post) { Fabricate(:post) }- let!(:notification) do- Fabricate(:notification, user: post.user, topic: post.topic, post_number: post.post_number)+ it "returns the post" do+ expect(notification.post).to eq(post)+ endend- it "returns the post" do- expect(notification.post).to eq(post)- end- end+ describe "#url" do+ fab!(:topic)+ fab!(:post) { Fabricate(:post, topic: topic, post_number: 5) }- describe "#url" do- fab!(:topic)- fab!(:post) { Fabricate(:post, topic: topic, post_number: 5) }+ it "returns the relative topic url for a regular reply notification" do+ notification =+ Fabricate(+ :notification,+ notification_type: Notification.types[:replied],+ topic: topic,+ post_number: 5,+ data: { topic_title: topic.title, display_username: "u" }.to_json,+ )- it "returns the relative topic url for a regular reply notification" do- notification =- Fabricate(- :notification,- notification_type: Notification.types[:replied],- topic: topic,- post_number: 5,- data: { topic_title: topic.title, display_username: "u" }.to_json,- )-- expect(notification.url).to eq(topic.relative_url(5))- end+ expect(notification.url).to eq(topic.relative_url(5))+ end- it "returns the topic root with sort=new&collapse_replies=true for a consolidated topic-bucket notification" do- notification =- Fabricate(- :notification,- notification_type: Notification.types[:replied],- topic: topic,- post_number: 7,- data: {- topic_title: topic.title,- display_username: "3 replies",- reply_to_post_number: 1,- consolidated_count: 3,- }.to_json,+ it "returns the topic root with sort=new&collapse_replies=true for a consolidated topic-bucket notification" do+ notification =+ Fabricate(+ :notification,+ notification_type: Notification.types[:replied],+ topic: topic,+ post_number: 7,+ data: {+ topic_title: topic.title,+ display_username: "3 replies",+ reply_to_post_number: 1,+ consolidated_count: 3,+ }.to_json,+ )++ expect(notification.url).to eq(+ "/t/#{topic.slug}/#{topic.id}?sort=new&collapse_replies=true",)+ end- expect(notification.url).to eq("/t/#{topic.slug}/#{topic.id}?sort=new&collapse_replies=true")- end-- it "returns the bucket parent's context with sort=new&collapse_replies=true for a consolidated per-post-bucket notification" do- notification =- Fabricate(- :notification,- notification_type: Notification.types[:replied],- topic: topic,- post_number: 7,- data: {- topic_title: topic.title,- display_username: "2 replies",- reply_to_post_number: 4,- consolidated_count: 2,- }.to_json,+ it "returns the bucket parent's context with sort=new&collapse_replies=true for a consolidated per-post-bucket notification" do+ notification =+ Fabricate(+ :notification,+ notification_type: Notification.types[:replied],+ topic: topic,+ post_number: 7,+ data: {+ topic_title: topic.title,+ display_username: "2 replies",+ reply_to_post_number: 4,+ consolidated_count: 2,+ }.to_json,+ )++ expect(notification.url).to eq(+ "/t/#{topic.slug}/#{topic.id}/4?sort=new&collapse_replies=true",)+ end- expect(notification.url).to eq(- "/t/#{topic.slug}/#{topic.id}/4?sort=new&collapse_replies=true",- )+ it "uses the canonical specific-post URL for a singular nested-bucket notification" do+ notification =+ Fabricate(+ :notification,+ notification_type: Notification.types[:replied],+ topic: topic,+ post_number: 5,+ data: {+ topic_title: topic.title,+ display_username: "u",+ reply_to_post_number: 1,+ }.to_json,+ )++ expect(notification.url).to eq(topic.relative_url(5))+ endend- it "uses the canonical specific-post URL for a singular nested-bucket notification" do- notification =- Fabricate(- :notification,- notification_type: Notification.types[:replied],- topic: topic,- post_number: 5,- data: {- topic_title: topic.title,- display_username: "u",- reply_to_post_number: 1,- }.to_json,- )-- expect(notification.url).to eq(topic.relative_url(5))- end- end+ describe "data" do+ let(:notification) { Fabricate.build(:notification) }- describe "data" do- let(:notification) { Fabricate.build(:notification) }+ it "provides a data hash" do+ expect(notification.data_hash).to be_present+ end- it "should have a data hash" do- expect(notification.data_hash).to be_present+ it "parses the JSON notification data" do+ expect(notification.data_hash[:poison]).to eq("ivy")+ endend- it "should have the data within the json" do- expect(notification.data_hash[:poison]).to eq("ivy")- end- end+ describe "saw_regular_notification_id" do+ it "correctly updates the read state" do+ t = Fabricate(:topic)- describe "saw_regular_notification_id" do- it "correctly updates the read state" do- t = Fabricate(:topic)-- Notification.create!(- read: false,- user_id: user.id,- topic_id: t.id,- post_number: 1,- data: "{}",- notification_type: Notification.types[:private_message],- )-- Notification.create!(- read: false,- user_id: user.id,- topic_id: t.id,- post_number: 1,- data: "{}",- notification_type: Notification.types[:bookmark_reminder],- )-- other =Notification.create!(read: false,user_id: user.id,topic_id: t.id,post_number: 1,data: "{}",- notification_type: Notification.types[:mentioned],+ notification_type: Notification.types[:private_message],)- user.bump_last_seen_notification!- user.reload-- expect(user.unread_notifications).to eq(0)- expect(user.total_unread_notifications).to eq(3)- expect(user.unread_high_priority_notifications).to eq(2)- end- end-- describe "mark_posts_read" do- it "marks multiple posts as read if needed" do- (1..3).map do |i|Notification.create!(read: false,user_id: user.id,- topic_id: 2,- post_number: i,+ topic_id: t.id,+ post_number: 1,data: "{}",- notification_type: 1,+ notification_type: Notification.types[:bookmark_reminder],)- end- Notification.create!(- read: true,- user_id: user.id,- topic_id: 2,- post_number: 4,- data: "{}",- notification_type: 1,- )-- expect { Notification.mark_posts_read(user, 2, [1, 2, 3, 4]) }.to change {- Notification.where(read: true).count- }.by(3)- end- end-- describe "#ensure_consistency!" do- it "deletes notifications if post is missing or deleted" do- NotificationEmailer.disable-- p = Fabricate(:post)- p2 = Fabricate(:post)-- Notification.create!(- read: false,- user_id: p.user_id,- topic_id: p.topic_id,- post_number: p.post_number,- data: "[]",- notification_type: Notification.types[:private_message],- )- Notification.create!(- read: false,- user_id: p2.user_id,- topic_id: p2.topic_id,- post_number: p2.post_number,- data: "[]",- notification_type: Notification.types[:private_message],- )- Notification.create!(- read: false,- user_id: p2.user_id,- topic_id: p2.topic_id,- post_number: p2.post_number,- data: "[]",- notification_type: Notification.types[:bookmark_reminder],- )-- Notification.create!(- read: false,- user_id: p2.user_id,- topic_id: p2.topic_id,- post_number: p2.post_number,- data: "[]",- notification_type: Notification.types[:liked],- )- p2.trash!(p.user)-- # we may want to make notification "trashable" but for now we nuke pm notifications from deleted topics/posts- Notification.ensure_consistency!-- expect(Notification.count).to eq(2)- end- it "does not delete notifications that do not have a topic_id" do- Notification.create!(- read: false,- user_id: user.id,- topic_id: nil,- post_number: nil,- data: "[]",- notification_type: Notification.types[:chat_mention],- high_priority: true,- )- expect { Notification.ensure_consistency! }.to_not change { Notification.count }+ other =+ Notification.create!(+ read: false,+ user_id: user.id,+ topic_id: t.id,+ post_number: 1,+ data: "{}",+ notification_type: Notification.types[:mentioned],+ )++ user.bump_last_seen_notification!+ user.reload++ expect(user.unread_notifications).to eq(0)+ expect(user.total_unread_notifications).to eq(3)+ expect(user.unread_high_priority_notifications).to eq(2)+ endend- end- describe "do not disturb" do- it "calls NotificationEmailer.process_notification when user is not in 'do not disturb'" do- notification =- Notification.new(- read: false,+ describe "mark_posts_read" do+ it "marks multiple posts as read if needed" do+ (1..3).map do |i|+ Notification.create!(+ read: false,+ user_id: user.id,+ topic_id: 2,+ post_number: i,+ data: "{}",+ notification_type: 1,+ )+ end+ Notification.create!(+ read: true,user_id: user.id,topic_id: 2,- post_number: 1,+ post_number: 4,data: "{}",notification_type: 1,)- NotificationEmailer.expects(:process_notification).with(notification)- notification.save!- end- it "doesn't call NotificationEmailer.process_notification when user is in 'do not disturb'" do- freeze_time- Fabricate(- :do_not_disturb_timing,- user: user,- starts_at: Time.zone.now,- ends_at: 1.day.from_now,- )-- notification =- Notification.new(- read: false,- user_id: user.id,- topic_id: 2,- post_number: 1,- data: "{}",- notification_type: 1,- )- NotificationEmailer.expects(:process_notification).with(notification).never- notification.save!+ expect { Notification.mark_posts_read(user, 2, [1, 2, 3, 4]) }.to change {+ Notification.where(read: true).count+ }.by(3)+ endend- end-end-# pulling this out cause I don't want an observer-RSpec.describe Notification do- fab!(:user)+ describe "#ensure_consistency!" do+ it "deletes notifications if post is missing or deleted" do+ NotificationEmailer.disable- describe ".prioritized_list" do- def create(**opts)- opts[:user] = user if !opts[:user]- Fabricate(:notification, user: user, **opts)- end+ p = Fabricate(:post)+ p2 = Fabricate(:post)- fab!(:unread_high_priority_1) do- create(high_priority: true, read: false, created_at: 8.minutes.ago)- end- fab!(:read_high_priority_1) do- create(high_priority: true, read: true, created_at: 7.minutes.ago)- end- fab!(:unread_regular_1) { create(high_priority: false, read: false, created_at: 6.minutes.ago) }- fab!(:read_regular_1) { create(high_priority: false, read: true, created_at: 5.minutes.ago) }- fab!(:unread_like) do- create(- high_priority: false,- read: false,- created_at: 130.seconds.ago,- notification_type: Notification.types[:liked],- )- end+ Notification.create!(+ read: false,+ user_id: p.user_id,+ topic_id: p.topic_id,+ post_number: p.post_number,+ data: "[]",+ notification_type: Notification.types[:private_message],+ )+ Notification.create!(+ read: false,+ user_id: p2.user_id,+ topic_id: p2.topic_id,+ post_number: p2.post_number,+ data: "[]",+ notification_type: Notification.types[:private_message],+ )+ Notification.create!(+ read: false,+ user_id: p2.user_id,+ topic_id: p2.topic_id,+ post_number: p2.post_number,+ data: "[]",+ notification_type: Notification.types[:bookmark_reminder],+ )- fab!(:unread_high_priority_2) do- create(high_priority: true, read: false, created_at: 1.minute.ago)- end- fab!(:read_high_priority_2) do- create(high_priority: true, read: true, created_at: 2.minutes.ago)- end- fab!(:unread_regular_2) { create(high_priority: false, read: false, created_at: 3.minutes.ago) }- fab!(:read_regular_2) { create(high_priority: false, read: true, created_at: 4.minutes.ago) }-- it "puts unread high_priority on top followed by unread normal notifications and then everything else in reverse chronological order" do- expect(Notification.prioritized_list(user).map(&:id)).to eq(- [- unread_high_priority_2,- unread_high_priority_1,- unread_regular_2,- unread_regular_1,- read_high_priority_2,- unread_like,- read_regular_2,- read_regular_1,- read_high_priority_1,- ].map(&:id),- )- end+ Notification.create!(+ read: false,+ user_id: p2.user_id,+ topic_id: p2.topic_id,+ post_number: p2.post_number,+ data: "[]",+ notification_type: Notification.types[:liked],+ )+ p2.trash!(p.user)- it "doesn't include notifications from other users" do- another_user_notification = create(high_priority: true, read: false, user: Fabricate(:user))- expect(Notification.prioritized_list(user).map(&:id)).to contain_exactly(- *[- unread_high_priority_2,- unread_high_priority_1,- unread_regular_2,- unread_regular_1,- read_high_priority_2,- unread_like,- read_regular_2,- read_regular_1,- read_high_priority_1,- ].map(&:id),- )- expect(- Notification.prioritized_list(another_user_notification.user).map(&:id),- ).to contain_exactly(another_user_notification.id)- end+ # we may want to make notification "trashable" but for now we nuke pm notifications from deleted topics/posts+ Notification.ensure_consistency!- it "doesn't include notifications from deleted topics" do- unread_high_priority_1.topic.trash!- unread_regular_2.topic.trash!- read_regular_1.topic.trash!- expect(Notification.prioritized_list(user).map(&:id)).to contain_exactly(- *[- unread_high_priority_2,- unread_regular_1,- read_high_priority_2,- unread_like,- read_regular_2,- read_high_priority_1,- ].map(&:id),- )- end+ expect(Notification.count).to eq(2)+ end- it "doesn't include like notifications if the user doesn't want like notifications" do- user.user_option.update!(- like_notification_frequency: UserOption.like_notification_frequency_type[:never],- )- unread_regular_1.update!(notification_type: Notification.types[:liked])- read_regular_2.update!(notification_type: Notification.types[:liked_consolidated])- expect(Notification.prioritized_list(user).map(&:id)).to eq(- [- unread_high_priority_2,- unread_high_priority_1,- unread_regular_2,- read_high_priority_2,- read_regular_1,- read_high_priority_1,- ].map(&:id),- )+ it "does not delete notifications that do not have a topic_id" do+ Notification.create!(+ read: false,+ user_id: user.id,+ topic_id: nil,+ post_number: nil,+ data: "[]",+ notification_type: Notification.types[:chat_mention],+ high_priority: true,+ )+ expect { Notification.ensure_consistency! }.to_not change { Notification.count }+ endend- it "respects the count param" do- expect(Notification.prioritized_list(user, count: 1).map(&:id)).to eq(- [unread_high_priority_2].map(&:id),- )-- expect(Notification.prioritized_list(user, count: 3).map(&:id)).to eq(- [unread_high_priority_2, unread_high_priority_1, unread_regular_2].map(&:id),- )- end+ describe "do not disturb" do+ it "calls NotificationEmailer.process_notification when user is not in 'do not disturb'" do+ notification =+ Notification.new(+ read: false,+ user_id: user.id,+ topic_id: 2,+ post_number: 1,+ data: "{}",+ notification_type: 1,+ )+ NotificationEmailer.expects(:process_notification).with(notification)+ notification.save!+ end- it "can filter the list by specific types" do- unread_regular_1.update!(notification_type: Notification.types[:liked])- read_regular_2.update!(notification_type: Notification.types[:liked_consolidated])- expect(- Notification.prioritized_list(- user,- types: [Notification.types[:liked], Notification.types[:liked_consolidated]],- ).map(&:id),- ).to eq([unread_like, unread_regular_1, read_regular_2].map(&:id))- end+ it "doesn't call NotificationEmailer.process_notification when user is in 'do not disturb'" do+ freeze_time+ Fabricate(+ :do_not_disturb_timing,+ user: user,+ starts_at: Time.zone.now,+ ends_at: 1.day.from_now,+ )- it "includes like notifications when filtering by like types even if the user doesn't want like notifications" do- user.user_option.update!(- like_notification_frequency: UserOption.like_notification_frequency_type[:never],- )- unread_regular_1.update!(notification_type: Notification.types[:liked])- read_regular_2.update!(notification_type: Notification.types[:liked_consolidated])- expect(- Notification.prioritized_list(- user,- types: [Notification.types[:liked], Notification.types[:liked_consolidated]],- ).map(&:id),- ).to eq([unread_like, unread_regular_1, read_regular_2].map(&:id))- expect(- Notification.prioritized_list(user, types: [Notification.types[:liked]]).map(&:id),- ).to contain_exactly(unread_like.id, unread_regular_1.id)+ notification =+ Notification.new(+ read: false,+ user_id: user.id,+ topic_id: 2,+ post_number: 1,+ data: "{}",+ notification_type: 1,+ )+ NotificationEmailer.expects(:process_notification).with(notification).never+ notification.save!+ endendend- describe "#recent_report" do- let(:post) { Fabricate(:post) }- let(:vars) { { i: 0 } }-- def fab(type, read)- vars[:i] += 1- Notification.create!(- read: read,- user_id: user.id,- topic_id: post.topic_id,- post_number: post.post_number,- data: "[]",- notification_type: type,- created_at: vars[:i].days.from_now,- )- end-- def unread_pm- fab(Notification.types[:private_message], false)- end-- def unread_bookmark_reminder- fab(Notification.types[:bookmark_reminder], false)- end+ # pulling this out cause I don't want an observer+ context "with the notification observer disabled" do+ fab!(:user)- def pm- fab(Notification.types[:private_message], true)- end+ describe ".prioritized_list" do+ def create(**opts)+ opts[:user] = user if !opts[:user]+ Fabricate(:notification, user: user, **opts)+ end- def regular- fab(Notification.types[:liked], true)- end+ fab!(:unread_high_priority_1) do+ create(high_priority: true, read: false, created_at: 8.minutes.ago)+ end+ fab!(:read_high_priority_1) do+ create(high_priority: true, read: true, created_at: 7.minutes.ago)+ end+ fab!(:unread_regular_1) do+ create(high_priority: false, read: false, created_at: 6.minutes.ago)+ end+ fab!(:read_regular_1) { create(high_priority: false, read: true, created_at: 5.minutes.ago) }+ fab!(:unread_like) do+ create(+ high_priority: false,+ read: false,+ created_at: 130.seconds.ago,+ notification_type: Notification.types[:liked],+ )+ end- def liked_consolidated- fab(Notification.types[:liked_consolidated], true)- end+ fab!(:unread_high_priority_2) do+ create(high_priority: true, read: false, created_at: 1.minute.ago)+ end+ fab!(:read_high_priority_2) do+ create(high_priority: true, read: true, created_at: 2.minutes.ago)+ end+ fab!(:unread_regular_2) do+ create(high_priority: false, read: false, created_at: 3.minutes.ago)+ end+ fab!(:read_regular_2) { create(high_priority: false, read: true, created_at: 4.minutes.ago) }++ it "puts unread high_priority on top followed by unread normal notifications and then everything else in reverse chronological order" do+ expect(Notification.prioritized_list(user).map(&:id)).to eq(+ [+ unread_high_priority_2,+ unread_high_priority_1,+ unread_regular_2,+ unread_regular_1,+ read_high_priority_2,+ unread_like,+ read_regular_2,+ read_regular_1,+ read_high_priority_1,+ ].map(&:id),+ )+ end- it "correctly finds visible notifications" do- pm- expect(Notification.visible.count).to eq(1)- post.topic.trash!- expect(Notification.visible.count).to eq(0)- end+ it "doesn't include notifications from other users" do+ another_user_notification = create(high_priority: true, read: false, user: Fabricate(:user))+ expect(Notification.prioritized_list(user).map(&:id)).to contain_exactly(+ *[+ unread_high_priority_2,+ unread_high_priority_1,+ unread_regular_2,+ unread_regular_1,+ read_high_priority_2,+ unread_like,+ read_regular_2,+ read_regular_1,+ read_high_priority_1,+ ].map(&:id),+ )+ expect(+ Notification.prioritized_list(another_user_notification.user).map(&:id),+ ).to contain_exactly(another_user_notification.id)+ end- it "orders stuff by creation descending, bumping unread high priority (pms, bookmark reminders) to top" do- # note we expect the final order to read bottom-up for this list of variables,- # with unread pm + bookmark reminder at the top of that list- a = unread_pm- regular- b = unread_bookmark_reminder- c = pm- d = regular-- notifications = Notification.recent_report(user, 4)- expect(notifications.map { |n| n.id }).to eq([b.id, a.id, d.id, c.id])- end+ it "doesn't include notifications from deleted topics" do+ unread_high_priority_1.topic.trash!+ unread_regular_2.topic.trash!+ read_regular_1.topic.trash!+ expect(Notification.prioritized_list(user).map(&:id)).to contain_exactly(+ *[+ unread_high_priority_2,+ unread_regular_1,+ read_high_priority_2,+ unread_like,+ read_regular_2,+ read_high_priority_1,+ ].map(&:id),+ )+ end- describe "for a user that does not want to be notify on liked" do- before do+ it "doesn't include like notifications if the user doesn't want like notifications" douser.user_option.update!(like_notification_frequency: UserOption.like_notification_frequency_type[:never],)+ unread_regular_1.update!(notification_type: Notification.types[:liked])+ read_regular_2.update!(notification_type: Notification.types[:liked_consolidated])+ expect(Notification.prioritized_list(user).map(&:id)).to eq(+ [+ unread_high_priority_2,+ unread_high_priority_1,+ unread_regular_2,+ read_high_priority_2,+ read_regular_1,+ read_high_priority_1,+ ].map(&:id),+ )end- it "should not return any form of liked notifications" do- notification = pm- regular- liked_consolidated+ it "respects the count param" do+ expect(Notification.prioritized_list(user, count: 1).map(&:id)).to eq(+ [unread_high_priority_2].map(&:id),+ )- expect(Notification.recent_report(user)).to contain_exactly(notification)+ expect(Notification.prioritized_list(user, count: 3).map(&:id)).to eq(+ [unread_high_priority_2, unread_high_priority_1, unread_regular_2].map(&:id),+ )+ end++ it "can filter the list by specific types" do+ unread_regular_1.update!(notification_type: Notification.types[:liked])+ read_regular_2.update!(notification_type: Notification.types[:liked_consolidated])+ expect(+ Notification.prioritized_list(+ user,+ types: [Notification.types[:liked], Notification.types[:liked_consolidated]],+ ).map(&:id),+ ).to eq([unread_like, unread_regular_1, read_regular_2].map(&:id))+ end++ it "includes like notifications when filtering by like types even if the user doesn't want like notifications" do+ user.user_option.update!(+ like_notification_frequency: UserOption.like_notification_frequency_type[:never],+ )+ unread_regular_1.update!(notification_type: Notification.types[:liked])+ read_regular_2.update!(notification_type: Notification.types[:liked_consolidated])+ expect(+ Notification.prioritized_list(+ user,+ types: [Notification.types[:liked], Notification.types[:liked_consolidated]],+ ).map(&:id),+ ).to eq([unread_like, unread_regular_1, read_regular_2].map(&:id))+ expect(+ Notification.prioritized_list(user, types: [Notification.types[:liked]]).map(&:id),+ ).to contain_exactly(unread_like.id, unread_regular_1.id)endend- describe "#consolidate_membership_requests" do- fab!(:group) { Fabricate(:group, name: "XXsssssddd") }- fab!(:user)- fab!(:post)+ describe "#recent_report" do+ let(:post) { Fabricate(:post) }+ let(:vars) { { i: 0 } }- def create_membership_request_notification- Notification.consolidate_or_create!(- notification_type: Notification.types[:private_message],+ def fab(type, read)+ vars[:i] += 1+ Notification.create!(+ read: read,user_id: user.id,- data: {- topic_title: I18n.t("groups.request_membership_pm.title", group_name: group.name),- original_post_id: post.id,- }.to_json,- updated_at: Time.zone.now,- created_at: Time.zone.now,+ topic_id: post.topic_id,+ post_number: post.post_number,+ data: "[]",+ notification_type: type,+ created_at: vars[:i].days.from_now,)end- before do- PostCustomField.create!(post_id: post.id, name: "requested_group_id", value: group.id)- 2.times { create_membership_request_notification }+ def unread_pm+ fab(Notification.types[:private_message], false)end- it "should consolidate membership requests to a new notification" do- original_notification = create_membership_request_notification- starting_count = SiteSetting.notification_consolidation_threshold+ def unread_bookmark_reminder+ fab(Notification.types[:bookmark_reminder], false)+ end- consolidated_notification = create_membership_request_notification- expect { original_notification.reload }.to raise_error(ActiveRecord::RecordNotFound)+ def pm+ fab(Notification.types[:private_message], true)+ end- expect(consolidated_notification.notification_type).to eq(- Notification.types[:membership_request_consolidated],- )+ def regular+ fab(Notification.types[:liked], true)+ end- data = consolidated_notification.data_hash- expect(data[:group_name]).to eq(group.name)- expect(data[:count]).to eq(starting_count + 1)+ def liked_consolidated+ fab(Notification.types[:liked_consolidated], true)+ end- updated_consolidated_notification = create_membership_request_notification+ it "correctly finds visible notifications" do+ pm+ expect(Notification.visible.count).to eq(1)+ post.topic.trash!+ expect(Notification.visible.count).to eq(0)+ end- expect(updated_consolidated_notification.data_hash[:count]).to eq(starting_count + 2)+ it "orders stuff by creation descending, bumping unread high priority (pms, bookmark reminders) to top" do+ # note we expect the final order to read bottom-up for this list of variables,+ # with unread pm + bookmark reminder at the top of that list+ a = unread_pm+ regular+ b = unread_bookmark_reminder+ c = pm+ d = regular++ notifications = Notification.recent_report(user, 4)+ expect(notifications.map { |n| n.id }).to eq([b.id, a.id, d.id, c.id])end- it 'consolidates membership requests with "processed" false if user is in DND' do- user.do_not_disturb_timings.create(starts_at: Time.now, ends_at: 3.days.from_now)+ describe "for a user that does not want to be notify on liked" do+ before do+ user.user_option.update!(+ like_notification_frequency: UserOption.like_notification_frequency_type[:never],+ )+ end- create_membership_request_notification- create_membership_request_notification+ it "excludes all types of like notifications" do+ notification = pm+ regular+ liked_consolidated- notification = Notification.last- expect(notification.notification_type).to eq(- Notification.types[:membership_request_consolidated],- )- expect(notification.shelved_notification).to be_present+ expect(Notification.recent_report(user)).to contain_exactly(notification)+ endend- end- end- describe "purge_old!" do- fab!(:user)- fab!(:notification1) { Fabricate(:notification, user: user) }- fab!(:notification2) { Fabricate(:notification, user: user) }- fab!(:notification3) { Fabricate(:notification, user: user) }- fab!(:notification4) { Fabricate(:notification, user: user) }+ describe "#consolidate_membership_requests" do+ fab!(:group) { Fabricate(:group, name: "XXsssssddd") }+ fab!(:user)+ fab!(:post)++ def create_membership_request_notification+ Notification.consolidate_or_create!(+ notification_type: Notification.types[:private_message],+ user_id: user.id,+ data: {+ topic_title: I18n.t("groups.request_membership_pm.title", group_name: group.name),+ original_post_id: post.id,+ }.to_json,+ updated_at: Time.zone.now,+ created_at: Time.zone.now,+ )+ end- it "does nothing if set to 0" do- SiteSetting.max_notifications_per_user = 0- Notification.purge_old!+ before do+ PostCustomField.create!(post_id: post.id, name: "requested_group_id", value: group.id)+ 2.times { create_membership_request_notification }+ end- expect(Notification.where(user_id: user.id).count).to eq(4)- end+ it "consolidates membership requests into a new notification" do+ original_notification = create_membership_request_notification+ starting_count = SiteSetting.notification_consolidation_threshold- it "correctly limits" do- SiteSetting.max_notifications_per_user = 2- Notification.purge_old!+ consolidated_notification = create_membership_request_notification+ expect { original_notification.reload }.to raise_error(ActiveRecord::RecordNotFound)- expect(Notification.where(user_id: user.id).pluck(:id)).to contain_exactly(- notification4.id,- notification3.id,- )- end- end+ expect(consolidated_notification.notification_type).to eq(+ Notification.types[:membership_request_consolidated],+ )- describe "do not disturb" do- fab!(:user)+ data = consolidated_notification.data_hash+ expect(data[:group_name]).to eq(group.name)+ expect(data[:count]).to eq(starting_count + 1)- it "creates a shelved_notification record when created while user is in DND" do- user.do_not_disturb_timings.create(starts_at: Time.now, ends_at: 3.days.from_now)- notification =- Notification.create(- read: false,- user_id: user.id,- topic_id: 2,- post_number: 1,- data: "{}",- notification_type: 1,- )- expect(notification.shelved_notification).to be_present- end+ updated_consolidated_notification = create_membership_request_notification- it "doesn't create a shelved_notification record when created while user is isn't DND" do- notification =- Notification.create(- read: false,- user_id: user.id,- topic_id: 2,- post_number: 1,- data: "{}",- notification_type: 1,- )- expect(notification.shelved_notification).to be_nil- end- end+ expect(updated_consolidated_notification.data_hash[:count]).to eq(starting_count + 2)+ end- describe ".populate_acting_user" do- SiteSetting.enable_names = true-- fab!(:user1, :user)- fab!(:user2, :user)- fab!(:user3, :user)- fab!(:user4, :user)- fab!(:user5, :user)- fab!(:user6, :user)- fab!(:notification1) do- Fabricate(:notification, user: user, data: { username: user1.username }.to_json)- end- fab!(:notification2) do- Fabricate(:notification, user: user, data: { display_username: user2.username }.to_json)- end- fab!(:notification3) do- Fabricate(:notification, user: user, data: { mentioned_by_username: user3.username }.to_json)- end- fab!(:notification4) do- Fabricate(:notification, user: user, data: { invited_by_username: user4.username }.to_json)- end- fab!(:notification5) do- Fabricate(:notification, user: user, data: { original_username: user5.username }.to_json)- end- fab!(:notification6) do- Fabricate(:notification, user: user, data: { original_username: user6.username }.to_json)- end+ it 'consolidates membership requests with "processed" false if user is in DND' do+ user.do_not_disturb_timings.create(starts_at: Time.now, ends_at: 3.days.from_now)- it "Sets the acting_user correctly for each notification" do- SiteSetting.prioritize_full_name_in_ux = true- Notification.populate_acting_user(- [notification1, notification2, notification3, notification4, notification5],- )- expect(notification1.acting_user).to eq(user1)- expect(notification2.acting_user).to eq(user2)- expect(notification3.acting_user).to eq(user3)- expect(notification4.acting_user).to eq(user4)- expect(notification5.acting_user).to eq(user5)- expect(notification5.data_hash[:original_name]).to eq user5.name- end+ create_membership_request_notification+ create_membership_request_notification- context "with SiteSettings.enable_names=false" do- it "doesn't set the :original_name property" do- SiteSetting.enable_names = false- Notification.populate_acting_user([notification6])- expect(notification6.data_hash[:original_name]).to be_nil- SiteSetting.enable_names = true+ notification = Notification.last+ expect(notification.notification_type).to eq(+ Notification.types[:membership_request_consolidated],+ )+ expect(notification.shelved_notification).to be_present+ endendend- end- describe ".filter_disabled_badge_notifications" do- fab!(:enabled_badge) { Fabricate(:badge, enabled: true) }- fab!(:disabled_badge) { Fabricate(:badge, enabled: false) }+ describe "purge_old!" do+ fab!(:user)+ fab!(:notification1) { Fabricate(:notification, user: user) }+ fab!(:notification2) { Fabricate(:notification, user: user) }+ fab!(:notification3) { Fabricate(:notification, user: user) }+ fab!(:notification4) { Fabricate(:notification, user: user) }++ it "does nothing if set to 0" do+ SiteSetting.max_notifications_per_user = 0+ Notification.purge_old!- fab!(:enabled_badge_notification) do- BadgeGranter.send_notification(user.id, user.username, user.locale, enabled_badge)+ expect(Notification.where(user_id: user.id).count).to eq(4)+ end++ it "correctly limits" do+ SiteSetting.max_notifications_per_user = 2+ Notification.purge_old!++ expect(Notification.where(user_id: user.id).pluck(:id)).to contain_exactly(+ notification4.id,+ notification3.id,+ )+ endend- fab!(:disabled_badge_notification) do- BadgeGranter.send_notification(user.id, user.username, user.locale, disabled_badge)+ describe "do not disturb" do+ fab!(:user)++ it "creates a shelved_notification record when created while user is in DND" do+ user.do_not_disturb_timings.create(starts_at: Time.now, ends_at: 3.days.from_now)+ notification =+ Notification.create(+ read: false,+ user_id: user.id,+ topic_id: 2,+ post_number: 1,+ data: "{}",+ notification_type: 1,+ )+ expect(notification.shelved_notification).to be_present+ end++ it "doesn't create a shelved_notification record when created while user is isn't DND" do+ notification =+ Notification.create(+ read: false,+ user_id: user.id,+ topic_id: 2,+ post_number: 1,+ data: "{}",+ notification_type: 1,+ )+ expect(notification.shelved_notification).to be_nil+ endend- fab!(:regular_notification) { Fabricate(:notification, user: user) }+ describe ".populate_acting_user" do+ SiteSetting.enable_names = true- it "filters all badge notifications when enable_badges is false" do- SiteSetting.enable_badges = false+ fab!(:user1, :user)+ fab!(:user2, :user)+ fab!(:user3, :user)+ fab!(:user4, :user)+ fab!(:user5, :user)+ fab!(:user6, :user)+ fab!(:notification1) do+ Fabricate(:notification, user: user, data: { username: user1.username }.to_json)+ end+ fab!(:notification2) do+ Fabricate(:notification, user: user, data: { display_username: user2.username }.to_json)+ end+ fab!(:notification3) do+ Fabricate(+ :notification,+ user: user,+ data: { mentioned_by_username: user3.username }.to_json,+ )+ end+ fab!(:notification4) do+ Fabricate(:notification, user: user, data: { invited_by_username: user4.username }.to_json)+ end+ fab!(:notification5) do+ Fabricate(:notification, user: user, data: { original_username: user5.username }.to_json)+ end+ fab!(:notification6) do+ Fabricate(:notification, user: user, data: { original_username: user6.username }.to_json)+ end- result =- Notification.filter_disabled_badge_notifications(- [enabled_badge_notification, disabled_badge_notification, regular_notification],+ it "Sets the acting_user correctly for each notification" do+ SiteSetting.prioritize_full_name_in_ux = true+ Notification.populate_acting_user(+ [notification1, notification2, notification3, notification4, notification5],)+ expect(notification1.acting_user).to eq(user1)+ expect(notification2.acting_user).to eq(user2)+ expect(notification3.acting_user).to eq(user3)+ expect(notification4.acting_user).to eq(user4)+ expect(notification5.acting_user).to eq(user5)+ expect(notification5.data_hash[:original_name]).to eq user5.name+ end- expect(result).to contain_exactly(regular_notification)+ context "with SiteSettings.enable_names=false" do+ it "doesn't set the :original_name property" do+ SiteSetting.enable_names = false+ Notification.populate_acting_user([notification6])+ expect(notification6.data_hash[:original_name]).to be_nil+ SiteSetting.enable_names = true+ end+ endend- it "filters badge notifications for badges that are disabled" do- result =- Notification.filter_disabled_badge_notifications(- [enabled_badge_notification, disabled_badge_notification, regular_notification],- )+ describe ".filter_disabled_badge_notifications" do+ fab!(:enabled_badge) { Fabricate(:badge, enabled: true) }+ fab!(:disabled_badge) { Fabricate(:badge, enabled: false) }- expect(result).to contain_exactly(enabled_badge_notification, regular_notification)- end+ fab!(:enabled_badge_notification) do+ BadgeGranter.send_notification(user.id, user.username, user.locale, enabled_badge)+ end++ fab!(:disabled_badge_notification) do+ BadgeGranter.send_notification(user.id, user.username, user.locale, disabled_badge)+ end- it "filters badge notifications for badges that do not exist" do- enabled_badge.destroy!+ fab!(:regular_notification) { Fabricate(:notification, user: user) }- result = Notification.filter_disabled_badge_notifications([enabled_badge_notification])+ it "filters all badge notifications when enable_badges is false" do+ SiteSetting.enable_badges = false- expect(result).to eq([])+ result =+ Notification.filter_disabled_badge_notifications(+ [enabled_badge_notification, disabled_badge_notification, regular_notification],+ )++ expect(result).to contain_exactly(regular_notification)+ end++ it "filters badge notifications for badges that are disabled" do+ result =+ Notification.filter_disabled_badge_notifications(+ [enabled_badge_notification, disabled_badge_notification, regular_notification],+ )++ expect(result).to contain_exactly(enabled_badge_notification, regular_notification)+ end++ it "filters badge notifications for badges that do not exist" do+ enabled_badge.destroy!++ result = Notification.filter_disabled_badge_notifications([enabled_badge_notification])++ expect(result).to eq([])+ endendendenddiff --git a/spec/models/optimized_image_spec.rb b/spec/models/optimized_image_spec.rbindex 4884f0fdcff..1dcccfc880b 100644--- a/spec/models/optimized_image_spec.rb+++ b/spec/models/optimized_image_spec.rb@@ -8,7 +8,7 @@ RSpec.describe OptimizedImage dobefore { upload.id = 42 }describe ".crop" do- it "should produce cropped images (requires ImageMagick 7)" do+ it "produces cropped images with ImageMagick 7" dotmp_path = "/tmp/cropped.png"desired_width = 5desired_height = 5@@ -54,7 +54,7 @@ RSpec.describe OptimizedImage doendend- it "should correctly crop images horizontally" do+ it "crops images horizontally" dotmp_path = "/tmp/cropped.png"desired_width = 244desired_height = 500@@ -91,7 +91,7 @@ RSpec.describe OptimizedImage doenddescribe ".resize" do- it "should work correctly when extension is bad" do+ it "handles an invalid extension" dooriginal_path = Dir::Tmpname.create(%w[origin .bin]) { nil }begin@@ -112,7 +112,7 @@ RSpec.describe OptimizedImage doendend- it "should work correctly" do+ it "optimizes the image" dofile = File.open("#{Rails.root.join("spec/fixtures/images/resized.png")}")upload = UploadCreator.new(file, "test.bin").create_for(-1)@@ -144,7 +144,7 @@ RSpec.describe OptimizedImage doenddescribe "when an svg with a href is masked as a png" do- it "should not trigger the external request" do+ it "does not trigger an external request" dotmp_path = "/tmp/resized.png"begin@@ -165,7 +165,7 @@ RSpec.describe OptimizedImage doenddescribe ".downsize" do- it "should downsize logo (requires ImageMagick 7)" do+ it "downsizes the logo with ImageMagick 7" dotmp_path = "/tmp/downsized.png"begin@@ -327,7 +327,7 @@ RSpec.describe OptimizedImage doOptimizedImage.create_for(upload, 100, 200)end- it "works" do+ it "creates the optimized image" dooi = OptimizedImage.create_for(upload, 100, 200)expect(oi.sha1).to eq("da39a3ee5e6b4b0d3255bfef95601890afd80709")expect(oi.extension).to eq(".png")@@ -401,7 +401,7 @@ RSpec.describe OptimizedImage dodescribe "#destroy" dodescribe "when upload_id is no longer valid" do- it "should still destroy the record" do+ it "still destroys the record" doimage = Fabricate(:optimized_image)image.upload.deleteimage.reload.destroydiff --git a/spec/models/optimized_video_spec.rb b/spec/models/optimized_video_spec.rbindex 180cf0a63f9..df5bfd63fbe 100644--- a/spec/models/optimized_video_spec.rb+++ b/spec/models/optimized_video_spec.rb@@ -95,7 +95,7 @@ RSpec.describe OptimizedVideo doenddescribe "#destroy" do- it "should destroy the optimized video and its associated upload" do+ it "destroys the optimized video and its associated upload" dooptimized_video = Fabricate(:optimized_video)expect { optimized_video.destroy }.to change(OptimizedVideo, :count).by(-1)expect(Upload.exists?(optimized_video.optimized_upload_id)).to be(false)diff --git a/spec/models/post_action_spec.rb b/spec/models/post_action_spec.rbindex ba94ec4e6d6..e64db73a816 100644--- a/spec/models/post_action_spec.rb+++ b/spec/models/post_action_spec.rb@@ -155,7 +155,7 @@ RSpec.describe PostAction dodescribe "when a user likes something" dobefore { PostActionNotifier.enable }- it "should generate and remove notifications correctly" do+ it "creates and removes notifications" doPostActionCreator.like(codinghorror, post)expect(Notification.count).to eq(1)@@ -179,7 +179,7 @@ RSpec.describe PostAction doexpect(notification.notification_type).to eq(Notification.types[:liked])end- it "should not notify when never is selected" do+ it "does not notify when never is selected" dopost.user.user_option.update!(like_notification_frequency: UserOption.like_notification_frequency_type[:never],)@@ -269,7 +269,7 @@ RSpec.describe PostAction do)end- it "should consolidate likes notification when the threshold is reached" do+ it "consolidates like notifications at the threshold" doSiteSetting.notification_consolidation_threshold = 2expect do@@ -325,7 +325,7 @@ RSpec.describe PostAction do)end- it "should consolidate liked notifications when threshold is reached" do+ it "consolidates liked notifications at the threshold" doSiteSetting.notification_consolidation_threshold = 2post = Fabricate(:post, user: likee)@@ -363,14 +363,14 @@ RSpec.describe PostAction doendend- it "should not generate a notification if liker has been muted" do+ it "does not notify when the liker is muted" domutee = Fabricate(:user)MutedUser.create!(user_id: post.user.id, muted_user_id: mutee.id)expect do PostActionCreator.like(mutee, post) end.to_not change { Notification.count }end- it "should not generate a notification if liker has the topic muted" do+ it "does not notify when the liker muted the topic" dopost = Fabricate(:post, user: eviltrout)TopicUser.create!(@@ -382,7 +382,7 @@ RSpec.describe PostAction doexpect do PostActionCreator.like(codinghorror, post) end.to_not change { Notification.count }end- it "should generate a notification if liker is an admin irregardless of \+ it "notifies when the liker is an admin regardless of \muting" doMutedUser.create!(user_id: post.user.id, muted_user_id: admin.id)@@ -394,7 +394,7 @@ RSpec.describe PostAction doexpect(notification.notification_type).to eq(Notification.types[:liked])end- it "should not increase topic like count when liking a whisper" do+ it "does not increase the topic like count for a whisper" doSiteSetting.whispers_allowed_groups = "#{Group::AUTO_GROUPS[:staff]}"post.revise(admin, post_type: Post.types[:whisper])@@ -404,7 +404,7 @@ RSpec.describe PostAction doexpect(post.topic.like_count).to eq(0)end- it "should increase the `like_count` and `like_score` when a user likes something" do+ it "increases like_count and like_score when a user likes a post" dofreeze_time Date.todayPostActionCreator.like(codinghorror, post)@@ -437,7 +437,7 @@ RSpec.describe PostAction doexpect(post.topic.like_count).to eq(0)end- it "shouldn't change given_likes unless likes are given or removed" do+ it "changes given_likes only when likes are added or removed" dofreeze_timePostActionCreator.like(codinghorror, post)@@ -473,7 +473,7 @@ RSpec.describe PostAction doexpect(PostActionCreator.spam(eviltrout, post)).to be_successend- it "should update counts when you clear flags" do+ it "updates counts when flags are cleared" doreviewable = PostActionCreator.spam(eviltrout, post).reviewableexpect(post.reload.spam_count).to eq(1)@@ -483,7 +483,7 @@ RSpec.describe PostAction doexpect(post.reload.spam_count).to eq(0)end- it "will not allow regular users to auto hide staff posts" do+ it "does not let regular users automatically hide staff posts" domod = Fabricate(:moderator)post = Fabricate(:post, user: mod)@@ -515,7 +515,7 @@ RSpec.describe PostAction doexpect(post.hidden_at).to be_presentend- it "will not trigger auto hide on like" do+ it "does not trigger automatic hiding for likes" domod = Fabricate(:moderator)post = Fabricate(:post, user: mod)@@ -528,7 +528,7 @@ RSpec.describe PostAction doexpect(post.hidden).to eq(false)end- it "should follow the rules for automatic hiding workflow" do+ it "follows the automatic hiding workflow" dopost = create_postwalterwhite = Fabricate(:walter_white, refresh_auto_groups: true)@@ -631,7 +631,7 @@ RSpec.describe PostAction doexpect(result.reviewable.payload["targets_topic"]).to eq(true)end- it "will flag the first post if you flag a topic but there is only one post in the topic" do+ it "flags the first post when it is the topic's only post" dopost = create_postresult =PostActionCreator.new(@@ -645,7 +645,7 @@ RSpec.describe PostAction doexpect(result.reviewable.payload["targets_topic"]).to eq(false)end- it "will unhide the post when a moderator undoes the flag on which s/he took action" do+ it "unhides the post when a moderator undoes the handled flag" doDiscourse.stubs(:site_contact_user).returns(admin)post = create_post@@ -677,7 +677,7 @@ RSpec.describe PostAction doSiteSetting.num_hours_to_close_topic = 1end- it "will automatically pause a topic due to large community flagging" do+ it "automatically pauses a topic after extensive community flagging" dofreeze_time# reaching `num_flaggers_to_close_topic` isn't enough@@ -714,7 +714,7 @@ RSpec.describe PostAction dofab!(:staff_user) { Fabricate(:user, moderator: true) }fab!(:topic) { Fabricate(:topic, user: staff_user) }- it "will not close topics opened by staff" do+ it "does not close topics opened by staff" do[flagger1, flagger2].each do |flagger|[post1, post2, post3].each { |post| PostActionCreator.inappropriate(flagger, post) }end@@ -723,7 +723,7 @@ RSpec.describe PostAction doendend- it "will keep the topic in closed status until the community flags are handled" do+ it "keeps the topic closed until community flags are handled" dofreeze_timeSiteSetting.num_flaggers_to_close_topic = 1@@ -754,7 +754,7 @@ RSpec.describe PostAction doexpect(topic.reload.closed).to eq(false)end- it "will reopen topic after the flags are auto handled" do+ it "reopens the topic after flags are handled automatically" dofreeze_time[flagger1, flagger2].each do |flagger|[post1, post2, post3].each { |post| PostActionCreator.inappropriate(flagger, post) }@@ -841,7 +841,7 @@ RSpec.describe PostAction doflag_with_message.destroy!end- it "should raise the right errors when it fails to create a post" do+ it "returns the post-creation errors" douser = Fabricate(:user)UserSilencer.new(user, Discourse.system_user).silence@@ -849,7 +849,7 @@ RSpec.describe PostAction doexpect(result).to be_failedend- it "should succeed even with low max title length" do+ it "succeeds with a low maximum title length" doSiteSetting.max_topic_title_length = 50post.topic.title = "This is a test topic " * 2post.topic.save!@@ -871,7 +871,7 @@ RSpec.describe PostAction doenddescribe "#add_moderator_post_if_needed" do- it "should not add a moderator post when it's disabled" do+ it "does not add a moderator post when disabled" dopost = create_postresult = PostActionCreator.create(moderator, post, :spam, message: "WAT")@@ -883,7 +883,7 @@ RSpec.describe PostAction doexpect(topic.reload.posts.count).to eq(1)end- it "should create a notification in the related topic" do+ it "creates a notification in the related topic" doJobs.run_immediately!user = Fabricate(:user, refresh_auto_groups: true)stub_image_size@@ -900,7 +900,7 @@ RSpec.describe PostAction doend%i[agree_and_keep disagree ignore_and_do_nothing].each do |disposition|- it "should bump the topic when performing #{disposition}" do+ it "bumps the topic when performing #{disposition}" doSiteSetting.auto_respond_to_flag_actions = trueuser = Fabricate(:user, refresh_auto_groups: true)result = PostActionCreator.create(user, post, :spam, message: "WAT")@@ -938,7 +938,7 @@ RSpec.describe PostAction doaction.post_action_rate_limiterend- it "should scale up likes limits depending on trust level" do+ it "scales the like limit by trust level" doexpect(limiter(0, :like).max).to eq SiteSetting.max_likes_per_dayexpect(limiter(1, :like).max).to eq SiteSetting.max_likes_per_dayexpect(limiter(2, :like).max).to eq (@@ -961,7 +961,7 @@ RSpec.describe PostAction doexpect(limiter(2, :like).max).to eq SiteSetting.max_likes_per_dayend- it "should scale up flag limits depending on trust level" do+ it "scales the flag limit by trust level" do%i[off_topic inappropriate spam notify_moderators].each do |type|SiteSetting.tl2_additional_flags_per_day_multiplier = 1.5@@ -991,7 +991,7 @@ RSpec.describe PostAction dodescribe "#is_flag?" dodescribe "when post action is a flag" do- it "should return true" do+ it "returns true" doPostActionType.notify_flag_types.each do |_type, id|post_action = PostAction.new(user: codinghorror, post_action_type_id: id)@@ -1001,7 +1001,7 @@ RSpec.describe PostAction doenddescribe "when post action is not a flag" do- it "should return false" do+ it "returns false" dopost_action = PostAction.new(user: codinghorror, post_action_type_id: 99)expect(post_action.is_flag?).to eq(false)diff --git a/spec/models/post_action_type_spec.rb b/spec/models/post_action_type_spec.rbindex 5eb4ea0c1f1..28d0450e928 100644--- a/spec/models/post_action_type_spec.rb+++ b/spec/models/post_action_type_spec.rb@@ -3,7 +3,7 @@RSpec.describe PostActionType dodescribe "Callbacks" dodescribe "#expiry_cache" do- it "should clear the cache on save" do+ it "clears the cache on save" doDiscourse.cache.write("post_action_types_#{I18n.locale}", "test")Discourse.cache.write("post_action_flag_types_#{I18n.locale}", "test2")diff --git a/spec/models/post_analyzer_spec.rb b/spec/models/post_analyzer_spec.rbindex 274b6c2d1da..f5d89270825 100644--- a/spec/models/post_analyzer_spec.rb+++ b/spec/models/post_analyzer_spec.rb@@ -64,7 +64,7 @@ RSpec.describe PostAnalyzer doexpect(cooked).to eq("<p><em>this is italic</em></p>")end- it "should respect SiteSetting.max_oneboxes_per_post" do+ it "respects SiteSetting.max_oneboxes_per_post" doSiteSetting.max_oneboxes_per_post = 2Oneboxer.expects(:cached_onebox).with(url).returns("something").twice@@ -146,7 +146,7 @@ RSpec.describe PostAnalyzer doexpect(post_analyzer.linked_hosts).to eq("disneyland.disney.go.com" => 1, "reddit.com" => 1)end- it "it counts properly with more than one link on the same host" do+ it "counts each host once when multiple links share a host" dopost_analyzer = PostAnalyzer.new(raw_three_links, default_topic_id)expect(post_analyzer.linked_hosts).to eq("discourse.org" => 1, "www.imdb.com" => 1)end@@ -242,7 +242,7 @@ RSpec.describe PostAnalyzer doexpect(post_analyzer.link_count).to eq(0)end- it "returns 0 links for a post with mentions" do+ it "returns zero links for a post with hashtags" doSiteSetting.tagging_enabled = truepost_analyzer = PostAnalyzer.new(raw_post_with_hashtags, default_topic_id)expect(post_analyzer.link_count).to eq(0)diff --git a/spec/models/post_mover_spec.rb b/spec/models/post_mover_spec.rbindex c3d09598870..e0e09f4fefe 100644--- a/spec/models/post_mover_spec.rb+++ b/spec/models/post_mover_spec.rb@@ -173,7 +173,7 @@ RSpec.describe PostMover docontext "with post replies" dodescribe "when a post with replies is moved" do- it "should update post replies correctly" do+ it "updates post replies correctly" dotopic.move_posts(user,[p2.id],@@ -198,7 +198,7 @@ RSpec.describe PostMover doenddescribe "when replies of a post have been moved" do- it "should update post replies correctly" do+ it "updates post replies correctly" dop5 =Fabricate(:post,@@ -221,7 +221,7 @@ RSpec.describe PostMover doendcontext "when only one reply is left behind" do- it "should update post replies correctly" do+ it "updates post replies correctly" dop5 =Fabricate(:post,diff --git a/spec/models/post_reply_key_spec.rb b/spec/models/post_reply_key_spec.rbindex e93c0b4442d..4f832ad94e2 100644--- a/spec/models/post_reply_key_spec.rb+++ b/spec/models/post_reply_key_spec.rb@@ -2,7 +2,7 @@RSpec.describe PostReplyKey dodescribe "#reply_key" do- it "should format the reply_key correctly" do+ it "formats the reply key" dohex = SecureRandom.hexpost_reply_key = Fabricate(:post_reply_key, reply_key: hex)diff --git a/spec/models/post_reply_spec.rb b/spec/models/post_reply_spec.rbindex f61d13ac792..3cc5f46a88b 100644--- a/spec/models/post_reply_spec.rb+++ b/spec/models/post_reply_spec.rb@@ -6,7 +6,7 @@ RSpec.describe PostReply dofab!(:other_post) { Fabricate(:post, topic: topic) }describe "Validations" do- it "should ensure that the posts belong in the same topic" do+ it "requires both posts to belong to the same topic" doexpect(PostReply.new(post: post, reply: other_post)).to be_validother_topic = Fabricate(:topic)diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rbindex 0dd656fc7e9..56c608d4b99 100644--- a/spec/models/post_spec.rb+++ b/spec/models/post_spec.rb@@ -148,7 +148,7 @@ RSpec.describe Post dopostend- it "will have its notice cleared when post is trashed" do+ it "clears its notice when trashed" doexpect { post.trash! }.to change { post.custom_fields }.to({})endend@@ -532,7 +532,7 @@ RSpec.describe Post doexpect(two_links.linked_hosts).to eq("disneyland.disney.go.com" => 1, "reddit.com" => 1)end- it "it counts properly with more than one link on the same host" do+ it "counts multiple links on the same host correctly" doexpect(three_links.linked_hosts).to eq("discourse.org" => 1, "www.imdb.com" => 1)endend@@ -635,7 +635,7 @@ RSpec.describe Post doexpect(post_one_link).not_to be_validend- it "will skip the check for allowlisted domains" do+ it "skips the check for allowlisted domains" doSiteSetting.allowed_link_domains = "www.bbc.co.uk"SiteSetting.post_links_allowed_groups = "12"post_two_links.user.change_trust_level!(TrustLevel[1])@@ -793,7 +793,7 @@ RSpec.describe Post docontext "with grace period editing & edit windows" dobefore { SiteSetting.editing_grace_period = 1.minute.to_i }- it "works" do+ it "updates the post's link counts" dorevised_at = post.updated_at + 2.minutesnew_revised_at = revised_at + 2.minutes@@ -894,7 +894,7 @@ RSpec.describe Post do)end- it "should not cook the post if raw has not been changed" do+ it "does not cook the post when raw is unchanged" dopost.save!expect(post.cooked).to eq(cooked)end@@ -1132,7 +1132,7 @@ RSpec.describe Post do)end- it "should unconditionally follow links for staff" do+ it "always follows links for staff" doSiteSetting.tl3_links_no_follow = truepost.user.trust_level = 1post.user.moderator = true@@ -1141,7 +1141,7 @@ RSpec.describe Post doexpect(post.cooked).not_to match(/nofollow/)end- it "should add nofollow to links in the post for trust levels below 3" do+ it "adds nofollow to links for trust levels below 3" dopost.user.trust_level = 2post.saveexpect(post.cooked).to match(/noopener nofollow ugc/)@@ -1200,7 +1200,7 @@ RSpec.describe Post dobefore { Jobs.run_immediately! }describe "when user can not mention a group" do- it "should not create the mention with the notify class" do+ it "does not add the notify class to the mention" dopost = Fabricate(:post, raw: "hello @#{group.name}")post.trigger_post_processpost.reload@@ -1214,7 +1214,7 @@ RSpec.describe Post dodescribe "when user can mention a group" dobefore { group.add(post.user) }- it "should create the mention" do+ it "creates the mention" dopost.update!(raw: "hello @#{group.name}")post.trigger_post_processpost.reload@@ -1231,7 +1231,7 @@ RSpec.describe Post dogroup.add_owner(post.user)end- it "should create the mention" do+ it "creates the mention" dopost.update!(raw: "hello @#{group.name}")post.trigger_post_processpost.reload@@ -1343,7 +1343,7 @@ RSpec.describe Post doenddescribe "#rebake!" do- it "will rebake a post correctly" do+ it "rebakes a post correctly" dopost = create_postexpect(post.baked_at).not_to eq(nil)first_baked = post.baked_at@@ -1504,7 +1504,7 @@ RSpec.describe Post dofab!(:admin)fab!(:new_user, :user)- it "will change owner of a post correctly" do+ it "changes a post's owner correctly" dopost.set_owner(coding_horror, Discourse.system_user)post.reload@@ -1563,7 +1563,7 @@ RSpec.describe Post doenddescribe ".rebake_old" do- it "will catch posts it needs to rebake" do+ it "finds posts that need rebaking" dopost = create_postpost.update_columns(baked_at: Time.new(2000, 1, 1), baked_version: -1)Post.rebake_old(100)@@ -1577,7 +1577,7 @@ RSpec.describe Post doexpect(post.baked_at).to eq_time(baked)end- it "will rate limit globally" do+ it "rate-limits globally" dopost1 = create_postpost2 = create_postpost3 = create_post@@ -1602,7 +1602,7 @@ RSpec.describe Post doafter { Discourse.redis.flushdb }- it "should not run post validations" do+ it "does not run post validations" doPostValidator.any_instance.expects(:validate).neverexpect { post.hide!(PostActionType.types[:off_topic]) }.to change { post.reload.hidden }.from(@@ -1610,7 +1610,7 @@ RSpec.describe Post do).to(true)end- it "should inform the user when custom flag" do+ it "informs the user about a custom flag" docustom_flag = Fabricate(:flag, name: "custom flag")post.hide!(PostActionType.types[:custom_custom_flag])@@ -1623,13 +1623,13 @@ RSpec.describe Post docustom_flag.destroy!end- it "should decrease user_stat topic_count for first post" do+ it "decreases user_stat topic_count for the first post" doexpect do post.hide!(PostActionType.types[:off_topic]) end.to change {post.user.user_stat.reload.topic_count}.from(1).to(0)end- it "should decrease user_stat post_count" do+ it "decreases user_stat post_count" dopost_2 = Fabricate(:post, topic: post.topic, user: post.user)expect do post_2.hide!(PostActionType.types[:off_topic]) end.to change {@@ -1689,7 +1689,7 @@ RSpec.describe Post dobefore { SiteSetting.unique_posts_mins = 5 }- it "will unhide the first post & make the topic visible" do+ it "unhides the first post and makes the topic visible" dohidden_topic = Fabricate(:topic, visible: false)post = create_post(topic: hidden_topic)@@ -1710,7 +1710,7 @@ RSpec.describe Post doexpect(hidden_topic.visibility_reason_id).to eq(Topic.visibility_reasons[:op_unhidden])end- it "will not unhide the topic if the topic visibility_reason_id is not op_flag_threshold_reached" do+ it "does not unhide the topic for another visibility reason" dohidden_topic =Fabricate(:topic,@@ -1728,13 +1728,13 @@ RSpec.describe Post doexpect(hidden_topic.visible).to eq(false)end- it "should increase user_stat topic_count for first post" do+ it "increases user_stat topic_count for the first post" dopost.hide!(PostActionType.types[:off_topic])expect do post.unhide! end.to change { post.user.user_stat.reload.topic_count }.from(0).to(1)end- it "should decrease user_stat post_count" do+ it "decreases user_stat post_count" dopost_2 = Fabricate(:post, topic: post.topic, user: post.user)post_2.hide!(PostActionType.types[:off_topic])@@ -1826,7 +1826,7 @@ RSpec.describe Post doendend- it "will unhide the post but will keep the topic invisible/unlisted" do+ it "unhides the post but keeps the topic unlisted" dohidden_topic = Fabricate(:topic, visible: false)create_post(topic: hidden_topic)second_post = create_post(topic: hidden_topic)@@ -2141,7 +2141,7 @@ RSpec.describe Post doresultend- it "will update topic updated_at for all topic related events" do+ it "updates topic updated_at for all topic-related events" doSiteSetting.whispers_allowed_groups = "#{Group::AUTO_GROUPS[:staff]}"post =@@ -2160,7 +2160,7 @@ RSpec.describe Post doenddescribe "have_uploads" do- it "should find all posts with the upload" do+ it "finds all posts containing the upload" doids = []ids << Fabricate(:post,@@ -2326,7 +2326,7 @@ RSpec.describe Post doexpect(sha1s).to contain_exactly(sha1)end- it "should skip external urls with upload url in query string" do+ it "skips external URLs containing an upload URL in the query string" dosetup_s3urls = []@@ -2341,7 +2341,7 @@ RSpec.describe Post doexpect(urls).to be_emptyend- it "should skip external URLs following the `/uploads/short-url` pattern if a host is present and the host is not the configured host" do+ it "skips short upload URLs hosted outside the configured host" doupload = Fabricate(:upload)raw = <<~RAWdiff --git a/spec/models/private_message_topic_tracking_state_spec.rb b/spec/models/private_message_topic_tracking_state_spec.rbindex 5a7f5c7e577..0189eddabd1 100644--- a/spec/models/private_message_topic_tracking_state_spec.rb+++ b/spec/models/private_message_topic_tracking_state_spec.rb@@ -105,7 +105,7 @@ RSpec.describe PrivateMessageTopicTrackingState doenddescribe ".publish_new" do- it "should publish the right message_bus message" do+ it "publishes the expected MessageBus message" domessages = MessageBus.track_publish { described_class.publish_new(private_message) }expect(messages.map(&:channel)).to contain_exactly(described_class.user_channel(user_2.id))@@ -120,7 +120,7 @@ RSpec.describe PrivateMessageTopicTrackingState doexpect(data["payload"]["created_by_user_id"]).to eq(private_message.user_id)end- it "should publish the right message_bus message for a group message" do+ it "publishes the expected MessageBus message for a group message" domessages = MessageBus.track_publish { described_class.publish_new(group_message) }expect(messages.map(&:channel)).to contain_exactly(described_class.group_channel(group.id))@@ -137,7 +137,7 @@ RSpec.describe PrivateMessageTopicTrackingState doenddescribe ".publish_unread" do- it "should publish the right message_bus message" do+ it "publishes the expected MessageBus message" domessages =MessageBus.track_publish { described_class.publish_unread(private_message.first_post) }@@ -181,7 +181,7 @@ RSpec.describe PrivateMessageTopicTrackingState doenddescribe ".publish_group_archived" do- it "should publish the right message_bus message" do+ it "publishes the expected MessageBus message" douser_3 = Fabricate(:user)group.add(user_3)@@ -207,7 +207,7 @@ RSpec.describe PrivateMessageTopicTrackingState doenddescribe ".publish_read" do- it "should publish the right message_bus message" do+ it "publishes the expected MessageBus message" domessage =MessageBus.track_publish(described_class.user_channel(user.id)) dodiff --git a/spec/models/report_spec.rb b/spec/models/report_spec.rbindex 71fe1060e7a..64a16673a1b 100644--- a/spec/models/report_spec.rb+++ b/spec/models/report_spec.rb@@ -364,7 +364,7 @@ RSpec.describe Report dolet(:report) { Report.find("page_view_legacy_total_reqs") }context "with no data" do- it "works" do+ it "returns no legacy page-view requests" doexpect(report.data).to be_emptyendend@@ -407,7 +407,7 @@ RSpec.describe Report dolet(:report) { Report.find("page_view_total_reqs") }context "with no data" do- it "works" do+ it "returns no page-view requests" doexpect(report.data).to be_emptyendend@@ -1472,7 +1472,7 @@ RSpec.describe Report dolet(:user) { Fabricate(:user) }context "with data" do- it "it works" do+ it "returns each user's flagging ratio" dotopic = Fabricate(:topic, user: user)2.times dopost_disagreed = Fabricate(:post, topic: topic, user: user)@@ -1510,7 +1510,7 @@ RSpec.describe Report dolet(:robin) { Fabricate(:user, username: "robin") }context "with data" do- it "works" do+ it "returns suspicious logins in reverse chronological order" doSiteSetting.verbose_auth_token_logging = trueUserAuthToken.log(action: "suspicious", user_id: joffrey.id, created_at: 2.hours.ago)@@ -1533,7 +1533,7 @@ RSpec.describe Report dolet(:james) { Fabricate(:user, username: "james") }context "with data" do- it "works" do+ it "returns administrator login details" dofreeze_time_safeip = [81, 2, 69, 142]@@ -1600,7 +1600,7 @@ RSpec.describe Report do)end- it "works" do+ it "returns upload details" doexpect(report.data.length).to eq(2)expect_uploads_report_data_to_be_equal(report.data, khalil, khalil_upload)expect_uploads_report_data_to_be_equal(report.data, tarek, tarek_upload)@@ -1635,7 +1635,7 @@ RSpec.describe Report doFabricate(:ignored_user, user: tarek, ignored_user: matt)end- it "works" do+ it "returns ignored-user counts" doexpect(report.data.length).to eq(2)expect_ignored_users_report_data_to_be_equal(report.data, john, 1, 0)@@ -1648,7 +1648,7 @@ RSpec.describe Report doFabricate(:muted_user, user: tarek, muted_user: matt)end- it "works" do+ it "returns ignore and mute counts" doexpect(report.data.length).to eq(2)expect_ignored_users_report_data_to_be_equal(report.data, john, 1, 1)expect_ignored_users_report_data_to_be_equal(report.data, matt, 1, 1)@@ -1680,7 +1680,7 @@ RSpec.describe Report dolet(:reports) { Report.find("consolidated_page_views_browser_detection") }context "with no data" do- it "works" do+ it "returns empty browser-detection series" doreports.data.each { |report| expect(report[:data]).to be_empty }endend@@ -1699,7 +1699,7 @@ RSpec.describe Report doCachedCounting.disableend- it "works" do+ it "returns consolidated browser-detection data" do3.times { ApplicationRequest.increment!(:page_view_crawler) }8.times { ApplicationRequest.increment!(:page_view_logged_in) }6.times { ApplicationRequest.increment!(:page_view_logged_in_browser) }@@ -1792,7 +1792,7 @@ RSpec.describe Report dolet(:reports) { Report.find("site_traffic") }context "with no data" do- it "works" do+ it "returns empty site-traffic series" doreports.data.each { |report| expect(report[:data]).to be_empty }endend@@ -1902,7 +1902,7 @@ RSpec.describe Report dolet(:reports) { Report.find("consolidated_page_views") }context "with no data" do- it "works" do+ it "returns empty page-view series" doreports.data.each { |report| expect(report[:data]).to be_empty }endend@@ -1920,7 +1920,7 @@ RSpec.describe Report doCachedCounting.disableend- it "works" do+ it "returns consolidated page-view data" do3.times { ApplicationRequest.increment!(:page_view_crawler) }2.times { ApplicationRequest.increment!(:page_view_logged_in) }ApplicationRequest.increment!(:page_view_anon)@@ -1952,7 +1952,7 @@ RSpec.describe Report dolet(:reports) { Report.find("consolidated_api_requests") }context "with no data" do- it "works" do+ it "returns empty API-request series" doreports.data.each { |report| expect(report[:data]).to be_empty }endend@@ -1969,7 +1969,7 @@ RSpec.describe Report doCachedCounting.disableend- it "works" do+ it "returns consolidated API-request data" do2.times { ApplicationRequest.increment!(:api) }ApplicationRequest.increment!(:user_api)@@ -1996,7 +1996,7 @@ RSpec.describe Report dolet(:reports) { Report.find("trust_level_growth") }context "with no data" do- it "works" do+ it "returns empty trust-level series" doreports.data.each { |report| expect(report[:data]).to be_empty }endend@@ -2020,7 +2020,7 @@ RSpec.describe Report do)end- it "works" do+ it "returns trust-level growth data" dotl1_reached = reports.data.find { |r| r[:req] == "tl1_reached" }tl2_reached = reports.data.find { |r| r[:req] == "tl2_reached" }tl3_reached = reports.data.find { |r| r[:req] == "tl3_reached" }@@ -2108,7 +2108,7 @@ RSpec.describe Report dodescribe "top_uploads" docontext "with no data" do- it "works" do+ it "returns no uploads" doreport = Report.find("top_uploads")expect(report.data).to be_empty@@ -2119,7 +2119,7 @@ RSpec.describe Report dofab!(:jpg_upload) { Fabricate(:upload, extension: :jpg) }fab!(:png_upload) { Fabricate(:upload, extension: :png) }- it "works" do+ it "returns uploads grouped by extension" doreport = Report.find("top_uploads")expect(report.data.length).to eq(2)@@ -2322,7 +2322,7 @@ RSpec.describe Report do)end- it "works" do+ it "returns topic view statistics" doexpect(report.data.length).to eq(2)expect(report.data[0]).to include(topic_id: topic_2.id,diff --git a/spec/models/reviewable_flagged_post_spec.rb b/spec/models/reviewable_flagged_post_spec.rbindex 8cc428533f7..34151ee2f73 100644--- a/spec/models/reviewable_flagged_post_spec.rb+++ b/spec/models/reviewable_flagged_post_spec.rb@@ -125,7 +125,7 @@ RSpec.describe ReviewableFlaggedPost, type: :model doexpect(reviewable.actions_for(guardian).has?(:disagree_and_restore)).to eq(true)end- it "won't return the penalty options if the user is not regular" do+ it "omits penalty options for a non-regular user" dopost.user.update(moderator: true)expect(reviewable.actions_for(guardian).has?(:agree_and_silence)).to eq(false)expect(reviewable.actions_for(guardian).has?(:agree_and_suspend)).to eq(false)@@ -446,7 +446,7 @@ RSpec.describe ReviewableFlaggedPost, type: :model doexpect(pending_count).to eq(1)end- it "should reset counts when a topic is deleted" do+ it "resets counts when a topic is deleted" doPostActionCreator.off_topic(user, post)expect(pending_count).to eq(1)@@ -454,14 +454,14 @@ RSpec.describe ReviewableFlaggedPost, type: :model doexpect(pending_count).to eq(0)end- it "should not review non-human users" do+ it "does not review non-human users" dopost = create_post(user: Discourse.system_user)reviewable = PostActionCreator.off_topic(user, post).reviewableexpect(reviewable).to be_blankexpect(pending_count).to eq(0)end- it "should ignore handled flags" do+ it "ignores handled flags" dopost = create_postreviewable = PostActionCreator.off_topic(user, post).reviewableexpect(post.hidden).to eq(false)diff --git a/spec/models/reviewable_history_spec.rb b/spec/models/reviewable_history_spec.rbindex 3784dfb1923..6b3dc5b1d92 100644--- a/spec/models/reviewable_history_spec.rb+++ b/spec/models/reviewable_history_spec.rb@@ -34,7 +34,7 @@ RSpec.describe ReviewableHistory, type: :model doexpect(history[2].created_by).to eq(admin)end- it "won't log a transition to the same state" do+ it "does not log a transition to the current state" dop0 = Fabricate(:post)reviewable = PostActionCreator.spam(Fabricate(:user, refresh_auto_groups: true), p0).reviewableexpect(reviewable.reviewable_histories.size).to eq(1)diff --git a/spec/models/reviewable_queued_post_spec.rb b/spec/models/reviewable_queued_post_spec.rbindex 0b6dfcbe557..7134c50af4f 100644--- a/spec/models/reviewable_queued_post_spec.rb+++ b/spec/models/reviewable_queued_post_spec.rb@@ -231,7 +231,7 @@ RSpec.describe ReviewableQueuedPost, type: :model docontext "when the topic is nil in the case of a new topic being created" dolet(:reviewable) { Fabricate(:reviewable_queued_post_topic) }- it "works" do+ it "sends revision feedback for the rejected new topic" doargs = { revise_reason: "Duplicate", revise_feedback: "This is old news" }expect { reviewable.perform(moderator, :revise_and_reject_post, args) }.to change {Topic.where(archetype: Archetype.private_message).countdiff --git a/spec/models/reviewable_score_spec.rb b/spec/models/reviewable_score_spec.rbindex 28e97b05c1c..be5c994aaf0 100644--- a/spec/models/reviewable_score_spec.rb+++ b/spec/models/reviewable_score_spec.rb@@ -90,7 +90,7 @@ RSpec.describe ReviewableScore, type: :model dofab!(:user)let(:user_stat) { user.user_stat }- it "returns 0 for a user with no flags" do+ it "returns zero when there are no reviewed flags" doexpect(ReviewableScore.user_accuracy_bonus(user)).to eq(0.0)enddiff --git a/spec/models/reviewable_spec.rb b/spec/models/reviewable_spec.rbindex 615a4948823..003846e2bef 100644--- a/spec/models/reviewable_spec.rb+++ b/spec/models/reviewable_spec.rb@@ -42,7 +42,7 @@ RSpec.describe Reviewable, type: :model dofab!(:admin)fab!(:user)- it "will return a new reviewable the first them, and re-use the second time" do+ it "creates a reviewable on the first call and reuses it on the second" dor0 = ReviewableUser.needs_review!(target: user, created_by: admin)expect(r0).to be_present@@ -53,14 +53,14 @@ RSpec.describe Reviewable, type: :model doexpect(r1.pending?).to eq(true)end- it "will add a topic and category from a post" do+ it "adds the topic and category from the post" dopost = Fabricate(:post)reviewable = ReviewableFlaggedPost.needs_review!(target: post, created_by: Fabricate(:user))expect(reviewable.topic).to eq(post.topic)expect(reviewable.category).to eq(post.topic.category)end- it "will update the category if the topic category changes" do+ it "updates the category when the topic's category changes" dopost = Fabricate(:post)moderator = Fabricate(:moderator, refresh_auto_groups: true)reviewable = PostActionCreator.spam(moderator, post).reviewable@@ -96,7 +96,7 @@ RSpec.describe Reviewable, type: :model doexpect(r0.pending?).to eq(false)end- it "will create a new reviewable when an existing reviewable exists the same target with different type" do+ it "creates a new reviewable when the target has a reviewable of another type" dor0 = Fabricate(:reviewable_queued_post)r0.perform(admin, :approve_post)@@ -104,7 +104,7 @@ RSpec.describe Reviewable, type: :model doexpect(r1.pending?).to eq(true)end- it "will not resurrect an approved queued reviewable when reusing a flagged reviewable for the same target" do+ it "preserves an approved queued reviewable when reusing the target's flagged reviewable" dor0 = Fabricate(:reviewable_queued_post)r0.perform(admin, :approve_post)expect(r0.reload.status).to eq("approved")@@ -681,7 +681,7 @@ RSpec.describe Reviewable, type: :model doenddescribe ".score_required_to_hide_post" do- it "will return the default visibility if it's higher" do+ it "returns the default visibility when it is higher" dodescribed_class.set_priorities(low: 40.0, high: 100.0)SiteSetting.hide_post_sensitivity = described_class.sensitivities[:high]expect(described_class.score_required_to_hide_post).to eq(40.0)@@ -799,7 +799,7 @@ RSpec.describe Reviewable, type: :model doexpect(Reviewable.min_score_for_priority(:high)).to eq(123.45)end- it "will return the default priority if none supplied" do+ it "returns the default priority when none is supplied" doReviewable.set_priorities(medium: 12.3, high: 45.6)expect(Reviewable.min_score_for_priority).to eq(0.0)SiteSetting.reviewable_default_visibility = "medium"@@ -893,7 +893,7 @@ RSpec.describe Reviewable, type: :model doendcontext "when listing for a moderator with a custom filter that joins tables with same named columns" do- it "should not error" do+ it "handles joins with matching column names without error" dofirst_reviewable = Fabricate(:reviewable)second_reviewable = Fabricate(:reviewable)custom_filter = [diff --git a/spec/models/reviewable_user_spec.rb b/spec/models/reviewable_user_spec.rbindex cdb0e86caac..6f8ac09034e 100644--- a/spec/models/reviewable_user_spec.rb+++ b/spec/models/reviewable_user_spec.rb@@ -230,7 +230,7 @@ RSpec.describe ReviewableUser, type: :model doendcontext "when a user is deleted" do- it "should reject the reviewable" do+ it "rejects the reviewable" doSiteSetting.must_approve_users = trueJobs::CreateUserReviewable.new.execute(user_id: user.id)reviewable = Reviewable.find_by(target: user)@@ -459,7 +459,7 @@ RSpec.describe ReviewableUser, type: :model doenddescribe "changing must_approve_users" do- it "will approve any existing users" do+ it "approves existing users" douser = Fabricate(:user)expect(user).not_to be_approvedSiteSetting.must_approve_users = truediff --git a/spec/models/screened_ip_address_spec.rb b/spec/models/screened_ip_address_spec.rbindex 0dae714f128..4e66246b5b2 100644--- a/spec/models/screened_ip_address_spec.rb+++ b/spec/models/screened_ip_address_spec.rb@@ -116,7 +116,7 @@ RSpec.describe ScreenedIpAddress dodescribe "#watch" docontext "when ip_address is not being watched" do- it "should create a new record" do+ it "creates a new record" dorecord = described_class.watch(ip_address)expect(record).not_to be_new_recordexpect(record.action_type).to eq(described_class.actions[:block])@@ -142,7 +142,7 @@ RSpec.describe ScreenedIpAddress docontext "when ip_address is already being watched" doshared_examples "exact match of ip address" do- it "should not create a new record" do+ it "does not create a new record" doexpect { described_class.watch(ip_address_arg) }.to_not change { described_class.count }enddiff --git a/spec/models/search_log_spec.rb b/spec/models/search_log_spec.rbindex 35d965333af..939edc7f1ae 100644--- a/spec/models/search_log_spec.rb+++ b/spec/models/search_log_spec.rb@@ -187,7 +187,7 @@ RSpec.describe SearchLog, type: :model doendend- describe ".log" do+ describe ".log crawler detection" doit "flags an anonymous search from a known crawler user agent" do_status, id =SearchLog.log(@@ -364,7 +364,7 @@ RSpec.describe SearchLog, type: :model doenddescribe ".term_details" do- it "should only use the date for the period" do+ it "uses only the date for the period" dotime = Time.utc(2019, 5, 23, 18, 15, 30)freeze_time(time)@@ -511,7 +511,7 @@ RSpec.describe SearchLog, type: :model doenddescribe "clean_up" do- it "will remove old logs" do+ it "removes old logs" doSearchLog.log(term: "jawa", search_type: :header, ip_address: "127.0.0.1")SearchLog.log(term: "jedi", search_type: :header, ip_address: "127.0.0.1")SearchLog.log(term: "rey", search_type: :header, ip_address: "127.0.0.1")diff --git a/spec/models/site_setting_spec.rb b/spec/models/site_setting_spec.rbindex fbafd07bf5e..e66a20633b4 100644--- a/spec/models/site_setting_spec.rb+++ b/spec/models/site_setting_spec.rb@@ -247,7 +247,7 @@ RSpec.describe SiteSetting doenddescribe "cached settings" do- it "should recalculate cached setting when dependent settings are changed" do+ it "recalculates a cached setting when its dependencies change" doSiteSetting.blocked_attachment_filenames = "foo"expect(SiteSetting.blocked_attachment_filenames_regex).to eq(/foo/)diff --git a/spec/models/site_spec.rb b/spec/models/site_spec.rbindex a4a81576f4b..1bc6302d143 100644--- a/spec/models/site_spec.rb+++ b/spec/models/site_spec.rb@@ -122,7 +122,7 @@ RSpec.describe Site doexpect(Site.new(guardian).categories).not_to include(sub_category)end- it "should clear the cache when custom fields are updated" do+ it "clears the cache when custom fields change" doSite.preloaded_category_custom_fields << "enable_marketplace"categories = Site.new(Guardian.new).categoriesdiff --git a/spec/models/skipped_email_log_spec.rb b/spec/models/skipped_email_log_spec.rbindex a6fe6b55d59..5c9b692db3f 100644--- a/spec/models/skipped_email_log_spec.rb+++ b/spec/models/skipped_email_log_spec.rb@@ -14,7 +14,7 @@ RSpec.describe SkippedEmailLog, type: :model dodescribe "#reason_type" dodescribe "when reason_type is not valid" do- it "should not be valid" do+ it "is invalid" doskipped_email_log.reason_type = 999_999expect(skipped_email_log.valid?).to eq(false)@@ -26,7 +26,7 @@ RSpec.describe SkippedEmailLog, type: :model dodescribe "#custom_reason" dodescribe "when log is a custom reason type" dodescribe "when custom reason is blank" do- it "should not be valid" do+ it "is invalid" doexpect(custom_skipped_email_log.valid?).to eq(false)expect(custom_skipped_email_log.errors.messages).to include(:custom_reason)@@ -34,7 +34,7 @@ RSpec.describe SkippedEmailLog, type: :model doenddescribe "when custom reason is not blank" do- it "should be valid" do+ it "is valid" docustom_skipped_email_log.custom_reason = "test"expect(custom_skipped_email_log.valid?).to eq(true)@@ -44,13 +44,13 @@ RSpec.describe SkippedEmailLog, type: :model dodescribe "when log is not a custom reason type" dodescribe "when custom reason is blank" do- it "should be valid" do+ it "is valid" doexpect(skipped_email_log.valid?).to eq(true)endenddescribe "when custom reason is not blank" do- it "should not be valid" do+ it "is invalid" doskipped_email_log.custom_reason = "test"expect(skipped_email_log.valid?).to eq(false)@@ -63,7 +63,7 @@ RSpec.describe SkippedEmailLog, type: :model dodescribe ".reason_types" dodescribe "verify enum sequence" do- it "should return the right sequence" do+ it "returns the next sequence number" doexpect(SkippedEmailLog.reason_types[:custom]).to eq(1)expect(SkippedEmailLog.reason_types[:user_email_already_read]).to eq(15)end@@ -72,14 +72,14 @@ RSpec.describe SkippedEmailLog, type: :model dodescribe "#reason" dodescribe "for a custom log" do- it "should return the right output" do+ it "returns the serialized log entries" docustom_skipped_email_log.custom_reason = "test"expect(custom_skipped_email_log.reason).to eq("test")endenddescribe "for a non custom log" do- it "should return the right output" do+ it "returns an empty collection when no entries exist" doexpect(skipped_email_log.reason).to eq("#{I18n.t("skipped_email_log.exceeded_emails_limit")}diff --git a/spec/models/stylesheet_cache_spec.rb b/spec/models/stylesheet_cache_spec.rbindex 01046d2f5a9..05c5d10e14c 100644--- a/spec/models/stylesheet_cache_spec.rb+++ b/spec/models/stylesheet_cache_spec.rb@@ -23,7 +23,7 @@ RSpec.describe StylesheetCache doexpect(StylesheetCache.first.content).to eq "c"end- it "it retains stylesheets for competing targets" do+ it "retains stylesheets for competing targets" doStylesheetCache.destroy_allStylesheetCache.add("desktop", SecureRandom.hex, "body { }", "map", max_to_keep: 2)diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rbindex 774d1174480..6f354ff8f00 100644--- a/spec/models/tag_spec.rb+++ b/spec/models/tag_spec.rb@@ -13,7 +13,7 @@ RSpec.describe Tag doenddescribe "Associations" do- it "should delete associated sidebar_section_links when tag is destroyed" do+ it "deletes associated sidebar_section_links when the tag is destroyed" dotag_sidebar_section_link = Fabricate(:tag_sidebar_section_link)tag_sidebar_section_link_2 =Fabricate(:tag_sidebar_section_link, linkable: tag_sidebar_section_link.linkable)@@ -362,7 +362,7 @@ RSpec.describe Tag doenddescribe ".ensure_consistency!" do- it "should exclude private message topics" do+ it "excludes private-message topics" dotopicFabricate(:private_message_topic, tags: [tag])Tag.ensure_consistency!@@ -371,7 +371,7 @@ RSpec.describe Tag doexpect(tag.public_topic_count).to eq(1)end- it "should update Tag#topic_count and Tag#public_topic_count correctly" do+ it "updates Tag#topic_count and Tag#public_topic_count correctly" dotag = Fabricate(:tag, name: "tag1")tag2 = Fabricate(:tag, name: "tag2")tag3 = Fabricate(:tag, name: "tag3")diff --git a/spec/models/theme_setting_spec.rb b/spec/models/theme_setting_spec.rbindex 2f369a9f7f2..2506d48f50a 100644--- a/spec/models/theme_setting_spec.rb+++ b/spec/models/theme_setting_spec.rb@@ -82,7 +82,7 @@ RSpec.describe ThemeSetting doendcontext "for validations" do- it "should be invalid when json_value size is greater than the maximum allowed size" do+ it "rejects json_value exceeding the maximum size" dojson_value = { "key" => "value" }bytesize = json_value.to_json.bytesizediff --git a/spec/models/theme_spec.rb b/spec/models/theme_spec.rbindex b9963804d32..052e6437b57 100644--- a/spec/models/theme_spec.rb+++ b/spec/models/theme_spec.rb@@ -119,14 +119,14 @@ RSpec.describe Theme do)end- it "should correct bad html in body_tag_baked and head_tag_baked" do+ it "corrects malformed HTML in body_tag_baked and head_tag_baked" dotheme.set_field(target: :common, name: "head_tag", value: "<b>I am bold")theme.save!expect(Theme.lookup_field(theme.id, :desktop, "head_tag")).to eq("<b>I am bold</b>")end- it "should create body_tag_baked on demand if needed" do+ it "creates body_tag_baked on demand" dotheme.set_field(target: :common, name: :body_tag, value: "<b>test")theme.savediff --git a/spec/models/top_topic_spec.rb b/spec/models/top_topic_spec.rbindex b91d4520e20..73fa458aaf2 100644--- a/spec/models/top_topic_spec.rb+++ b/spec/models/top_topic_spec.rb@@ -26,7 +26,7 @@ RSpec.describe TopTopic docontext "after calculating" dobefore { TopTopic.refresh! }- it "should have top topics" do+ it "returns the top topics" doexpect(TopTopic.pluck(:topic_id)).to match_array([t1.id, t2.id])endend@@ -80,7 +80,7 @@ RSpec.describe TopTopic do# Note: all topics has 10 posts so we can skip "0 - ((10 - topics.posts_count) / 20) * #{period}_op_likes_count" calculation- it "should compute top score" do+ it "computes the top score" do# Default Formula: log(views_count) * {2} + op_likes_count * {0.5} + LEAST(likes_count / posts_count, {3}) + 10 + log(posts_count)## topic_1 => 0 + 14 + 3 + 10 + 0 => 27diff --git a/spec/models/topic_converter_spec.rb b/spec/models/topic_converter_spec.rbindex 660613b6749..d29d66a8cdc 100644--- a/spec/models/topic_converter_spec.rb+++ b/spec/models/topic_converter_spec.rb@@ -96,7 +96,7 @@ RSpec.describe TopicConverter docategory.update!(read_restricted: false)end- it "should convert private message into the right category" do+ it "moves the private message into the destination category" dotopic = TopicConverter.new(first_post.topic, admin).convert_to_public_topictopic.reload@@ -116,7 +116,7 @@ RSpec.describe TopicConverter doendcontext "when a custom category_id is given" do- it "should convert private message into the right category" do+ it "moves the private message into the destination category" dotopic = TopicConverter.new(first_post.topic, admin).convert_to_public_topic(category.id)expect(topic.reload.category).to eq(category)@@ -386,7 +386,7 @@ RSpec.describe TopicConverter docontext "when user already exists in topic_allowed_users table" dobefore { topic.topic_allowed_users.create!(user_id: admin.id) }- it "works" do+ it "converts the topic to a public topic" dotopic.convert_to_private_message(admin)expect(topic.reload.archetype).to eq("private_message")diff --git a/spec/models/topic_embed_spec.rb b/spec/models/topic_embed_spec.rbindex 42ee9d76652..d86562da841 100644--- a/spec/models/topic_embed_spec.rb+++ b/spec/models/topic_embed_spec.rb@@ -160,13 +160,13 @@ RSpec.describe TopicEmbed doexpect(post.reload.cook_method).to eq(Post.cook_methods[:regular])end- it "Should leave uppercase Feed Entry URL untouched in content" do+ it "leaves an uppercase feed entry URL untouched in content" docased_url = "http://eviltrout.com/ABCD"post = TopicEmbed.import(user, cased_url, title, "some random content")expect(post.cooked).to match(/#{cased_url}/)end- it "Should leave lowercase Feed Entry URL untouched in content" do+ it "leaves a lowercase feed entry URL untouched in content" docased_url = "http://eviltrout.com/abcd"post = TopicEmbed.import(user, cased_url, title, "some random content")expect(post.cooked).to match(/#{cased_url}/)@@ -331,7 +331,7 @@ RSpec.describe TopicEmbed doexpect(imported_post.topic.title).to eq("MODIFIED: #{title}")end- it "will revert to defaults if the modifier returns nil" do+ it "reverts to defaults when the modifier returns nil" doplugin = Plugin::Instance.newplugin.register_modifier(:topic_embed_import_create_args) { |args| nil }diff --git a/spec/models/topic_group_spec.rb b/spec/models/topic_group_spec.rbindex 68c3e52e019..03c133e25e8 100644--- a/spec/models/topic_group_spec.rb+++ b/spec/models/topic_group_spec.rb@@ -82,7 +82,7 @@ RSpec.describe TopicGroup doexpect(created_topic_group2.last_read_post_number).to eq topic2.highest_post_numberend- it "will not raise an error if a topic group already exists" do+ it "does not raise an error when a topic group already exists" doTopicGroup.create_topic_group(user, topic.id, 3, [])expect(TopicGroup.find_by(group: group, topic:).last_read_post_number).to eq(3)TopicGroup.create_topic_group(user, topic.id, 10, [])diff --git a/spec/models/topic_link_spec.rb b/spec/models/topic_link_spec.rbindex 8d6ae783ff6..fe0f0cd0535 100644--- a/spec/models/topic_link_spec.rb+++ b/spec/models/topic_link_spec.rb@@ -129,7 +129,7 @@ RSpec.describe TopicLink dolet(:post) { Fabricate(:post, topic: other_topic, user: user, raw: "some content") }- it "works" do+ it "preserves internal topic links and reflections across repeated extraction" do# ensure other_topic has a postpost@@ -413,7 +413,7 @@ RSpec.describe TopicLink doenddescribe "internal link from pm" do- it "works" do+ it "records the PM's outgoing link without adding a public backlink" dopm = Fabricate(:topic, user: user, category_id: nil, archetype: "private_message")Fabricate(:post, topic: pm, user: user, raw: "some content")@@ -430,7 +430,7 @@ RSpec.describe TopicLink doenddescribe "internal link from unlisted topic" do- it "works" do+ it "records the unlisted topic's outgoing link without adding a public backlink" dounlisted_topic = Fabricate(:topic, user: user, visible: false)url = "http://#{test_uri.host}/t/topic-slug/#{topic.id}"@@ -582,7 +582,7 @@ RSpec.describe TopicLink doexpect(array[1].clicks).to eq(1)end- it "secures internal links correctly" do+ it "hides restricted internal links from users without category access" docategory = Fabricate(:category)secret_topic = Fabricate(:topic, category: category)@@ -614,7 +614,7 @@ RSpec.describe TopicLink doexpect(TopicLink.topic_map(Guardian.new, post.topic_id).count).to eq(0)end- it "secures internal links correctly" do+ it "excludes links to topics muted by the user" doother_topic = Fabricate(:topic)other_user = Fabricate(:user)@@ -642,7 +642,7 @@ RSpec.describe TopicLink doFabricate(:post, user: user, raw: "Check out this topic #{post.topic.url}/122131")end- it "should return the right response" do+ it "returns metadata for the duplicate internal link" doTopicLink.extract_from(post_with_internal_link)result = TopicLink.duplicate_lookup(post_with_internal_link.topic)diff --git a/spec/models/topic_list_spec.rb b/spec/models/topic_list_spec.rbindex f7f533c2fde..5092b7a01c4 100644--- a/spec/models/topic_list_spec.rb+++ b/spec/models/topic_list_spec.rb@@ -15,7 +15,7 @@ RSpec.describe TopicList doafter { TopicList.preloaded_custom_fields.clear }describe ".preloaded_custom_fields" do- it "should return a unique set of values" do+ it "returns unique values" doTopicList.preloaded_custom_fields << "test"TopicList.preloaded_custom_fields << "test"TopicList.preloaded_custom_fields << "apple"@@ -69,7 +69,7 @@ RSpec.describe TopicList doenddescribe "#top_tags" do- it "should return the right tags" do+ it "returns the topic tags" dotag = Fabricate(:tag, topics: [topic])other_tag = Fabricate(:tag, topics: [topic], name: "use-anywhere")expect(topic_list.top_tags).to eq(@@ -96,7 +96,7 @@ RSpec.describe TopicList do)end- it "should return tags used in the category" do+ it "returns tags used in the category" doexpect(topic_list.top_tags).to eq([{ id: tag.id, name: tag.name, slug: tag.slug },diff --git a/spec/models/topic_spec.rb b/spec/models/topic_spec.rbindex c853ef70bd9..875fa8935cd 100644--- a/spec/models/topic_spec.rb+++ b/spec/models/topic_spec.rb@@ -21,14 +21,14 @@ RSpec.describe Topic dodescribe "#featured_link" dodescribe "when featured_link contains more than a URL" do- it "should not be valid" do+ it "rejects an invalid featured link" dotopic.featured_link = "http://meta.discourse.org TEST"expect(topic).to_not be_validendenddescribe "when featured_link is a valid URL" do- it "should be valid" do+ it "accepts a valid featured link" dotopic.featured_link = "http://meta.discourse.org"expect(topic).to be_validend@@ -37,28 +37,28 @@ RSpec.describe Topic dodescribe "#external_id" dodescribe "when external_id is too long" do- it "should not be valid" do+ it "rejects an external ID exceeding the length limit" dotopic.external_id = "a" * (Topic::EXTERNAL_ID_MAX_LENGTH + 1)expect(topic).to_not be_validendenddescribe "when external_id has invalid characters" do- it "should not be valid" do+ it "rejects unsupported characters in the external ID" dotopic.external_id = "a*&^!@()#"expect(topic).to_not be_validendenddescribe "when external_id is an empty string" do- it "should not be valid" do+ it "rejects an empty external ID" dotopic.external_id = ""expect(topic).to_not be_validendenddescribe "when external_id has already been used" do- it "should not be valid" do+ it "rejects a duplicate external ID" dotopic2 = Fabricate(:topic, external_id: "asdf")topic.external_id = "asdf"expect(topic).to_not be_valid@@ -66,14 +66,14 @@ RSpec.describe Topic doenddescribe "when external_id is nil" do- it "should be valid" do+ it "accepts a nil external ID" dotopic.external_id = nilexpect(topic).to be_validendenddescribe "when external_id is valid" do- it "should be valid" do+ it "accepts alphanumeric external IDs with underscores and hyphens" dotopic.external_id = "abc_123-ZXY"expect(topic).to be_validend@@ -89,7 +89,7 @@ RSpec.describe Topic dodescribe "when title contains censored words" doafter { WordWatcher.clear_cache! }- it "should not be valid" do+ it "rejects titles containing censored words" do%w[pineapple pen].each do |w|Fabricate(:watched_word, word: w, action: WatchedWord.actions[:censor])end@@ -105,7 +105,7 @@ RSpec.describe Topic doenddescribe "titles with censored words not on boundaries" do- it "should be valid" do+ it "accepts titles with censored words embedded in other words" doFabricate(:watched_word, word: "apple", action: WatchedWord.actions[:censor])topic.title = "Pineapples are great fruit! Applebee's is a great restaurant"expect(topic).to be_valid@@ -113,7 +113,7 @@ RSpec.describe Topic doenddescribe "when title does not contain censored words" do- it "should be valid" do+ it "accepts titles without censored words" dotopic.title = "The cake is a lie"expect(topic).to be_valid@@ -127,7 +127,7 @@ RSpec.describe Topic doendend- it "should not be valid" do+ it "rejects titles matching censored word patterns" dotopic.title = "I have a co(onut a**le"expect(topic.valid?).to eq(false)@@ -143,7 +143,7 @@ RSpec.describe Topic dodescribe "when title contains watched words" doafter { WordWatcher.clear_cache! }- it "should not be valid" do+ it "rejects titles containing blocked words" doFabricate(:watched_word, word: "pineapple", action: WatchedWord.actions[:block])topic.title = "pen PinEapple apple pen is a complete sentence"@@ -411,15 +411,15 @@ RSpec.describe Topic dobefore { SiteSetting.duplicate_topic_titles = "disallowed" }- it "won't allow another topic to be created with the same name" do+ it "rejects another topic with the same title" doexpect(new_topic).not_to be_validend- it "won't even allow another topic to be created with the same name but different category" do+ it "rejects the same title in another category" doexpect(new_topic_different_cat).not_to be_validend- it "won't allow another topic with an upper case title to be created" do+ it "rejects duplicate titles regardless of case" donew_topic.title = new_topic.title.upcaseexpect(new_topic).not_to be_validend@@ -451,7 +451,7 @@ RSpec.describe Topic doexpect(attempt).to be_validend- it "won't allow the title when the author is a member of the restricted group" do+ it "rejects the title when the author belongs to the restricted group" dogroup_member = Fabricate(:user)group.add(group_member)attempt =@@ -464,19 +464,19 @@ RSpec.describe Topic doexpect(attempt).not_to be_validend- it "won't allow the title when the author is an admin" do+ it "rejects the title when the author is an admin" doattempt =Fabricate.build(:topic, title: secure_topic.title, category: category1, user: admin)expect(attempt).not_to be_validend- it "won't allow a topic to be moved into the restricted category holding the duplicate" do+ it "rejects moving the topic into the restricted category containing the duplicate" dopublic_topic = Fabricate(:topic, title: secure_topic.title, category: category1)public_topic.category_id = secure_category.idexpect(public_topic).not_to be_validend- it "won't allow the title when the acting user can see the duplicate but the author can't" do+ it "rejects the title when only the acting user can see the duplicate" dotopic.acting_user = admintopic.title = secure_topic.titleexpect(topic).not_to be_valid@@ -498,13 +498,13 @@ RSpec.describe Topic doexpect(attempt).to be_validend- it "won't allow the title when the author can see unlisted topics" do+ it "rejects the title when the author can see unlisted topics" doattempt =Fabricate.build(:topic, title: unlisted_topic.title, category: category1, user: admin)expect(attempt).not_to be_validend- it "won't allow the title in the same category even when the author can't see unlisted topics" do+ it "rejects the title in the same category even when the author cannot see unlisted topics" doattempt = Fabricate.build(:topic, title: unlisted_topic.title, category: category2)expect(attempt).not_to be_validend@@ -514,7 +514,7 @@ RSpec.describe Topic docontext "when duplicate_topic_titles is allowed" dobefore { SiteSetting.duplicate_topic_titles = "allowed" }- it "will allow another topic to be created with the same name" do+ it "allows another topic with the same title" doexpect(new_topic).to be_validendend@@ -522,11 +522,11 @@ RSpec.describe Topic docontext "when duplicate_topic_titles is allowed_across_categories" dobefore { SiteSetting.duplicate_topic_titles = "allowed_across_categories" }- it "will allow another topic to be created with the same name but different category" do+ it "allows the same title in another category" doexpect(new_topic_different_cat).to be_validend- it "won't allow another topic to be created with the same name in same category" do+ it "rejects the same title in the same category" doexpect(new_topic).not_to be_validendend@@ -670,7 +670,7 @@ RSpec.describe Topic doafter { Discourse.disable_readonly_mode }- it "should not attempt to update `fancy_title`" do+ it "does not attempt to update fancy_title" dotopic.save!expect(topic.fancy_title).to eq("“this topic” – has “fancy stuff”",@@ -916,7 +916,7 @@ RSpec.describe Topic do).to be_blankend- it "should return the cat since the user can see it" do+ it "returns the category visible to the user" dogroup.add(user)expect(@@ -1026,7 +1026,7 @@ RSpec.describe Topic doenddescribe "when username_or_email is not valid" do- it "should return the right value" do+ it "returns nil without adding an allowed user" doexpect do expect(topic.invite(user, "somerandomstring")).to eq(nil) end.to_not change {topic.allowed_users}@@ -1034,7 +1034,7 @@ RSpec.describe Topic doenddescribe "when user is already allowed" do- it "should raise the right error" do+ it "raises UserExists when the user is already allowed" dotopic.allowed_users << user1expect { topic.invite(user, user1.username) }.to raise_error(Topic::UserExists)@@ -1046,7 +1046,7 @@ RSpec.describe Topic dofab!(:topic) { Fabricate(:private_message_topic, user: trust_level_2) }describe "by username" do- it "should be able to invite a user" do+ it "invites a user to the PM" doexpect(topic.invite(user, user1.username)).to eq(true)expect(topic.allowed_users).to include(user1)expect(Post.last.action_code).to eq("invited_user")@@ -1062,7 +1062,7 @@ RSpec.describe Topic doexpect(Post.last.action_code).to eq("removed_user")end- it "should not create a small action if user is already invited through a group" do+ it "omits a small action when the user already has access through a group" dogroup = Fabricate(:group, users: [user, user1])expect(topic.invite_group(user, group)).to eq(true)@@ -1104,7 +1104,7 @@ RSpec.describe Topic doSiteSetting.personal_message_enabled_groups = Group::AUTO_GROUPS[:trust_level_4]end- it "should raise error" do+ it "raises UserExists when PM access is restricted" doexpect { topic.invite(user, user1.username) }.to raise_error(Topic::UserExists)endend@@ -1128,19 +1128,19 @@ RSpec.describe Topic doexpect(topic.invite(user, user1.username)).to eq(true)end- it "should raise error when inviter not in allowed list" do+ it "rejects an inviter outside the recipient's allowed list" doAllowedPmUser.create!(user: user1, allowed_pm_user: user2)expect { topic.invite(user, user1.username) }.to raise_error(Topic::NotAllowed,).with_message(I18n.t("topic_invite.receiver_does_not_allow_pm"))end- it "should succeed for staff even when not allowed" do+ it "allows inviting staff outside the allowed list" doAllowedPmUser.create!(user: user1, allowed_pm_user: user2)expect(topic.invite(user1, admin.username)).to eq(true)end- it "should raise error when target_user is not in inviters allowed list" do+ it "rejects a recipient outside the inviter's allowed list" douser.user_option.update!(enable_allowed_pm_users: true)AllowedPmUser.create!(user: user1, allowed_pm_user: user)expect { topic.invite(user, user1.username) }.to raise_error(@@ -1156,7 +1156,7 @@ RSpec.describe Topic doenddescribe "by email" do- it "should be able to invite a user" do+ it "invites an existing user by email" doexpect(topic.invite(user, user1.email)).to eq(true)expect(topic.allowed_users).to include(user1)@@ -1166,7 +1166,7 @@ RSpec.describe Topic doenddescribe "when user is not found" do- it "should create the right invite" do+ it "creates an email invitation" doexpect(topic.invite(user, "[email protected]")).to eq(true)invite = Invite.last@@ -1178,7 +1178,7 @@ RSpec.describe Topic dodescribe "when user does not have sufficient trust level" dobefore { user.change_trust_level!(TrustLevel[1]) }- it "should not create an invite" do+ it "does not create an invitation" doexpect do expect(topic.invite(user, "[email protected]")).to eq(nil) end.to_not change {Invite.count}@@ -1204,14 +1204,14 @@ RSpec.describe Topic doenddescribe "by username" do- it "should invite user into a topic" do+ it "invites and notifies the user by username" dotopic.invite(user, user1.username)expect_the_right_notification_to_be_created(user, user1)endenddescribe "by email" do- it "should be able to invite a user" do+ it "invites and notifies the user by email" doexpect(topic.invite(user, user1.email)).to eq(true)expect_the_right_notification_to_be_created(user, user1)end@@ -1229,7 +1229,7 @@ RSpec.describe Topic dofab!(:invitee, :user)describe "as a group owner" do- it "should be able to invite a user" do+ it "invites the user with group membership" doexpect doexpect(topic.invite(inviter, invitee.email, [group.id])).to eq(true)end.to change { Notification.count } & change { GroupHistory.count }@@ -1245,7 +1245,7 @@ RSpec.describe Topic doenddescribe "when group ids are not given" do- it "should not invite the user" do+ it "does not invite the user" doexpect doexpect(topic.invite(inviter, invitee.email)).to eq(false)end.to_not change { Notification.count }@@ -1254,7 +1254,7 @@ RSpec.describe Topic doenddescribe "as a normal user" do- it "should not be able to invite a user" do+ it "rejects the invitation from an unauthorized user" doexpect doexpect(topic.invite(Fabricate(:user), invitee.email, [group.id])).to eq(false)end.to_not change { Notification.count }@@ -1282,7 +1282,7 @@ RSpec.describe Topic dodescribe "when user can invite via email" dobefore { user.change_trust_level!(TrustLevel[2]) }- it "should create an invite" do+ it "creates an email invitation" doJobs.run_immediately!expect(topic.invite(user, "[email protected]")).to eq(true)@@ -1312,7 +1312,7 @@ RSpec.describe Topic do.topicend- it "should integrate correctly" do+ it "limits PM visibility to its participants" doexpect(Guardian.new(topic.user).can_see?(topic)).to eq(true)expect(Guardian.new.can_see?(topic)).to eq(false)expect(Guardian.new(evil_trout).can_see?(topic)).to eq(false)@@ -1464,7 +1464,7 @@ RSpec.describe Topic doendcontext "with user actions" do- it "should set up actions correctly" do+ it "records sent and received private message actions" doUserActionManager.enablepost = create_post(archetype: "private_message", target_usernames: [user.username])@@ -1553,7 +1553,7 @@ RSpec.describe Topic docontext "when moderator post fails to be created" dobefore { user.update_column(:silenced_till, 1.year.from_now) }- it "should not increment moderator_posts_count" do+ it "does not increment moderator_posts_count" doexpect(topic.moderator_posts_count).to eq(0)topic.add_moderator_post(user, "winter is never coming")@@ -1576,7 +1576,7 @@ RSpec.describe Topic dolet(:category) { Fabricate(:category_with_definition) }context "when disabled" do- it "should not be visible and have correct counts" do+ it "unlists the topic and updates its counts" dotopic.update_status("visible", false, user)topic.reloadexpect(topic).not_to be_visible@@ -1614,7 +1614,7 @@ RSpec.describe Topic dotopic.reloadend- it "should be visible with correct counts" do+ it "lists the topic and updates its counts" dotopic.update_status("visible", true, user)expect(topic).to be_visible@@ -1659,7 +1659,7 @@ RSpec.describe Topic dotopic.reloadend- it "should enable correctly" do+ it "pins the topic without changing bumped_at" doexpect(topic.pinned_at).to be_presentexpect(topic.bumped_at).to eq_time(original_bumped_at)expect(topic.moderator_posts_count).to eq(1)@@ -1668,7 +1668,7 @@ RSpec.describe Topic doendcontext "with archived" do- it "should create a staff action log entry" do+ it "logs the topic archive action" doexpect { topic.update_status("archived", true, user) }.to change {UserHistory.where(action: UserHistory.actions[:topic_archived]).count}.by(1)@@ -1683,7 +1683,7 @@ RSpec.describe Topic doarchived_topic.reloadend- it "should archive correctly" do+ it "unarchives the topic without changing bumped_at" doexpect(archived_topic).not_to be_archivedexpect(archived_topic.bumped_at).to eq_time(original_bumped_at)expect(archived_topic.moderator_posts_count).to eq(1)@@ -1697,7 +1697,7 @@ RSpec.describe Topic dotopic.reloadend- it "should be archived" do+ it "archives the topic and records a moderator post" doexpect(topic).to be_archivedexpect(topic.moderator_posts_count).to eq(1)expect(topic.bumped_at).to eq_time(original_bumped_at)@@ -1715,7 +1715,7 @@ RSpec.describe Topic doclosed_topic.reloadend- it "should not be pinned" do+ it "opens the topic and records a moderator post" doexpect(closed_topic).not_to be_closedexpect(closed_topic.moderator_posts_count).to eq(1)expect(closed_topic.bumped_at).not_to eq_time(original_bumped_at)@@ -1729,7 +1729,7 @@ RSpec.describe Topic dotopic.reloadend- it "should be closed" do+ it "closes the topic without changing bumped_at" doexpect(topic).to be_closedexpect(topic.bumped_at).to eq_time(original_bumped_at)expect(topic.moderator_posts_count).to eq(1)@@ -1743,7 +1743,7 @@ RSpec.describe Topic doit_behaves_like "a status that closes a topic"- it "should archive group message" do+ it "archives the group message" dogroup.add(user)topic = Fabricate(:private_message_topic, allowed_groups: [group])@@ -1753,7 +1753,7 @@ RSpec.describe Topic do).by(1)end- it "should create a staff action log entry" do+ it "logs the topic close action" doexpect { topic.update_status(status, true, user) }.to change {UserHistory.where(action: UserHistory.actions[:topic_closed]).count}.by(1)@@ -1901,14 +1901,14 @@ RSpec.describe Topic dodescribe "with category" dofab!(:category, :category_with_definition)- it "should not increase the topic_count with no category" do+ it "does not increase a category's topic count for an uncategorized topic" doexpect {Fabricate(:topic, user: category.user)category.reload}.not_to change(category, :topic_count)end- it "should increase the category's topic_count" do+ it "increases the category's topic count" doexpect {Fabricate(:topic, user: category.user, category_id: category.id)category.reload@@ -1951,7 +1951,7 @@ RSpec.describe Topic doexpect(category.topic_count).to eq(1)end- it "should not change the topic_count when not changed" do+ it "preserves topic counts when the category is unchanged" doexpect {topic.change_category_to_id(topic.category.id)category.reload@@ -2006,7 +2006,7 @@ RSpec.describe Topic doFabricate(:category_with_definition, user: user, name: "2nd category")end- it "should work" do+ it "moves the topic and updates both category counts" dotopic.change_category_to_id(new_category.id)expect(topic.reload.category).to eq(new_category)@@ -2044,7 +2044,7 @@ RSpec.describe Topic do)end- it "should generate the notification for the topic" do+ it "generates the topic notification" doexpect do topic.change_category_to_id(new_category.id) end.to change {Notification.count}.by(2)@@ -2068,7 +2068,7 @@ RSpec.describe Topic do).to eq(true)end- it "should not generate a notification if SiteSetting.disable_category_edit_notifications is enabled" do+ it "omits the notification when category edit notifications are disabled" doSiteSetting.disable_category_edit_notifications = trueexpect do topic.change_category_to_id(new_category.id) end.not_to change {@@ -2078,7 +2078,7 @@ RSpec.describe Topic doexpect(topic.category_id).to eq(new_category.id)end- it "should not generate a notification if options: silent is true" do+ it "omits the notification when silent is true" doexpect do topic.change_category_to_id(new_category.id, silent: true) end.not_to change {Notification.count}@@ -2086,7 +2086,7 @@ RSpec.describe Topic doexpect(topic.category_id).to eq(new_category.id)end- it "should generate the modified notification for the topic if already seen" do+ it "generates the modified notification when the topic was already seen" doTopicUser.create!(topic_id: topic.id,last_read_post_number: topic.posts.first.post_number,@@ -2116,7 +2116,7 @@ RSpec.describe Topic do).to eq(true)end- it "should not generate a notification for unlisted topic" do+ it "omits notifications for unlisted topics" dotopic.update_column(:visible, false)expect do topic.change_category_to_id(new_category.id) end.not_to change {@@ -2132,7 +2132,7 @@ RSpec.describe Topic dotopic.user.update!(admin: true)end- it "should set a topic timer" do+ it "sets a topic timer" donow = Time.zone.nowexpect { topic.change_category_to_id(new_category.id) }.to change {@@ -2151,7 +2151,7 @@ RSpec.describe Topic dodescribe "when topic is already closed" dobefore { topic.update_status("closed", true, Discourse.system_user) }- it "should not set a topic timer" do+ it "does not set a topic timer" doexpect { topic.change_category_to_id(new_category.id) }.not_to change {TopicTimer.with_deleted.count}@@ -2164,7 +2164,7 @@ RSpec.describe Topic dodescribe "when topic has an existing topic timer" dolet(:topic_timer) { Fabricate(:topic_timer, topic: topic) }- it "should not inherit category's auto close hours" do+ it "does not inherit the category's auto close hours" dotopic_timertopic.change_category_to_id(new_category.id)@@ -2463,7 +2463,7 @@ RSpec.describe Topic doexpect(closing_topic.reload.public_topic_timer.execute_at).to eq_time(2.days.from_now)end- it "should not delete topic_timer of another status_type" do+ it "preserves topic timers with another status type" dofreeze_timeclosing_topic.set_or_create_timer(TopicTimer.types[:open], nil)topic_timer = closing_topic.public_topic_timer@@ -2472,7 +2472,7 @@ RSpec.describe Topic doexpect(topic_timer.status_type).to eq(TopicTimer.types[:close])end- it "should allow status_type to be updated" do+ it "allows updating the status type" dofreeze_timetopic_timer =@@ -2509,7 +2509,7 @@ RSpec.describe Topic dolet(:category) { Fabricate(:category_with_definition, auto_close_hours: 4) }let(:topic) { Fabricate(:topic, category: category) }- it "should be able to override category's default auto close" do+ it "overrides the category's default auto close" dofreeze_timeJobs.run_immediately!@@ -2754,7 +2754,7 @@ RSpec.describe Topic doenddescribe ".secured" do- it "should return the right topics" do+ it "returns only topics visible to the guardian" docategory = Fabricate(:category_with_definition, read_restricted: true)topic = Fabricate(:topic, category: category, created_at: 1.day.ago)group.add(user)@@ -3186,14 +3186,14 @@ RSpec.describe Topic dobefore { SiteSetting.minimum_topics_similar = 20 }context "when Topic count is greater than minimum_topics_similar" do- it "should be true" do+ it "returns true when the topic count exceeds the minimum" doTopic.stubs(:count).returns(30)expect(Topic.count_exceeds_minimum?).to be_truthyendendcontext "when topic's count is less than minimum_topics_similar" do- it "should be false" do+ it "returns false when the topic count is below the minimum" doTopic.stubs(:count).returns(10)expect(Topic.count_exceeds_minimum?).to_not be_truthyend@@ -3275,7 +3275,7 @@ RSpec.describe Topic doexpect(topic.message_archived?(user)).to eq(false)end- it "will trigger :topic_status_updated" do+ it "triggers topic_status_updated" dotopic = Fabricate(:topic)user = topic.useruser.admin = true@@ -3382,18 +3382,18 @@ RSpec.describe Topic doenddescribe "#time_to_first_response" do- it "should have no results if no topics in range" do+ it "returns no results when no topics fall within the range" doexpect(Topic.time_to_first_response_per_day(5.days.ago, Time.zone.now).count).to eq(0)end- it "should have no results if there is only a topic with no replies" do+ it "returns no results for topics without replies" dotopic = Fabricate(:topic, created_at: 1.hour.ago)Fabricate(:post, topic: topic, user: topic.user, post_number: 1)expect(Topic.time_to_first_response_per_day(5.days.ago, Time.zone.now).count).to eq(0)expect(Topic.time_to_first_response_total).to eq(0)end- it "should have no results if reply is from first poster" do+ it "ignores replies from the original poster" dotopic = Fabricate(:topic, created_at: 1.hour.ago)Fabricate(:post, topic: topic, user: topic.user, post_number: 1)Fabricate(:post, topic: topic, user: topic.user, post_number: 2)@@ -3401,7 +3401,7 @@ RSpec.describe Topic doexpect(Topic.time_to_first_response_total).to eq(0)end- it "should have results if there's a topic with replies" do+ it "measures the time to the first reply" dotopic = Fabricate(:topic, created_at: 3.hours.ago)Fabricate(:post, topic: topic, user: topic.user, post_number: 1, created_at: 3.hours.ago)Fabricate(:post, topic: topic, post_number: 2, created_at: 2.hours.ago)@@ -3411,7 +3411,7 @@ RSpec.describe Topic doexpect(Topic.time_to_first_response_total).to eq(1)end- it "should have results if there's a topic with replies" do+ it "includes replies in nested subcategories" doSiteSetting.max_category_nesting = 3category = Fabricate(:category_with_definition)@@ -3427,7 +3427,7 @@ RSpec.describe Topic do).to eq(1)end- it "should only count regular posts as the first response" do+ it "counts only regular posts as the first response" dotopic = Fabricate(:topic, created_at: 5.hours.ago)Fabricate(:post, topic: topic, user: topic.user, post_number: 1, created_at: 5.hours.ago)Fabricate(@@ -3548,13 +3548,13 @@ RSpec.describe Topic doenddescribe "when PM is between a human and a non human user" do- it "should return true" do+ it "recognizes a PM between a human and a bot" doexpect(topic.pm_with_non_human_user?).to be(true)endenddescribe "when PM contains 2 human users and a non human user" do- it "should return false" do+ it "returns false when the PM contains multiple humans" doFabricate(:topic_allowed_user, topic: topic, user: Fabricate(:user))expect(topic.pm_with_non_human_user?).to be(false)@@ -3562,7 +3562,7 @@ RSpec.describe Topic doenddescribe "when PM only contains a user" do- it "should return true" do+ it "returns true when only one user remains" dotopic.topic_allowed_users.first.destroy!expect(topic.reload.pm_with_non_human_user?).to be(true)@@ -3570,7 +3570,7 @@ RSpec.describe Topic doenddescribe "when PM contains a group" do- it "should return false" do+ it "returns false when the PM includes a group" doFabricate(:topic_allowed_group, topic: topic)expect(topic.pm_with_non_human_user?).to be(false)@@ -3578,7 +3578,7 @@ RSpec.describe Topic doenddescribe "when topic is not a PM" do- it "should return false" do+ it "returns false for a public topic" dotopic.convert_to_public_topic(Fabricate(:admin))expect(topic.pm_with_non_human_user?).to be(false)@@ -3601,7 +3601,7 @@ RSpec.describe Topic doenddescribe "removing oneself" do- it "should remove oneself" do+ it "allows the user to remove themselves" dotopic.allowed_users << user1expect(topic.remove_allowed_user(user1, user1)).to eq(true)@@ -3614,7 +3614,7 @@ RSpec.describe Topic doexpect(post.action_code).to eq("user_left")end- it "should show a small action when user removes themselves from pm" do+ it "records a small action when the user leaves the PM" doexpect do private_topic.remove_allowed_user(user1, user1) end.to change {private_topic.posts.where(action_code: "user_left").count}.by(1)@@ -3721,7 +3721,7 @@ RSpec.describe Topic dohttps://meta.discourse.org/?filter=testhttps://meta.discourse.org/t/中國/1].each do |featured_link|- it "should extract the root domain from #{featured_link} correctly" do+ it "extracts the root domain from #{featured_link}" dotopic.featured_link = featured_linkexpect(topic.featured_link_root_domain).to eq("discourse.org")end@@ -4095,7 +4095,7 @@ RSpec.describe Topic dofab!(:post2) { Fabricate(:post, topic: topic, user: user2) }fab!(:like1) { Fabricate(:like, post: post1, user: user2) }- it "it is triggered when a post publishes a message of type :liked or :unliked" do+ it "is triggered when a post publishes a liked or unliked message" do%i[liked unliked].each do |action|messages =MessageBus.track_publish("/topic/#{topic.id}") do@@ -4108,7 +4108,7 @@ RSpec.describe Topic doendend- it "it is triggered when a post publishes a message of type :created, :destroyed, :deleted, :recovered" do+ it "is triggered when a post publishes a created, destroyed, deleted, or recovered message" dofreeze_time Date.today%i[created destroyed deleted recovered].each do |action|@@ -4127,7 +4127,7 @@ RSpec.describe Topic doendend- it "it is not triggered when a post publishes an unhandled kind of message" do+ it "is not triggered when a post publishes an unhandled message type" do%i[unhandled unknown dont_care].each do |action|messages =MessageBus.track_publish("/topic/#{topic.id}") dodiff --git a/spec/models/topic_tag_spec.rb b/spec/models/topic_tag_spec.rbindex 803c839eae7..982ba9d8423 100644--- a/spec/models/topic_tag_spec.rb+++ b/spec/models/topic_tag_spec.rb@@ -9,13 +9,13 @@ RSpec.describe TopicTag dolet(:topic_tag) { Fabricate(:topic_tag, topic: topic, tag: tag) }describe "#after_create" do- it "should increase Tag#staff_topic_count and Tag#public_topic_count for a regular topic in a public category" do+ it "increases staff and public tag counts for a topic in a public category" doexpect { topic_tag }.to change { tag.reload.staff_topic_count }.by(1).and change {tag.reload.public_topic_count}.by(1)end- it "should only increase Tag#staff_topic_count for a regular topic in a read restricted category" do+ it "increases only the staff tag count for a topic in a restricted category" doexpect { Fabricate(:topic_tag, topic: topic_in_private_category, tag: tag) }.to change {tag.reload.staff_topic_count}.by(1)@@ -23,7 +23,7 @@ RSpec.describe TopicTag doexpect(tag.reload.public_topic_count).to eq(0)end- it "should increase Tag#pm_topic_count for a private message topic" do+ it "increases the PM tag count for a private message" dotopic.archetype = Archetype.private_messageexpect { topic_tag }.to change { tag.reload.pm_topic_count }.by(1)@@ -31,7 +31,7 @@ RSpec.describe TopicTag doenddescribe "#after_destroy" do- it "should decrease Tag#staff_topic_count and Tag#public_topic_count for a regular topic in a public category" do+ it "decreases staff and public tag counts for a topic in a public category" dotopic_tagexpect { topic_tag.destroy! }.to change { tag.reload.staff_topic_count }.by(-1).and change {@@ -39,14 +39,14 @@ RSpec.describe TopicTag do}.by(-1)end- it "should only decrease Topic#topic_count for a regular topic in a read restricted category" do+ it "decreases only the staff tag count for a topic in a restricted category" dotopic_tag = Fabricate(:topic_tag, topic: topic_in_private_category, tag: tag)expect { topic_tag.destroy! }.to change { tag.reload.staff_topic_count }.by(-1)expect(tag.reload.public_topic_count).to eq(0)end- it "should decrease Tag#pm_topic_count for a private message topic" do+ it "decreases the PM tag count for a private message" dotopic.archetype = Archetype.private_messagetopic_tagdiff --git a/spec/models/topic_timer_spec.rb b/spec/models/topic_timer_spec.rbindex e67b28703e8..62bec827e86 100644--- a/spec/models/topic_timer_spec.rb+++ b/spec/models/topic_timer_spec.rb@@ -42,7 +42,7 @@ RSpec.describe TopicTimer, type: :model doenddescribe "#status_type" do- it "should ensure that only one active public topic status update exists" do+ it "allows only one active public topic status update" dotopic_timer.update!(topic: topic)Fabricate(:topic_timer, deleted_at: Time.zone.now, topic: topic)@@ -52,7 +52,7 @@ RSpec.describe TopicTimer, type: :model dodescribe "#execute_at" dodescribe "when #execute_at is greater than #created_at" do- it "should be valid" do+ it "is valid" dotopic_timer =Fabricate.build(:topic_timer,@@ -66,7 +66,7 @@ RSpec.describe TopicTimer, type: :model doenddescribe "when #execute_at is smaller than #created_at" do- it "should not be valid" do+ it "is invalid" dotopic_timer =Fabricate.build(:topic_timer,@@ -84,7 +84,7 @@ RSpec.describe TopicTimer, type: :model dodescribe "#category_id" dodescribe "when #status_type is publish_to_category" dodescribe "when #category_id is not present" do- it "should not be valid" do+ it "is invalid" dotopic_timer =Fabricate.build(:topic_timer, status_type: TopicTimer.types[:publish_to_category])@@ -94,7 +94,7 @@ RSpec.describe TopicTimer, type: :model doenddescribe "when #category_id is present" do- it "should be valid" do+ it "is valid" dotopic_timer =Fabricate.build(:topic_timer,@@ -113,7 +113,7 @@ RSpec.describe TopicTimer, type: :model dodescribe "Callbacks" dodescribe "when #execute_at and #user_id are not changed" do- it "should not schedule another to update topic" do+ it "does not schedule another topic update" doJobs.expects(:enqueue_at).nevertopic_timer.update!(topic: Fabricate(:topic))@@ -128,7 +128,7 @@ RSpec.describe TopicTimer, type: :model dobefore { Jobs.run_immediately! }- it "should close the topic" do+ it "closes the topic" dotopic_timer.send(:schedule_auto_open_job)expect(topic.reload.closed).to eq(true)end@@ -142,7 +142,7 @@ RSpec.describe TopicTimer, type: :model dobefore { Jobs.run_immediately! }- it "should open the topic" do+ it "opens the topic" dotopic_timer.send(:schedule_auto_close_job)expect(topic.reload.closed).to eq(false)enddiff --git a/spec/models/topic_tracking_state_spec.rb b/spec/models/topic_tracking_state_spec.rbindex 98469315ede..186c99fd347 100644--- a/spec/models/topic_tracking_state_spec.rb+++ b/spec/models/topic_tracking_state_spec.rb@@ -9,7 +9,7 @@ RSpec.describe TopicTrackingState dolet(:topic) { post.topic }shared_examples "does not publish message for private topics" do |method|- it "should not publish any message for a private topic" do+ it "does not publish a message for a private topic" domessages =MessageBus.track_publish { described_class.public_send(method, private_message_topic) }@@ -33,7 +33,7 @@ RSpec.describe TopicTrackingState doFabricate(:topic, category: read_restricted_category_with_no_groups)end- it "should publish message to everyone for a topic in a category that is not read restricted" do+ it "publishes to everyone for a publicly readable category" domessage =MessageBus.track_publish(message_bus_channel) do@@ -48,7 +48,7 @@ RSpec.describe TopicTrackingState doexpect(message.user_ids).to eq(nil)end- it "should publish message only to admin group and groups that have permission to read a category when topic is in category that is restricted to certain groups" do+ it "publishes only to administrators and groups with category access" domessage =MessageBus.track_publish(message_bus_channel) do@@ -63,7 +63,7 @@ RSpec.describe TopicTrackingState doexpect(message.user_ids).to eq(nil)end- it "should publish message only to admin group when topic is in category that is read restricted but no groups have been granted access" do+ it "publishes only to administrators when no group has category access" domessage =MessageBus.track_publish(message_bus_channel) do@@ -319,7 +319,7 @@ RSpec.describe TopicTrackingState do)end- it "should not publish any message" do+ it "does not publish a message" domessages =MessageBus.track_publish { TopicTrackingState.publish_unread(private_message_post) }@@ -369,14 +369,14 @@ RSpec.describe TopicTrackingState doexpect(muted_message.data["message_type"]).to eq(described_class::MUTED_MESSAGE_TYPE)end- it "should not publish any message when notification level is not muted" do+ it "does not publish when the notification level is not muted" domessages = MessageBus.track_publish("/latest") { TopicTrackingState.publish_muted(topic) }muted_messages = messages.select { |message| message.data["message_type"] == "muted" }expect(muted_messages).to eq([])end- it "should not publish any message when the user was not seen in the last 7 days" do+ it "does not publish when the user was absent for seven days" doTopicUser.find_by(topic: topic, user: post.user).update(notification_level: 0)post.user.update(last_seen_at: 8.days.ago)messages = MessageBus.track_publish("/latest") { TopicTrackingState.publish_muted(topic) }@@ -408,7 +408,7 @@ RSpec.describe TopicTrackingState doexpect(unmuted_message.data["message_type"]).to eq(described_class::UNMUTED_MESSAGE_TYPE)end- it "should not publish any message when notification level is not muted" do+ it "does not publish when the notification level is not muted" doSiteSetting.mute_all_categories_by_default = trueTopicUser.find_by(topic: topic, user: post.user).update(notification_level: 0)messages = MessageBus.track_publish("/latest") { TopicTrackingState.publish_unmuted(topic) }@@ -417,7 +417,7 @@ RSpec.describe TopicTrackingState doexpect(unmuted_messages).to eq([])end- it "should not publish any message when the user was not seen in the last 7 days" do+ it "does not publish when the user was absent for seven days" doTopicUser.find_by(topic: topic, user: post.user).update(notification_level: 1)post.user.update(last_seen_at: 8.days.ago)messages = MessageBus.track_publish("/latest") { TopicTrackingState.publish_unmuted(topic) }diff --git a/spec/models/topic_user_spec.rb b/spec/models/topic_user_spec.rbindex 5950d2fda81..dd696d659b9 100644--- a/spec/models/topic_user_spec.rb+++ b/spec/models/topic_user_spec.rb@@ -75,7 +75,7 @@ RSpec.describe TopicUser doenddescribe "notifications" do- it "should trigger the right DiscourseEvent" do+ it "triggers the notification-level Discourse event" docalled = falseblk = Proc.new { called = true }begin@@ -93,7 +93,7 @@ RSpec.describe TopicUser doendend- it "should be set to tracking if auto_track_topics is enabled" do+ it "uses tracking when auto_track_topics is enabled" douser.user_option.update_column(:auto_track_topics_after_msecs, 0)ensure_topic_userexpect(TopicUser.get(topic, user).notification_level).to eq(@@ -101,14 +101,14 @@ RSpec.describe TopicUser do)end- it "should reset regular topics to tracking topics if auto track is changed" do+ it "changes regular topics to tracking when auto tracking changes" doensure_topic_useruser.user_option.auto_track_topics_after_msecs = 0user.user_option.saveexpect(topic_user.notification_level).to eq(TopicUser.notification_levels[:tracking])end- it 'should be set to "regular" notifications, by default on non creators' do+ it 'uses "regular" notifications by default for non-creators' doensure_topic_userexpect(TopicUser.get(topic, user).notification_level).to eq(TopicUser.notification_levels[:regular],@@ -122,7 +122,7 @@ RSpec.describe TopicUser do)end- it "should have the correct reason for a user change when watched" do+ it "records the user-change reason when watched" dotopic.notify_watch!(user)expect(topic_user.notification_level).to eq(TopicUser.notification_levels[:watching])expect(topic_user.notifications_reason_id).to eq(@@ -131,7 +131,7 @@ RSpec.describe TopicUser doexpect(topic_user.notifications_changed_at).not_to eq(nil)end- it "should have the correct reason for a user change when set to regular" do+ it "records the user-change reason when changed from watched to regular" dotopic.notify_regular!(user)expect(topic_user.notification_level).to eq(TopicUser.notification_levels[:regular])expect(topic_user.notifications_reason_id).to eq(@@ -140,7 +140,7 @@ RSpec.describe TopicUser doexpect(topic_user.notifications_changed_at).not_to eq(nil)end- it "should have the correct reason for a user change when set to regular" do+ it "records the user-change reason when changed from tracking to regular" dotopic.notify_muted!(user)expect(topic_user.notification_level).to eq(TopicUser.notification_levels[:muted])expect(topic_user.notifications_reason_id).to eq(@@ -149,7 +149,7 @@ RSpec.describe TopicUser doexpect(topic_user.notifications_changed_at).not_to eq(nil)end- it "should watch topics a user created" do+ it "watches topics created by the user" doexpect(topic_creator_user.notification_level).to eq(TopicUser.notification_levels[:watching])expect(topic_creator_user.notifications_reason_id).to eq(TopicUser.notification_reasons[:created_topic],@@ -196,7 +196,7 @@ RSpec.describe TopicUser docontext "without auto tracking" dolet(:topic_user) { TopicUser.get(topic, user) }- it "should create a new record for a visit" do+ it "creates a record for the first visit" dofreeze_time yesterdayTopicUser.update_last_read(user, topic.id, 1, 1, 0)@@ -206,7 +206,7 @@ RSpec.describe TopicUser doexpect(topic_user.first_visited_at.to_i).to eq(yesterday.to_i)end- it "should update the record for repeat visit" do+ it "updates the record for a repeat visit" dotoday = Time.zone.nowfreeze_time today@@ -246,7 +246,7 @@ RSpec.describe TopicUser dolet(:topic) { post.topic }- it "should ensure recipients and senders are watching" do+ it "makes private-message recipients and senders watch the topic" doexpect(TopicUser.get(topic, post.user).notification_level).to eq(TopicUser.notification_levels[:watching],)@@ -256,7 +256,7 @@ RSpec.describe TopicUser do)end- it "should ensure invited user is watching once visited" do+ it "makes an invited user watch after visiting" doanother_user = Fabricate(:user)topic.invite(target_user, another_user.username)TopicUser.track_visit!(topic.id, another_user.id)@@ -273,7 +273,7 @@ RSpec.describe TopicUser do)end- it "should publish the right message_bus message" do+ it "publishes the notification change through MessageBus" doTopicUser.update_last_read(user, topic.id, 1, 1, 0)Fabricate(:post, topic: topic, user: user)@@ -291,7 +291,7 @@ RSpec.describe TopicUser doFabricate(:group, default_notification_level: NotificationLevels.topic_levels[:tracking])end- it "should use group's default notification level" do+ it "uses the group's default notification level" doanother_user = Fabricate(:user, refresh_auto_groups: true)group.add(another_user)@@ -320,7 +320,7 @@ RSpec.describe TopicUser dobefore { TopicUser.update_last_read(new_user, topic.id, 2, 2, 0) }- it "should automatically track topics you reply to" do+ it "automatically tracks topics the user replies to" dopost_creator.createexpect(topic_new_user.notification_level).to eq(TopicUser.notification_levels[:tracking])expect(topic_new_user.notifications_reason_id).to eq(@@ -328,7 +328,7 @@ RSpec.describe TopicUser do)end- it "should update tracking state when you reply" do+ it "updates the tracking state after a reply" donew_user.user_option.update_column(:notification_level_when_replying, 3)post_creator.createDB.exec(@@ -349,7 +349,7 @@ RSpec.describe TopicUser doexpect(tu.notification_level).to eq(TopicUser.notification_levels[:watching])end- it "should not update tracking state when you reply" do+ it "does not update the tracking state after a reply" donew_user.user_option.update_column(:notification_level_when_replying, 3)post_creator.createDB.exec(@@ -369,7 +369,7 @@ RSpec.describe TopicUser doexpect(tu.notification_level).to eq(TopicUser.notification_levels[:watching])end- it "should not update tracking state when state manually set to normal you reply" do+ it "preserves a manually selected regular state after a reply" donew_user.user_option.update_column(:notification_level_when_replying, 3)post_creator.createDB.exec(@@ -389,7 +389,7 @@ RSpec.describe TopicUser doexpect(tu.notification_level).to eq(TopicUser.notification_levels[:regular])end- it "should not update tracking state when state manually set to muted you reply" do+ it "preserves a manually selected muted state after a reply" donew_user.user_option.update_column(:notification_level_when_replying, 3)post_creator.createDB.exec(@@ -409,7 +409,7 @@ RSpec.describe TopicUser doexpect(tu.notification_level).to eq(TopicUser.notification_levels[:muted])end- it "should not automatically track topics you reply to and have set state manually" do+ it "does not track replied-to topics with a manual state" dopost_creator.createTopicUser.change(new_user,@@ -422,7 +422,7 @@ RSpec.describe TopicUser do)end- it "should automatically track topics after they are read for long enough" do+ it "tracks topics after the user reads them long enough" doexpect(topic_new_user.notification_level).to eq(TopicUser.notification_levels[:regular])TopicUser.update_last_read(new_user,@@ -436,7 +436,7 @@ RSpec.describe TopicUser do)end- it "should not automatically track topics after they are read for long enough if changed manually" do+ it "does not track sufficiently read topics with a manual state" doTopicUser.change(new_user,topic,@@ -452,7 +452,7 @@ RSpec.describe TopicUser doexpect(topic_new_user.notification_level).to eq(TopicUser.notification_levels[:regular])end- it "should not automatically track PMs" do+ it "does not automatically track private messages" donew_user.user_option.update!(auto_track_topics_after_msecs: 0)another_user = Fabricate(:user, refresh_auto_groups: true)@@ -542,7 +542,7 @@ RSpec.describe TopicUser doenddescribe "mailing_list_mode" do- it "will receive email notification for every topic" do+ it "receives an email notification for every topic" douser1 = Fabricate(:user)Jobs.run_immediately!diff --git a/spec/models/translation_override_spec.rb b/spec/models/translation_override_spec.rbindex 0210f77c9b0..6c7ba083239 100644--- a/spec/models/translation_override_spec.rb+++ b/spec/models/translation_override_spec.rb@@ -19,7 +19,7 @@ RSpec.describe TranslationOverride doenddescribe "when interpolation keys are missing" do- it "should not be valid" do+ it "is invalid" dotranslation_override =TranslationOverride.upsert!(I18n.locale,@@ -46,7 +46,7 @@ RSpec.describe TranslationOverride douser_notifications.visit_link_to_responduser_notifications.visit_link_to_respond_pm].each do |i18n_key|- it "should validate keys for #{i18n_key}" do+ it "validates keys for #{i18n_key}" dointerpolation_key_names =described_class.custom_interpolation_keys("user_notifications.user_")@@ -70,7 +70,7 @@ RSpec.describe TranslationOverride doendend- it "should validate keys that shouldn't be used outside of user_notifications" do+ it "validates keys reserved for user_notifications" doI18n.backend.store_translations(:en, "not_a_notification" => "Test %{key1}")translation_override =TranslationOverride.upsert!(@@ -90,7 +90,7 @@ RSpec.describe TranslationOverride doenddescribe "with valid custom interpolation keys" do- it "works" do+ it "creates a valid translation override" dotranslation_override =TranslationOverride.upsert!(I18n.locale,diff --git a/spec/models/upload_spec.rb b/spec/models/upload_spec.rbindex d9f85d5885b..20d772bfd55 100644--- a/spec/models/upload_spec.rb+++ b/spec/models/upload_spec.rb@@ -278,7 +278,7 @@ RSpec.describe Upload doexpect(created_upload.extension).to eq("png")end- it "should create an invalid upload when the filename is blank" do+ it "creates an invalid upload when the filename is blank" doSiteSetting.authorized_extensions = "*"created_upload = UploadCreator.new(attachment, nil).create_for(user_id)expect(created_upload.valid?).to eq(false)@@ -287,7 +287,7 @@ RSpec.describe Upload dodescribe ".extract_url" dolet(:url) { "https://example.com/uploads/default/original/1X/d1c2d40ab994e8410c.png" }- it "should return the right part of url" do+ it "extracts the original upload path" doexpect(Upload.extract_url(url).to_s).to eq("/original/1X/d1c2d40ab994e8410c.png")endend@@ -306,12 +306,12 @@ RSpec.describe Upload doupload.reloadend- it "should return the right upload" do+ it "finds the upload by its extensionless URL" doexpect(Upload.get_from_url(upload.url)).to eq(upload)endend- it "should return the right upload as long as the upload's URL matches" do+ it "finds an upload only when its full path matches" doupload.update!(url: "/uploads/default/12345/971308e535305c51.png")expect(Upload.get_from_url(upload.url)).to eq(upload)@@ -327,7 +327,7 @@ RSpec.describe Upload do)end- it "should return the right upload" do+ it "finds the upload by its nested directory URL" doexpect(Upload.get_from_url(upload.url)).to eq(upload)endend@@ -341,7 +341,7 @@ RSpec.describe Upload doRails.configuration.action_controller.asset_host = original_asset_hostend- it "should return the right upload when using the full URL" do+ it "finds the upload by its full URL" doexpect(Upload.get_from_url(URI.join("http://discourse.some.com:3000/", upload.url).to_s),).to eq(upload)@@ -365,7 +365,7 @@ RSpec.describe Upload doexpect(upload.content).to eq("hello")end- it "should return the right upload when using base url (not CDN) for s3" do+ it "finds the S3 upload by its base URL" douploadexpect(Upload.get_from_url(upload.url)).to eq(upload)end@@ -375,7 +375,7 @@ RSpec.describe Upload dobefore { SiteSetting.s3_cdn_url = s3_cdn_url }- it "should return the right upload" do+ it "finds the matching upload" douploadexpect(Upload.get_from_url(URI.join(s3_cdn_url, path).to_s)).to eq(upload)end@@ -383,14 +383,14 @@ RSpec.describe Upload dodescribe "when upload bucket contains subfolder" dobefore { SiteSetting.s3_upload_bucket = "s3-upload-bucket/path/path2" }- it "should return the right upload" do+ it "finds the matching upload" douploadexpect(Upload.get_from_url(URI.join(s3_cdn_url, path).to_s)).to eq(upload)endendend- it "should return the right upload when using one CDN for both s3 and assets" do+ it "finds the upload when S3 and assets share a CDN" dooriginal_asset_host = Rails.configuration.action_controller.asset_hostcdn_url = "http://my.cdn.com"Rails.configuration.action_controller.asset_host = cdn_url@@ -455,13 +455,13 @@ RSpec.describe Upload doenddescribe ".generate_digest" do- it "should return the right digest" do+ it "returns the upload's digest" doexpect(Upload.generate_digest(image.path)).to eq("bc975735dfc6409c1c2aa5ebf2239949bcbdbd65")endenddescribe ".short_url" do- it "should generate a correct short url" do+ it "generates the short URL" doupload = Upload.new(sha1: "bda2c513e1da04f7b4e99230851ea2aafeb8cc4e", extension: "png")expect(upload.short_url).to eq("upload://r3AYqESanERjladb4vBB7VsMBm6.png")@@ -471,7 +471,7 @@ RSpec.describe Upload doenddescribe ".sha1_from_short_url" do- it "should be able to look up sha1" do+ it "looks up the SHA1" dosha1 = "bda2c513e1da04f7b4e99230851ea2aafeb8cc4e"expect(Upload.sha1_from_short_url("upload://r3AYqESanERjladb4vBB7VsMBm6.png")).to eq(sha1)@@ -479,14 +479,14 @@ RSpec.describe Upload doexpect(Upload.sha1_from_short_url("r3AYqESanERjladb4vBB7VsMBm6")).to eq(sha1)end- it "should be able to look up sha1 even with leading zeros" do+ it "looks up the SHA1 with leading zeros" dosha1 = "0000c513e1da04f7b4e99230851ea2aafeb8cc4e"expect(Upload.sha1_from_short_url("upload://1Eg9p8rrCURq4T3a6iJUk0ri6.png")).to eq(sha1)endenddescribe ".sha1_from_long_url" do- it "should be able to get the sha1 from a regular upload URL" do+ it "extracts the SHA1 from a regular upload URL" doexpect(Upload.sha1_from_long_url("https://cdn.test.com/test/original/4X/7/6/5/1b6453892473a467d07372d45eb05abc2031647a.png",@@ -494,7 +494,7 @@ RSpec.describe Upload do).to eq("1b6453892473a467d07372d45eb05abc2031647a")end- it "should be able to get the sha1 from a secure upload URL" do+ it "extracts the SHA1 from a secure upload URL" doexpect(Upload.sha1_from_long_url("#{Discourse.base_url}\/secure-uploads/original/1X/1b6453892473a467d07372d45eb05abc2031647a.png",@@ -512,14 +512,14 @@ RSpec.describe Upload doenddescribe "#base62_sha1" do- it "should return the right value" do+ it "encodes the SHA1 in base 62" doupload.update!(sha1: "0000c513e1da04f7b4e99230851ea2aafeb8cc4e")expect(upload.base62_sha1).to eq("1Eg9p8rrCURq4T3a6iJUk0ri6")endenddescribe ".sha1_from_short_path" do- it "should be able to lookup sha1" do+ it "looks up the SHA1 from a short path with or without an extension" dopath = "/uploads/short-url/3UjQ4jHoyeoQndk5y3qHzm3QVTQ.png"sha1 = "1b6453892473a467d07372d45eb05abc2031647a"@@ -529,13 +529,13 @@ RSpec.describe Upload doenddescribe "#to_s" do- it "should return the right value" do+ it "returns the upload URL" doexpect(upload.to_s).to eq(upload.url)endenddescribe ".migrate_to_new_scheme" do- it "should not migrate system uploads" do+ it "does not migrate system uploads" doSiteSetting.migrate_to_new_scheme = trueexpect { Upload.migrate_to_new_scheme }.to_not change { Upload.pluck(:url) }@@ -1096,7 +1096,7 @@ RSpec.describe Upload doenddescribe ".mark_invalid_s3_uploads_as_missing" do- it "should update all upload records with a `verification_status` of `invalid_etag` to `s3_file_missing`" do+ it "changes invalid_etag verification statuses to s3_file_missing" doupload_1 =Fabricate(:upload_s3, verification_status: Upload.verification_statuses[:invalid_etag])diff --git a/spec/models/user_action_spec.rb b/spec/models/user_action_spec.rbindex 490a6bf8a21..44b61f5b055 100644--- a/spec/models/user_action_spec.rb+++ b/spec/models/user_action_spec.rb@@ -170,7 +170,7 @@ RSpec.describe UserAction doprivate_post.save!end- it "should include the right attributes in the stream" do+ it "includes the expected attributes in the stream" doexpect(stream.count).to eq(1)user_action_row = stream.first@@ -247,7 +247,7 @@ RSpec.describe UserAction dobefore { PostActionCreator.like(liker, post) }- it "should result in correct data assignment" do+ it "assigns the expected data" doexpect(liker_action).not_to eq(nil)expect(likee_action).not_to eq(nil)expect(likee.user_stat.reload.likes_received).to eq(1)@@ -263,7 +263,7 @@ RSpec.describe UserAction dolet(:likee) { post.topic.topic_allowed_users.first.user }let(:liker) { post.topic.topic_allowed_users.last.user }- it "should not increase user stats" do+ it "does not increase user statistics" doexpect(liker_action).not_to eq(nil)expect(liker.user_stat.reload.likes_given).to eq(0)expect(likee_action).not_to eq(nil)@@ -328,13 +328,13 @@ RSpec.describe UserAction dodescribe "topic action" dolet(:action) { post.user.user_actions.find_by(action_type: UserAction::NEW_TOPIC) }- it "should exist" do+ it "creates the user action" doexpect(action).not_to eq(nil)expect(action.created_at).to eq_time(post.topic.created_at)endend- it "should not log a post user action" do+ it "does not log a post user action" doexpect(post.user.user_actions.find_by(action_type: UserAction::REPLY)).to eq(nil)end@@ -353,7 +353,7 @@ RSpec.describe UserAction dobefore { PostAlerter.post_created(response) }- it "should log user actions correctly" do+ it "logs user actions correctly" doexpect(response.user.user_actions.find_by(action_type: UserAction::REPLY)).not_to eq(nil)expect(post.user.user_actions.find_by(action_type: UserAction::RESPONSE)).not_to eq(nil)expect(mentioned.user_actions.find_by(action_type: UserAction::MENTION)).not_to eq(nil)@@ -362,7 +362,7 @@ RSpec.describe UserAction do).to eq(1)end- it "should not log a double notification for a post edit" do+ it "does not log two notifications for a post edit" doresponse.raw = "here it goes again"response.save!expect(response.user.user_actions.where(action_type: UserAction::REPLY).count).to eq(1)diff --git a/spec/models/user_auth_token_spec.rb b/spec/models/user_auth_token_spec.rbindex ac0ea1bbf0b..b79dd488b28 100644--- a/spec/models/user_auth_token_spec.rb+++ b/spec/models/user_auth_token_spec.rb@@ -378,7 +378,7 @@ RSpec.describe UserAuthToken doexpect(user.user_auth_token_logs.last.client_ip).to eq("1.1.2.3")end- it "will not mark token unseen when prev and current are the same" do+ it "does not mark the token unseen when previous and current match" dotoken =UserAuthToken.generate!(user_id: user.id, user_agent: "some user agent", client_ip: "1.1.2.3")diff --git a/spec/models/user_avatar_spec.rb b/spec/models/user_avatar_spec.rbindex 9de7854265d..fd3eef5db9f 100644--- a/spec/models/user_avatar_spec.rb+++ b/spec/models/user_avatar_spec.rb@@ -43,7 +43,7 @@ RSpec.describe UserAvatar doenddescribe "when user has an existing custom upload" do- it "should not change the user's uploaded avatar" do+ it "does not change the user's uploaded avatar" douser.update!(uploaded_avatar: upload)avatar.update!(custom_upload: upload, gravatar_upload: Fabricate(:upload, user: user))@@ -58,7 +58,7 @@ RSpec.describe UserAvatar doenddescribe "when user has an existing gravatar" do- it "should update the user's uploaded avatar correctly" do+ it "updates the user's uploaded avatar" douser.update!(uploaded_avatar: upload)avatar.update!(gravatar_upload: upload)@@ -105,7 +105,7 @@ RSpec.describe UserAvatar doendend- it "should not raise an error when there's no primary_email" do+ it "does not raise an error without a primary email" doavatar.user.primary_email.destroyavatar.user.reload@@ -158,7 +158,7 @@ RSpec.describe UserAvatar doenddescribe "when avatar url returns an invalid status code" do- it "should not do anything" do+ it "leaves the uploaded avatar unchanged" dostub_request(:get, "http://thisfakesomething.something.com/").to_return(status: 500,body: "",@@ -213,7 +213,7 @@ RSpec.describe UserAvatar do)end- it "will clean up dangling avatars" do+ it "removes dangling avatars" doupload1 = Fabricate(:upload)upload2 = Fabricate(:upload)diff --git a/spec/models/user_export_spec.rb b/spec/models/user_export_spec.rbindex ac358222c12..c6e65990152 100644--- a/spec/models/user_export_spec.rb+++ b/spec/models/user_export_spec.rb@@ -4,7 +4,7 @@ RSpec.describe UserExport dofab!(:user)describe ".remove_old_exports" do- it "should remove the right records" do+ it "removes the expected records" docsv_file_1 = Fabricate(:upload, created_at: 3.days.ago)topic_1 = Fabricate(:topic, created_at: 3.days.ago)post_1 = Fabricate(:post, topic: topic_1)@@ -41,7 +41,7 @@ RSpec.describe UserExport doenddescribe "#retain_hours" do- it "should return the correct number of hours" do+ it "returns the correct number of hours" docsv_file_1 = Fabricate(:upload, created_at: 1.day.ago)topic_1 = Fabricate(:topic, created_at: 1.day.ago)Fabricate(:post, topic: topic_1)diff --git a/spec/models/user_option_spec.rb b/spec/models/user_option_spec.rbindex 765fc0d3f38..88356aaaf52 100644--- a/spec/models/user_option_spec.rb+++ b/spec/models/user_option_spec.rb@@ -17,17 +17,17 @@ RSpec.describe UserOption dodescribe "defaults" dofab!(:user)- it "should be redirected to top when there is a reason to" do+ it "redirects to top when a reason exists" douser.user_option.expects(:redirected_to_top).returns(reason: "42")expect(user.user_option.should_be_redirected_to_top).to eq(true)end- it "should not be redirected to top when there is no reason to" do+ it "does not redirect to top when no reason exists" douser.user_option.expects(:redirected_to_top).returns(nil)expect(user.user_option.should_be_redirected_to_top).to eq(false)end- it "should not hide the profile and presence by default" do+ it "does not hide profile and presence by default" doexpect(user.user_option.hide_profile).to eq(false)expect(user.user_option.hide_presence).to eq(false)end@@ -37,45 +37,45 @@ RSpec.describe UserOption doexpect(user.user_option.understood_languages).to eq([])end- it "should correctly set digest frequency" do+ it "sets the digest frequency correctly" doSiteSetting.default_email_digest_frequency = 1440user = Fabricate(:user)expect(user.user_option.email_digests).to eq(true)expect(user.user_option.digest_after_minutes).to eq(1440)end- it "should correctly set digest frequency when disabled" do+ it "sets the disabled digest frequency correctly" doSiteSetting.default_email_digest_frequency = 0user = Fabricate(:user)expect(user.user_option.email_digests).to eq(false)expect(user.user_option.digest_after_minutes).to eq(0)end- it "should correctly set sidebar_link_to_filtered_list when `default_sidebar_link_to_filtered_list` site setting is enabled" do+ it "enables sidebar_link_to_filtered_list from its default site setting" doSiteSetting.default_sidebar_link_to_filtered_list = trueuser = Fabricate(:user)expect(user.user_option.sidebar_link_to_filtered_list).to eq(true)end- it "should correctly set sidebar_link_to_filtered_list when `default_sidebar_link_to_filtered_list` site setting is disabled" do+ it "disables sidebar_link_to_filtered_list from its default site setting" doSiteSetting.default_sidebar_link_to_filtered_list = falseuser = Fabricate(:user)expect(user.user_option.sidebar_link_to_filtered_list).to eq(false)end- it "should correctly set sidebar_show_count_of_new_items when `default_sidebar_show_count_of_new_items` site setting is enabled" do+ it "enables sidebar_show_count_of_new_items from its default site setting" doSiteSetting.default_sidebar_show_count_of_new_items = trueuser = Fabricate(:user)expect(user.user_option.sidebar_show_count_of_new_items).to eq(true)end- it "should correctly set sidebar_show_count_of_new_items when `default_sidebar_show_count_of_new_items` site setting is disabled" do+ it "disables sidebar_show_count_of_new_items from its default site setting" doSiteSetting.default_sidebar_show_count_of_new_items = falseuser = Fabricate(:user)expect(user.user_option.sidebar_show_count_of_new_items).to eq(false)end- it "should correctly set composition_mode when `default_composition_mode` site setting is set" do+ it "sets composition_mode from the default site setting" doSiteSetting.default_composition_mode = UserOption.composition_mode_types[:markdown]user = Fabricate(:user)expect(user.user_option.composition_mode).to eq(UserOption.composition_mode_types[:markdown])@@ -104,7 +104,7 @@ RSpec.describe UserOption doenddescribe "site settings" do- it "should apply defaults from site settings" do+ it "applies defaults from site settings" doSiteSetting.default_other_enable_quoting = falseSiteSetting.default_other_enable_smart_lists = falseSiteSetting.default_other_enable_markdown_monospace_font = false@@ -134,13 +134,13 @@ RSpec.describe UserOption domailing_list_user.user_option.update(mailing_list_mode: true)end- it "should return false when `SiteSetting.disable_mailing_list_mode` is enabled" do+ it "returns false when mailing-list mode is disabled" doSiteSetting.disable_mailing_list_mode = trueexpect(forum_user.user_option.mailing_list_mode).to eq(false)expect(mailing_list_user.user_option.mailing_list_mode).to eq(false)end- it "should return the stored value when `SiteSetting.disable_mailing_list_mode` is disabled" do+ it "returns the stored value when mailing-list mode is allowed" doSiteSetting.disable_mailing_list_mode = falseexpect(forum_user.user_option.mailing_list_mode).to eq(false)expect(mailing_list_user.user_option.mailing_list_mode).to eq(true)@@ -150,7 +150,7 @@ RSpec.describe UserOption dodescribe ".redirected_to_top" dofab!(:user)- it "should have no reason when `SiteSetting.redirect_users_to_top_page` is disabled" do+ it "has no reason when redirect_users_to_top_page is disabled" doSiteSetting.redirect_users_to_top_page = falseexpect(user.user_option.redirected_to_top).to eq(nil)end@@ -158,7 +158,7 @@ RSpec.describe UserOption docontext "when `SiteSetting.redirect_users_to_top_page` is enabled" dobefore { SiteSetting.redirect_users_to_top_page = true }- it "should have no reason when top is not in the `SiteSetting.top_menu`" do+ it "has no reason when top is absent from the top menu" doSiteSetting.top_menu = "latest"expect(user.user_option.redirected_to_top).to eq(nil)end@@ -166,7 +166,7 @@ RSpec.describe UserOption docontext "when top is in the `SiteSetting.top_menu`" dobefore { SiteSetting.top_menu = "latest|top" }- it "should have no reason when there are not enough topics" do+ it "has no reason when there are too few topics" doSiteSetting.expects(:min_redirected_to_top_period).returns(nil)expect(user.user_option.redirected_to_top).to eq(nil)end@@ -182,7 +182,7 @@ RSpec.describe UserOption doafter { Discourse.redis.flushdb }- it "should have a reason for the first visit" do+ it "has a reason for the first visit" dofreeze_time dodelay = SiteSetting.active_user_rate_limit_secs / 2@@ -202,7 +202,7 @@ RSpec.describe UserOption doendend- it "should not have a reason for next visits" do+ it "has no reason for later visits" douser.user_option.expects(:last_redirected_to_top_at).returns(10.minutes.ago)user.user_option.expects(:update_last_redirected_to_top!).never@@ -213,7 +213,7 @@ RSpec.describe UserOption dodescribe "an older user" dobefore { user.stubs(:trust_level).returns(1) }- it "should have a reason when the user hasn't been seen in a month" do+ it "has a reason when the user has been absent for a month" douser.last_seen_at = 2.months.agouser.user_option.expects(:update_last_redirected_to_top!).oncediff --git a/spec/models/user_password_spec.rb b/spec/models/user_password_spec.rbindex ae015adaf59..f94f11b4474 100644--- a/spec/models/user_password_spec.rb+++ b/spec/models/user_password_spec.rb@@ -104,7 +104,7 @@ RSpec.describe UserPassword doendcontext "for validations" do- it "should validate presence of user_id" do+ it "requires user_id" douser_password = Fabricate.build(:user_password, user: nil)expect(user_password).not_to be_validdiff --git a/spec/models/user_profile_spec.rb b/spec/models/user_profile_spec.rbindex 040e9a8ff11..5a948bcc410 100644--- a/spec/models/user_profile_spec.rb+++ b/spec/models/user_profile_spec.rb@@ -137,7 +137,7 @@ RSpec.describe UserProfile docontext "with website validation" dolet(:user_profile) { Fabricate.build(:user_profile, user: Fabricate(:user)) }- it "should not allow invalid URLs" do+ it "rejects invalid URLs" douser_profile.website = "http://https://google.com"expect(user_profile).to_not be_validend@@ -192,7 +192,7 @@ RSpec.describe UserProfile douser.user_profile.reloadend- it "should markdown the raw_bio and put it in cooked_bio" do+ it "cooks raw_bio into cooked_bio" doexpect(user.user_profile.bio_cooked).to eq("<p><strong>turtle power!</strong></p>")endend@@ -328,7 +328,7 @@ RSpec.describe UserProfile doenddescribe "when profile_background_url returns an invalid status code" do- it "should not do anything" do+ it "leaves the featured topic unchanged" dourl = "http://thisfakesomething.something.com/"UserProfile.import_url_for_user(url, user, is_card_background: false)@@ -340,7 +340,7 @@ RSpec.describe UserProfile doenddescribe "when card_background_url returns an invalid status code" do- it "should not do anything" do+ it "leaves the featured topic unchanged" dourl = "http://thisfakesomething.something.com/"UserProfile.import_url_for_user(url, user, is_card_background: true)diff --git a/spec/models/user_profile_view_spec.rb b/spec/models/user_profile_view_spec.rbindex 89563f2235f..539c2de242f 100644--- a/spec/models/user_profile_view_spec.rb+++ b/spec/models/user_profile_view_spec.rb@@ -9,7 +9,7 @@ RSpec.describe UserProfileView dodescribed_class.add(user_profile_id, ip, user_id, at, true)end- it "should increase user's profile view count" do+ it "increases the user's profile view count" doexpect { add(user_profile_id, "1.1.1.1") }.to change { described_class.count }.by(1)expect(user.user_profile.reload.views).to eq(1)expect { add(user_profile_id, "1.1.1.1", other_user.id) }.to change {@@ -21,7 +21,7 @@ RSpec.describe UserProfileView doexpect(user_profile.user_profile_views).to eq(described_class.all)end- it "should not create duplicated profile view for anon user" do+ it "does not create duplicate anonymous profile views" dotime = Time.zone.now2.times do@@ -30,7 +30,7 @@ RSpec.describe UserProfileView doendend- it "should not create duplicated profile view or log IP for signed in user" do+ it "does not duplicate profile views or log IPs for signed-in users" dotime = Time.zone.now%w[1.1.1.1 2.2.2.2].each do |ip|@@ -40,7 +40,7 @@ RSpec.describe UserProfileView doendend- it "should not create a profile view for the system user" do+ it "does not create a profile view for the system user" doadd(user_profile_id, "1.1.1.1", Discourse::SYSTEM_USER_ID)expect(described_class.count).to eq(0)enddiff --git a/spec/models/user_search_spec.rb b/spec/models/user_search_spec.rbindex 3e3453f1d3d..87f28ab9086 100644--- a/spec/models/user_search_spec.rb+++ b/spec/models/user_search_spec.rb@@ -55,7 +55,7 @@ RSpec.describe UserSearch doexpect(results).to eq [user.username]end- it "will lookup the category from the topic id" do+ it "finds the category from the topic ID" dotopic = Fabricate(:topic, category: category)Fabricate(:post, user: topic.user, topic: topic)@@ -64,13 +64,13 @@ RSpec.describe UserSearch doexpect(results).to eq [topic.user, user].map(&:username)end- it "will raise an error if the user cannot see the category" do+ it "raises an error when the user cannot see the category" doexpect dosearch_for("", searching_user: Fabricate(:user), category_id: category.id)end.to raise_error(Discourse::InvalidAccess)end- it "will respect the group member visibility setting" do+ it "respects the group member visibility setting" dogroup.update(members_visibility_level: Group.visibility_levels[:owners])results = search_for("", searching_user: searching_user, category_id: category.id)expect(results).to be_blankdiff --git a/spec/models/user_second_factor_spec.rb b/spec/models/user_second_factor_spec.rbindex 2189ec2d3d4..c1347ba64e9 100644--- a/spec/models/user_second_factor_spec.rb+++ b/spec/models/user_second_factor_spec.rb@@ -4,7 +4,7 @@ RSpec.describe UserSecondFactor dofab!(:user)describe ".methods" do- it "should retain the right order" do+ it "retains the expected order" doexpect(described_class.methods[:totp]).to eq(1)expect(described_class.methods[:backup_codes]).to eq(2)enddiff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rbindex e594f4da202..7495ceef4cd 100644--- a/spec/models/user_spec.rb+++ b/spec/models/user_spec.rb@@ -30,11 +30,11 @@ RSpec.describe User doexpect(user.in_any_groups?([group.id, Group::AUTO_GROUPS[:everyone]])).to eq(true)end- it "returns true if any of the group IDs are the 'logged_in_users' auto group" do+ it "recognizes membership in the logged_in_users automatic group" doexpect(user.in_any_groups?([Group::AUTO_GROUPS[:logged_in_users]])).to eq(true)end- it "never returns true for the 'anonymous_users' auto group — logged-in users are not anonymous" do+ it "excludes regular users from the anonymous_users automatic group" doGroupUser.where(user_id: Discourse::SYSTEM_USER_ID).delete_allDiscourse.system_user.reloadexpect(user.in_any_groups?([Group::AUTO_GROUPS[:anonymous_users]])).to eq(false)@@ -67,11 +67,11 @@ RSpec.describe User doexpect(Discourse.system_user.in_any_groups?([Group::AUTO_GROUPS[:admins]])).to eq(true)end- it "returns true if any of the group IDs are the 'logged_in_users' auto group" do+ it "accepts logged_in_users as the sole requested group" doexpect(user.in_any_groups?([Group::AUTO_GROUPS[:logged_in_users]])).to eq(true)end- it "never returns true for the 'anonymous_users' auto group — logged-in users are not anonymous" do+ it "excludes the system user from the anonymous_users automatic group" doGroupUser.where(user_id: Discourse::SYSTEM_USER_ID).delete_allDiscourse.system_user.reloadexpect(user.in_any_groups?([Group::AUTO_GROUPS[:anonymous_users]])).to eq(false)@@ -109,7 +109,7 @@ RSpec.describe User doenddescribe "Associations" do- it "should delete sidebar_section_links when a user is destroyed" do+ it "deletes sidebar_section_links when the user is destroyed" doFabricate(:category_sidebar_section_link, user: user)Fabricate(:tag_sidebar_section_link, user: user)@@ -155,27 +155,27 @@ RSpec.describe User do).to contain_exactly(tag.id, hidden_tag.id)end- it "should not create any sidebar section link records for staged users" do+ it "does not create sidebar section links for staged users" douser = Fabricate(:user, staged: true)expect(SidebarSectionLink.exists?(user: user)).to eq(false)end- it "should create sidebar section link records when user has been unstaged" do+ it "creates sidebar section links when the user is unstaged" douser = Fabricate(:user, staged: true)user.unstage!expect(SidebarSectionLink.exists?(user: user)).to eq(true)end- it "should not create any sidebar section link records for non human users" do+ it "does not create sidebar section links for non-human users" doid = -Time.now.to_iuser = Fabricate(:user, id: id)expect(SidebarSectionLink.exists?(user: user)).to eq(false)end- it "should not create any tag sidebar section link records when tagging is disabled" do+ it "does not create tag sidebar section links when tagging is disabled" doSiteSetting.tagging_enabled = falseuser = Fabricate(:user)@@ -248,7 +248,7 @@ RSpec.describe User doit { is_expected.to validate_presence_of :username }describe "when username already exists" do- it "should not be valid" do+ it "rejects a username already used by another user" donew_user = Fabricate.build(:user, username: user.username.upcase)expect(new_user).to_not be_valid@@ -260,7 +260,7 @@ RSpec.describe User dodescribe "when group with a same name already exists" dofab!(:group)- it "should not be valid" do+ it "rejects a username already used by a group" donew_user = Fabricate.build(:user, username: group.name.upcase)expect(new_user).to_not be_valid@@ -321,7 +321,7 @@ RSpec.describe User dolet(:user) { Fabricate.build(:user) }describe "when record has a valid email" do- it "should be valid" do+ it "accepts a valid email address" douser.email = "[email protected]"expect(user).to be_valid@@ -329,7 +329,7 @@ RSpec.describe User doenddescribe "when record has an invalid email" do- it "should not be valid" do+ it "rejects a malformed email address" douser.email = "test@gmailcom"expect(user).to_not be_valid@@ -338,7 +338,7 @@ RSpec.describe User doenddescribe "when record has an email that as already been taken" do- it "should not be valid" do+ it "rejects an email already used by another user" douser2 = Fabricate(:user)user.email = user2.email.upcase@@ -351,7 +351,7 @@ RSpec.describe User doenddescribe "when user is staged" do- it "should still validate presence of primary_email" do+ it "requires a primary email for staged users" douser.staged = trueuser.email = nil@@ -361,7 +361,7 @@ RSpec.describe User doenddescribe "when primary_email is being reassigned to another user" do- it "should not be valid" do+ it "rejects assigning another user's primary email record" douser2 = Fabricate.build(:user, email: nil)user.save!user2.primary_email = user.primary_email@@ -575,7 +575,7 @@ RSpec.describe User doendlet(:value) { nil }- it "works" do+ it "saves a nil user field value" douser.save!expect(user_field_value).to eq nilend@@ -655,7 +655,7 @@ RSpec.describe User dodescribe ".set_default_tags_preferences" dolet(:tag) { Fabricate(:tag) }- it "should set default tag preferences when new user created" do+ it "sets default tag preferences for new users" doSiteSetting.default_tags_watching = tag.nameuser = Fabricate(:user)expect(@@ -709,7 +709,7 @@ RSpec.describe User doexpect(ReviewableUser.find_by(target: user)).to be_blankend- it "will reject a reviewable if the user is deactivated" do+ it "rejects the reviewable when the user is deactivated" doSiteSetting.must_approve_users = trueuser@@ -1000,18 +1000,18 @@ RSpec.describe User dofab!(:user)fab!(:user2, :user)- it "should have a sane email hash" do+ it "hashes the email address" doexpect(user.email_hash).to match(/^[0-9a-f]{32}$/)end- it "should use downcase email" do+ it "lowercases the email before hashing" douser.email = "[email protected]"user2.email = "[email protected]"expect(user.email_hash).to eq(user2.email_hash)end- it "should trim whitespace before hashing" do+ it "trims whitespace before hashing" douser.email = "[email protected]"user2.email = " [email protected] "@@ -1022,7 +1022,7 @@ RSpec.describe User dodescribe "associated_accounts" dofab!(:user)- it "should correctly find social associations" do+ it "finds social associations" doexpect(user.associated_accounts).to eq([])UserAssociatedAccount.create(@@ -1118,7 +1118,7 @@ RSpec.describe User doexpect(user.valid?).to eq(true)end- it "should be SiteSetting.min_username_length chars or longer" do+ it "requires at least SiteSetting.min_username_length characters" doSiteSetting.min_username_length = 5assert_bad("abcd")assert_good("abcde")@@ -1189,12 +1189,12 @@ RSpec.describe User dolet!(:codinghorror) { Fabricate.build(:coding_horror) }- it "should not allow saving if username is reused" do+ it "rejects saving a reused username" docodinghorror.username = user.usernameexpect(codinghorror.save).to eq(false)end- it "should not allow saving if username is reused in different casing" do+ it "rejects reused usernames regardless of case" docodinghorror.username = user.username.upcaseexpect(codinghorror.save).to eq(false)end@@ -1258,7 +1258,7 @@ RSpec.describe User doexpect(User.reserved_username?("test")).to eq(true)end- it "should not allow usernames matched against an expression" do+ it "rejects usernames matching a reserved expression" doSiteSetting.reserved_usernames = "test)|*admin*|foo*|*bar|abc.def|löwe|ka\u0308fer"expect(User.reserved_username?("test")).to eq(false)@@ -1287,35 +1287,35 @@ RSpec.describe User doenddescribe "email_validator" do- it "should allow good emails" do+ it "accepts valid email addresses" douser = Fabricate.build(:user, email: "[email protected]")expect(user).to be_validend- it "should reject some emails based on the blocked_email_domains site setting" do+ it "rejects addresses from a blocked domain" doSiteSetting.blocked_email_domains = "mailinator.com"expect(Fabricate.build(:user, email: "[email protected]")).not_to be_validexpect(Fabricate.build(:user, email: "[email protected]")).to be_validend- it "should reject some emails based on the blocked_email_domains site setting" do+ it "rejects addresses from multiple blocked domains" doSiteSetting.blocked_email_domains = "mailinator.com|trashmail.net"expect(Fabricate.build(:user, email: "[email protected]")).not_to be_validexpect(Fabricate.build(:user, email: "[email protected]")).not_to be_validexpect(Fabricate.build(:user, email: "[email protected]")).to be_validend- it "should not reject partial matches" do+ it "accepts partial matches of blocked domains" doSiteSetting.blocked_email_domains = "mail.com"expect(Fabricate.build(:user, email: "[email protected]")).to be_validend- it "should reject some emails based on the blocked_email_domains site setting ignoring case" do+ it "matches blocked email domains regardless of case" doSiteSetting.blocked_email_domains = "trashmail.net"expect(Fabricate.build(:user, email: "[email protected]")).not_to be_validend- it "should reject emails based on the blocked_email_domains site setting matching subdomain" do+ it "rejects subdomains of blocked email domains" doSiteSetting.blocked_email_domains = "domain.com"expect(Fabricate.build(:user, email: "[email protected]")).not_to be_validend@@ -1333,18 +1333,18 @@ RSpec.describe User doexpect(Fabricate.build(:user, email: "[email protected]")).to be_validend- it "should not interpret a period as a wildcard" do+ it "treats periods literally in email domain restrictions" doSiteSetting.blocked_email_domains = "trashmail.net"expect(Fabricate.build(:user, email: "[email protected]")).to be_validend- it "should not be used to validate existing records" do+ it "does not apply domain restrictions to unchanged existing emails" dou = Fabricate(:user, email: "[email protected]")SiteSetting.blocked_email_domains = "fakemail.com"expect(u).to be_validend- it "should be used when email is being changed" do+ it "applies domain restrictions when the email changes" doSiteSetting.blocked_email_domains = "mailinator.com"u = Fabricate(:user, email: "[email protected]")u.email = "[email protected]"@@ -1359,7 +1359,7 @@ RSpec.describe User doexpect(Fabricate.build(:user, email: "[email protected]")).to be_validend- it "should reject some emails based on the allowed_email_domains site setting when allowlisting multiple domains" do+ it "rejects emails outside multiple allowed domains" doSiteSetting.allowed_email_domains = "vaynermedia.com|gmail.com"expect(Fabricate.build(:user, email: "[email protected]")).not_to be_validexpect(Fabricate.build(:user, email: "[email protected]")).not_to be_valid@@ -1367,7 +1367,7 @@ RSpec.describe User doexpect(Fabricate.build(:user, email: "[email protected]")).to be_validend- it "should accept some emails based on the allowed_email_domains site setting ignoring case" do+ it "accepts allowed email domains regardless of case" doSiteSetting.allowed_email_domains = "vaynermedia.com"expect(Fabricate.build(:user, email: "[email protected]")).to be_validend@@ -1404,7 +1404,7 @@ RSpec.describe User dodescribe "passwords" dolet(:user) { Fabricate.build(:user, active: false) }- it "should not have an active account with a good password" do+ it "keeps the account inactive despite a valid password" douser.password = "ilovepasta"user.save!@@ -1439,7 +1439,7 @@ RSpec.describe User doafter { reset_last_seen_cache!(user) }- it "should act correctly" do+ it "records the previous visit when a later visit starts" doexpect(user.previous_visit_at).to eq(nil)# first visit@@ -1470,18 +1470,18 @@ RSpec.describe User doafter { reset_last_seen_cache!(user) }- it "should update the last seen value" do+ it "updates the last seen value" doexpect(user.last_seen_at).to eq niluser.update_last_seen!(first_visit_date)expect(user.reload.last_seen_at).to eq_time(first_visit_date)end- it "should update the first seen value if it doesn't exist" do+ it "sets the first seen value when missing" douser.update_last_seen!(first_visit_date)expect(user.reload.first_seen_at).to eq_time(first_visit_date)end- it "should not update the first seen value if it doesn't exist" do+ it "preserves the existing first seen value" douser.update_last_seen!(first_visit_date)user.update_last_seen!(second_visit_date)expect(user.reload.first_seen_at).to eq_time(first_visit_date)@@ -1544,11 +1544,11 @@ RSpec.describe User dodescribe "last_seen_at" dofab!(:user)- it "should have a blank last seen on creation" do+ it "has a blank last seen value on creation" doexpect(user.last_seen_at).to eq(nil)end- it "should have 0 for days_visited" do+ it "starts with zero days visited" doexpect(user.user_stat.days_visited).to eq(0)end@@ -1566,14 +1566,14 @@ RSpec.describe User doexpect(user.last_seen_at).to eq_time(date)end- it "should have 0 for days_visited" do+ it "has zero days visited" douser.update_last_seen!user.reloadexpect(user.user_stat.days_visited).to eq(1)end- it "should log a user_visit with the date" do+ it "logs a user visit with the date" dodate = freeze_timeuser.update_last_seen!@@ -1592,7 +1592,7 @@ RSpec.describe User doenddescribe "after 3 days" do- it "should log a second visited_at record when we log an update later" do+ it "logs a second visit when updated on a later date" douser.update_last_seen!freeze_time(3.days.from_now)user.update_last_seen!@@ -1645,13 +1645,13 @@ RSpec.describe User dofab!(:user)context "when email has not been confirmed yet" do- it "should return false" do+ it "returns false before email confirmation" doexpect(user.email_confirmed?).to eq(false)endendcontext "when email has been confirmed" do- it "should return true" do+ it "returns true after email confirmation" dotoken = Fabricate(:email_token, user: user)EmailToken.confirm(token.token)expect(user.email_confirmed?).to eq(true)@@ -1659,7 +1659,7 @@ RSpec.describe User doendcontext "when user has no email tokens for some reason" do- it "should return false" do+ it "returns true when no email tokens remain" douser.email_tokens.each { |t| t.destroy }user.reloadexpect(user.email_confirmed?).to eq(true)@@ -2099,7 +2099,7 @@ RSpec.describe User douser.reloadend- it "should allow us to use it as a primary group" do+ it "allows using the group as the primary group" doexpect(user.primary_group_id).to eq(group.id)# If we remove the user from the group@@ -2183,7 +2183,7 @@ RSpec.describe User doenddescribe "real users" do- it "should find system user if you allow it" do+ it "finds the system user when allowed" doids =User.real(allowed_bot_user_ids: [Discourse.system_user.id])@@ -2249,7 +2249,7 @@ RSpec.describe User do)end- it "should only remove old, unactivated users that haven't been manually deactivated" do+ it "removes only old unactivated users that were not manually deactivated" doUser.purge_unactivatedexpect(User.real.all).to match_array([@@ -2640,7 +2640,7 @@ RSpec.describe User dodescribe "#logged_out" dofab!(:user)- it "should publish the right message" do+ it "publishes the user ID on the logout channel" domessage = MessageBus.track_publish("/logout/#{user.id}") { user.logged_out }.firstexpect(message.data).to eq(user.id)@@ -2652,20 +2652,20 @@ RSpec.describe User dofab!(:notification, :private_message_notification)describe "when first notification has not been seen" do- it "should return the right value" do+ it "returns false before the first notification is seen" doexpect(user.read_first_notification?).to eq(false)endenddescribe "when first notification has been seen" do- it "should return the right value" do+ it "returns true after the first notification is seen" douser.update!(seen_notification_id: notification.id)expect(user.reload.read_first_notification?).to eq(true)endenddescribe "when user is trust level 1" do- it "should return the right value" do+ it "returns false for a trust level 1 user" douser.update!(trust_level: TrustLevel[1])expect(user.read_first_notification?).to eq(false)@@ -2673,7 +2673,7 @@ RSpec.describe User doenddescribe "when user skipped new user tips" do- it "should return the right value" do+ it "returns true when new user tips are skipped" douser.user_option.update!(skip_new_user_tips: true)expect(user.read_first_notification?).to eq(true)@@ -2708,7 +2708,7 @@ RSpec.describe User do)end- it "should display badges in the correct order" do+ it "displays badges in the expected order" doexpect(user.featured_user_badges.map(&:badge_id)).to eq([Badge::Member, Badge::FirstLike, Badge::BasicUser],)@@ -2752,7 +2752,7 @@ RSpec.describe User doenddescribe ".human_users" do- it "should only return users with a positive primary key" do+ it "returns only users with a positive primary key" doFabricate(:bot)user = Fabricate(:user)@@ -2771,7 +2771,7 @@ RSpec.describe User doenddescribe "#publish_notifications_state" do- it "should publish the right message sorted by ID desc" do+ it "publishes the message sorted by descending ID" donotification = Fabricate(:notification, user: user)notification2 = Fabricate(:notification, user: user, read: true)@@ -3072,13 +3072,13 @@ RSpec.describe User doenddescribe "#filter_by_username" do- it "should be able to filter by username" do+ it "filters by username" dofilter_by(:filter_by_username)endenddescribe "#filter_by_username_or_email" do- it "should be able to filter by email" do+ it "filters by email" doemail = "[email protected]"user.update!(email: email)@@ -3087,7 +3087,7 @@ RSpec.describe User doexpect(User.filter_by_username_or_email("veryspeCiaLtest")).to eq([user])end- it "should be able to filter by username" do+ it "filters by username" dofilter_by(:filter_by_username_or_email)endend@@ -3120,7 +3120,7 @@ RSpec.describe User doexpect(User.find(user.id).email).to eq(new_email)end- it "will automatically remove matching secondary emails" do+ it "automatically removes matching secondary emails" dosecondary_email_record = Fabricate(:secondary_email, user: user)user.reloadexpect(user.secondary_emails.count).to eq(1)@@ -3162,7 +3162,7 @@ RSpec.describe User doenddescribe "ensure_consistency!" do- it "will clean up dangling avatars" do+ it "cleans up dangling avatars" doupload = Fabricate(:upload)user = Fabricate(:user, uploaded_avatar_id: upload.id)@@ -3195,7 +3195,7 @@ RSpec.describe User doexpect { user.update(primary_group: group_a) }.to_not change { user.reload.title }end- it "updates user's title only when it is blank or matches the previous primary group" do+ it "updates the flair group to match primary group changes" doexpect { user.update(primary_group: group_a) }.to change { user.reload.flair_group }.from(nil,).to(group_a)@@ -3938,7 +3938,7 @@ RSpec.describe User doFabricate(:category_sidebar_section_link, user: user, linkable: secured_category)end- it "should only return the category ids of category sidebar section link records that the user is allowed to see" do+ it "returns sidebar category IDs visible to the user" doexpect(user.secured_sidebar_category_ids).to contain_exactly(category.id)user.update!(admin: true)@@ -3965,7 +3965,7 @@ RSpec.describe User doFabricate(:tag_sidebar_section_link, user: user, linkable: synonym)end- it "should only return tag sidebar section link records of tags that the user is allowed to browse" do+ it "returns sidebar tag links the user is allowed to browse" doexpect(user.visible_sidebar_tags).to contain_exactly(tag)user.update!(admin: true)diff --git a/spec/models/user_stat_spec.rb b/spec/models/user_stat_spec.rbindex 649958337c4..cf017da5aa4 100644--- a/spec/models/user_stat_spec.rb+++ b/spec/models/user_stat_spec.rb@@ -36,7 +36,7 @@ RSpec.describe UserStat doexpect { UserStat.update_view_counts }.to change { stat.reload.topics_entered }.to 1end- it "won't record a second view as a different topic" do+ it "does not count a repeat view as another topic" doTopicViewItem.add(topic.id, "127.0.0.1", user.id)expect { UserStat.update_view_counts }.to change { stat.reload.topics_entered }.to 1enddiff --git a/spec/models/web_hook_event_spec.rb b/spec/models/web_hook_event_spec.rbindex 6cfb6e0b88a..3e51714a4ff 100644--- a/spec/models/web_hook_event_spec.rb+++ b/spec/models/web_hook_event_spec.rb@@ -7,7 +7,7 @@ RSpec.describe WebHookEvent dodescribe ".purge_old" dobefore { SiteSetting.retain_web_hook_events_period_days = 1 }- it "should be able to purge old web hook events" do+ it "purges old webhook events" doweb_hook = Fabricate(:web_hook)web_hook_event = WebHookEvent.create!(status: 200, web_hook: web_hook)WebHookEvent.create!(status: 200, web_hook: web_hook, created_at: 2.days.ago)diff --git a/spec/models/web_hook_events_daily_aggregate_spec.rb b/spec/models/web_hook_events_daily_aggregate_spec.rbindex d9913882c37..d1bd4ef33e1 100644--- a/spec/models/web_hook_events_daily_aggregate_spec.rb+++ b/spec/models/web_hook_events_daily_aggregate_spec.rb@@ -38,7 +38,7 @@ RSpec.describe WebHookEventsDailyAggregate dodescribe ".purge_old" dobefore { SiteSetting.retain_web_hook_events_aggregate_days = 1 }- it "should be able to purge old web hook event aggregates" do+ it "purges old webhook event aggregates" doweb_hook = Fabricate(:web_hook)WebHookEvent.create!(status: 200, web_hook: web_hook, created_at: 1.day.ago, duration: 180)WebHookEvent.create!(status: 200, web_hook: web_hook, created_at: 2.days.ago, duration: 180)@@ -59,7 +59,7 @@ RSpec.describe WebHookEventsDailyAggregate doenddescribe "aggregation works" do- it "should be able to aggregate web hook events" do+ it "aggregates webhook events" doyesterday_aggregate =WebHookEventsDailyAggregate.create!(web_hook_id: web_hook.id, date: 1.day.ago)yesterday_events = [event, failed_event, failed_event2]@@ -75,7 +75,7 @@ RSpec.describe WebHookEventsDailyAggregate doexpect(yesterday_aggregate.failed_event_count).to eq(2)end- it "should be able to filter by day" do+ it "filters by day" doWebHookEventsDailyAggregate.create!(web_hook_id: web_hook.id, date: 1.day.ago)WebHookEventsDailyAggregate.create!(web_hook_id: web_hook.id, date: 0.days.ago)yesterday_events = [event, failed_event, failed_event2]@@ -101,7 +101,7 @@ RSpec.describe WebHookEventsDailyAggregate do)end- it "should not create a new WebHookEventsDailyAggregate row if AggregateWebHooksEvents runs twice" do+ it "does not duplicate daily aggregates when the job runs twice" doexpect { Jobs::AggregateWebHooksEvents.new.execute(date: 1.day.ago) }.to change {WebHookEventsDailyAggregate.count}.by(1)@@ -111,7 +111,7 @@ RSpec.describe WebHookEventsDailyAggregate do}end- it "should not fail if there are no events" do+ it "handles an empty event list without error" doexpect { Jobs::AggregateWebHooksEvents.new.execute(date: 99.days.ago) }.not_to raise_errorexpect(WebHookEventsDailyAggregate.count).to eq(1)diff --git a/spec/models/web_hook_spec.rb b/spec/models/web_hook_spec.rbindex 25b9fbe82b1..9fa11196775 100644--- a/spec/models/web_hook_spec.rb+++ b/spec/models/web_hook_spec.rb@@ -95,7 +95,7 @@ RSpec.describe WebHook dodescribe "wildcard web hooks" dofab!(:wildcard_hook, :wildcard_web_hook)- it "should include wildcard hooks" do+ it "includes wildcard hooks" doexpect(WebHook.active_web_hooks(:wildcard)).to eq([wildcard_hook])expect(WebHook.active_web_hooks(:post_created)).to contain_exactly(@@ -156,7 +156,7 @@ RSpec.describe WebHook dobefore { topic_web_hook }describe "when there are no active hooks" do- it "should not generate payload and enqueue anything for topic events" do+ it "does not generate payloads or enqueue topic events" dotopic_web_hook.destroy!post = PostCreator.create(user, raw: "post", title: "topic", skip_validations: true)expect(Jobs::EmitWebHookEvent.jobs.length).to eq(0)@@ -166,14 +166,14 @@ RSpec.describe WebHook doexpect(Jobs::EmitWebHookEvent.jobs.length).to eq(0)end- it "should not enqueue anything for tag events" do+ it "does not enqueue tag events" dotag = Fabricate(:tag)tag.destroy!expect(Jobs::EmitWebHookEvent.jobs.length).to eq(0)endend- it "should enqueue the right hooks for topic events" do+ it "enqueues matching hooks for topic events" dopost = PostCreator.create(user, raw: "post", title: "topic", skip_validations: true)topic_id = post.topic.idjob_args = Jobs::EmitWebHookEvent.jobs.last["args"].first@@ -241,7 +241,7 @@ RSpec.describe WebHook do)end- it "should enqueue granular hooks for topic" do+ it "enqueues granular hooks for the topic" dotopic_web_hook.web_hook_event_types.delete(WebHookEventType.where(name: "topic_destroyed").last,)@@ -259,7 +259,7 @@ RSpec.describe WebHook do}end- it "should not log a personal message view when processing new topic" do+ it "does not log a personal message view when processing a new topic" doSiteSetting.log_personal_messages_views = trueFabricate(:topic_web_hook)@@ -283,7 +283,7 @@ RSpec.describe WebHook doenddescribe "when topic has been deleted" do- it "should not enqueue a post/topic edited hooks" do+ it "does not enqueue post or topic edited hooks" dotopic.trash!post.reload@@ -297,7 +297,7 @@ RSpec.describe WebHook doendend- it "should enqueue the right hooks for post events" do+ it "enqueues matching hooks for post events" doFabricate(:web_hook)post =@@ -365,7 +365,7 @@ RSpec.describe WebHook doexpect(payload["id"]).to eq(post.topic.id)end- it "should not enqueue post hooks when the topic is permanently destroyed" do+ it "does not enqueue post hooks when the topic is permanently destroyed" doFabricate(:web_hook)Jobs::EmitWebHookEvent.jobs.clear@@ -380,7 +380,7 @@ RSpec.describe WebHook do).to eq(0)end- it "should serialize the right topic posts counts when a post is deleted" do+ it "serializes updated topic post counts after a post is deleted" doFabricate(:web_hook)Jobs::EmitWebHookEvent.jobs.clear@@ -401,7 +401,7 @@ RSpec.describe WebHook doexpect(payload["topic_filtered_posts_count"]).to eq(1)end- it "should enqueue the destroyed hooks with tag filter for post events" do+ it "enqueues destroyed hooks with the tag filter for post events" dotag = Fabricate(:tag)Fabricate(:web_hook, tags: [tag])@@ -430,7 +430,7 @@ RSpec.describe WebHook dojob.execute(args.with_indifferent_access)end- it "should enqueue the right hooks for user events" do+ it "enqueues matching hooks for user events" doSiteSetting.must_approve_users = trueFabricate(:user_web_hook, active: true)@@ -506,7 +506,7 @@ RSpec.describe WebHook doexpect(payload["user_fields"].size).to eq(1)end- it "should enqueue the right hooks for category events" do+ it "enqueues matching hooks for category events" doFabricate(:category_web_hook)category = Fabricate(:category)@@ -534,7 +534,7 @@ RSpec.describe WebHook doexpect(payload["id"]).to eq(category.id)end- it "should enqueue the right hooks for group events" do+ it "enqueues matching hooks for group events" doFabricate(:group_web_hook)group = Fabricate(:group)@@ -560,7 +560,7 @@ RSpec.describe WebHook doexpect(payload["full_name"]).to eq("testing")end- it "should enqueue the right hooks for tag events" do+ it "enqueues matching hooks for tag events" doFabricate(:tag_web_hook)tag = Fabricate(:tag)@@ -587,7 +587,7 @@ RSpec.describe WebHook doexpect(payload["id"]).to eq(tag.id)end- it "should enqueue the right hooks for notifications" do+ it "enqueues matching hooks for notifications" doFabricate(:notification_web_hook)notification = Fabricate(:notification)job_args = Jobs::EmitWebHookEvent.jobs.last["args"].first@@ -597,7 +597,7 @@ RSpec.describe WebHook doexpect(payload["id"]).to eq(notification.id)end- it "should enqueue the right hooks for reviewables" do+ it "enqueues matching hooks for reviewables" doFabricate(:reviewable_web_hook)reviewable = Fabricate(:reviewable)job_args = Jobs::EmitWebHookEvent.jobs.last["args"].first@@ -621,7 +621,7 @@ RSpec.describe WebHook doexpect(payload["id"]).to eq(reviewable.id)end- it "should enqueue the right hooks for badge grants" do+ it "enqueues matching hooks for badge grants" doFabricate(:user_badge_web_hook)badge = Fabricate(:badge)badge.multiple_grant = true@@ -646,7 +646,7 @@ RSpec.describe WebHook do# Future work: revoke badge hookend- it "should enqueue the right hooks for group user addition" do+ it "enqueues matching hooks when a user joins a group" doFabricate(:group_user_web_hook)group = Fabricate(:group)@@ -667,7 +667,7 @@ RSpec.describe WebHook doexpect(Time.zone.parse(payload["created_at"])).to be_within_one_second_of(now)end- it "should enqueue the right hooks for group user deletion" do+ it "enqueues matching hooks when a user leaves a group" doFabricate(:group_user_web_hook)group = Fabricate(:group)group_user = Fabricate(:group_user, group: group, user: user)@@ -691,7 +691,7 @@ RSpec.describe WebHook dofab!(:user_promoted_web_hook)fab!(:another_user) { Fabricate(:user, trust_level: 2) }- it "should pass the user to the webhook job when a user is promoted" do+ it "passes the promoted user to the webhook job" doanother_user.change_trust_level!(another_user.trust_level + 1)job_args = Jobs::EmitWebHookEvent.jobs.last["args"].first@@ -700,7 +700,7 @@ RSpec.describe WebHook doexpect(payload["id"]).to eq(another_user.id)end- it "shouldn’t trigger when the user is demoted" do+ it "does not trigger when the user is demoted" doexpect { another_user.change_trust_level!(another_user.trust_level - 1) }.not_to change {Jobs::EmitWebHookEvent.jobs.length}@@ -711,7 +711,7 @@ RSpec.describe WebHook dofab!(:like_web_hook)fab!(:another_user, :user)- it "should pass the group id to the emit webhook job" do+ it "passes the group ID to the emit webhook job" dogroup = Fabricate(:group)group_user = Fabricate(:group_user, group: group, user: user)post = Fabricate(:post, user: another_user)@@ -738,7 +738,7 @@ RSpec.describe WebHook do)end- it "should pass the category id to the emit webhook job" do+ it "passes the category ID to the emit webhook job" docategory = Fabricate(:category)topic.update!(category: category)like =@@ -754,7 +754,7 @@ RSpec.describe WebHook doassert_hook_was_queued_with(post, another_user, category_id: category.id)end- it "should pass the tag id to the emit webhook job" do+ it "passes the tag ID to the emit webhook job" dotag = Fabricate(:tag)topic.update!(tags: [tag])like =diff --git a/spec/multisite/jobs_spec.rb b/spec/multisite/jobs_spec.rbindex c02e5a66aa1..8175eb77be5 100644--- a/spec/multisite/jobs_spec.rb+++ b/spec/multisite/jobs_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe "Running Sidekiq Jobs in Multisite", type: :multisite do- it "should revert back to the default connection" do+ it "reverts to the default connection" doexpect do Jobs::DestroyOldDeletionStubs.new.perform({}) end.to_not change {RailsMultisite::ConnectionManagement.current_db}diff --git a/spec/multisite/pausable_multisite_spec.rb b/spec/multisite/pausable_multisite_spec.rbindex 11dd4ff311f..0742da52c9b 100644--- a/spec/multisite/pausable_multisite_spec.rb+++ b/spec/multisite/pausable_multisite_spec.rb@@ -40,7 +40,7 @@ RSpec.describe Sidekiq::Pausable, type: :multisite do) { yield }end- it "should delay the job" do+ it "delays the job" doSidekiq.pause!called = falsediff --git a/spec/multisite/site_settings_spec.rb b/spec/multisite/site_settings_spec.rbindex bf1fe826e85..8f88693f27e 100644--- a/spec/multisite/site_settings_spec.rb+++ b/spec/multisite/site_settings_spec.rb@@ -9,7 +9,7 @@ RSpec.describe "Multisite SiteSettings", type: :multisite doafter { SiteSetting.provider = @original_provider }describe "#default_locale" do- it "should return the right locale" do+ it "returns the site's locale" dotest_multisite_connection("default") { expect(SiteSetting.default_locale).to eq("en") }test_multisite_connection("second") do@@ -65,7 +65,7 @@ RSpec.describe "Multisite SiteSettings", type: :multisite dodescribe "themeable site settings" dodescribe "#enable_welcome_banner" do- it "should return the right value" do+ it "returns the site's setting value" dotest_multisite_connection("default") doexpect(SiteSetting.enable_welcome_banner(theme_id: Theme.find_default.id)).to eq(true)enddiff --git a/spec/requests/about_controller_spec.rb b/spec/requests/about_controller_spec.rbindex 54e75da0365..b17b525bbf3 100644--- a/spec/requests/about_controller_spec.rb+++ b/spec/requests/about_controller_spec.rb@@ -2,7 +2,7 @@RSpec.describe AboutController dodescribe "#index" do- it "should display the about page for anonymous user when login_required is false" do+ it "displays the about page anonymously when login is optional" doSiteSetting.login_required = falseget "/about"@@ -10,14 +10,14 @@ RSpec.describe AboutController doexpect(response.body).to include("<title>About - Discourse</title>")end- it "should redirect to login page for anonymous user when login_required is true" do+ it "redirects anonymous users to login when login is required" doSiteSetting.login_required = trueget "/about"expect(response).to redirect_to "/login"end- it "should display the about page for logged in user when login_required is true" do+ it "displays the about page to logged-in users when login is required" doSiteSetting.login_required = truesign_in(Fabricate(:user))get "/about"@@ -26,13 +26,13 @@ RSpec.describe AboutController doendcontext "with crawler view" do- it "should include correct title" do+ it "includes the page title" doget "/about", headers: { "HTTP_USER_AGENT" => "Googlebot" }expect(response.status).to eq(200)expect(response.body).to include("<title>About - Discourse</title>")end- it "should include correct user URLs" do+ it "includes the user URLs" doFabricate(:admin, username: "anAdminUser")get "/about", headers: { "HTTP_USER_AGENT" => "Googlebot" }expect(response.status).to eq(200)diff --git a/spec/requests/admin/api_controller_spec.rb b/spec/requests/admin/api_controller_spec.rbindex 22fa4dde570..7f73832924a 100644--- a/spec/requests/admin/api_controller_spec.rb+++ b/spec/requests/admin/api_controller_spec.rb@@ -184,7 +184,7 @@ RSpec.describe Admin::ApiController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "works" do+ it "deletes the API key and logs the action" doexpect(ApiKey.exists?(key1.id)).to eq(true)delete "/admin/api/keys/#{key1.id}.json"diff --git a/spec/requests/admin/backups_controller_spec.rb b/spec/requests/admin/backups_controller_spec.rbindex 57b7376fe9b..9172391468c 100644--- a/spec/requests/admin/backups_controller_spec.rb+++ b/spec/requests/admin/backups_controller_spec.rb@@ -499,7 +499,7 @@ RSpec.describe Admin::BackupsController dobefore { sign_in(admin) }describe "when filename contains invalid characters" do- it "should raise an error" do+ it "returns 415 for invalid filename characters" do["灰色.tar.gz", '; echo \'haha\'.tar.gz'].each do |invalid_filename|described_class.any_instance.expects(:has_enough_space_on_disk?).returns(true)@@ -517,7 +517,7 @@ RSpec.describe Admin::BackupsController doenddescribe "when resumableIdentifier is invalid" do- it "should raise an error" do+ it "returns 400 for an invalid upload identifier" dofilename = "test_site-0123456789.tar.gz"@paths = [backup_path(File.join("tmp", "test", "#{filename}.part1"))]@@ -537,7 +537,7 @@ RSpec.describe Admin::BackupsController doenddescribe "when filename is valid" do- it "should upload the file successfully" do+ it "uploads the file" dofreeze_timedescribed_class.any_instance.expects(:has_enough_space_on_disk?).returns(true)@@ -753,7 +753,7 @@ RSpec.describe Admin::BackupsController dobefore { sign_in(admin) }describe "when resumableIdentifier is invalid" do- it "should raise an error" do+ it "returns 400 for an invalid chunk identifier" doget "/admin/backups/upload",params: {resumableidentifier: "../some_file",@@ -836,7 +836,7 @@ RSpec.describe Admin::BackupsController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "should rollback the restore" do+ it "rolls back the restore" doBackupRestore.expects(:rollback!)post "/admin/backups/rollback.json"@@ -844,7 +844,7 @@ RSpec.describe Admin::BackupsController doexpect(response.status).to eq(200)end- it "should not allow rollback via a GET request" do+ it "rejects rollback through a GET request" doget "/admin/backups/rollback.json"expect(response.status).to eq(404)end@@ -852,7 +852,7 @@ RSpec.describe Admin::BackupsController docontext "when readonly mode is enabled" dobefore { Discourse.enable_readonly_mode }- it "should rollback the restore" do+ it "rolls back the restore" doBackupRestore.expects(:rollback!)post "/admin/backups/rollback.json"expect(response.status).to eq(200)@@ -886,7 +886,7 @@ RSpec.describe Admin::BackupsController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "should cancel an backup" do+ it "cancels the backup" doBackupRestore.expects(:cancel!)delete "/admin/backups/cancel.json"@@ -894,7 +894,7 @@ RSpec.describe Admin::BackupsController doexpect(response.status).to eq(200)end- it "should not allow cancel via a GET request" do+ it "rejects cancellation through a GET request" doget "/admin/backups/cancel.json"expect(response.status).to eq(404)end@@ -902,7 +902,7 @@ RSpec.describe Admin::BackupsController docontext "when readonly mode is enabled" dobefore { Discourse.enable_readonly_mode }- it "should cancel an backup" do+ it "cancels the backup" doBackupRestore.expects(:cancel!)delete "/admin/backups/cancel.json"diff --git a/spec/requests/admin/email_controller_spec.rb b/spec/requests/admin/email_controller_spec.rbindex 3f962c4c7b9..4b07f36769c 100644--- a/spec/requests/admin/email_controller_spec.rb+++ b/spec/requests/admin/email_controller_spec.rb@@ -302,7 +302,7 @@ RSpec.describe Admin::EmailController doexpect(response.body).to include("param is missing")end- it "should enqueue the right job, and show a deprecation warning (email_encoded param should be used)" do+ it "enqueues the email job and warns that email_encoded is preferred" doexpect_enqueued_with(job: :process_email,args: {@@ -317,7 +317,7 @@ RSpec.describe Admin::EmailController do)end- it "should enqueue the right job, decoding the raw email param" do+ it "decodes the raw email and enqueues the email job" doexpect_enqueued_with(job: :process_email,args: {@@ -388,7 +388,7 @@ RSpec.describe Admin::EmailController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "should ..." do+ it "returns parsed email text and elided content" dopost "/admin/email/advanced-test.json", params: { email: email }expect(response.status).to eq(200)diff --git a/spec/requests/admin/email_logs_controller_spec.rb b/spec/requests/admin/email_logs_controller_spec.rbindex 5ad2de79def..fce9f93e173 100644--- a/spec/requests/admin/email_logs_controller_spec.rb+++ b/spec/requests/admin/email_logs_controller_spec.rb@@ -15,7 +15,7 @@ RSpec.describe Admin::EmailLogsController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "should return the right response" do+ it "returns the expected response" doget "/admin/email-logs/sent.json"expect(response.status).to eq(200)@@ -35,7 +35,7 @@ RSpec.describe Admin::EmailLogsController doexpect(log["post_url"]).to eq(post.url)end- it "should be able to filter by reply key" do+ it "filters by reply key" doemail_log_2 = Fabricate(:email_log, post: post)post_reply_key_2 =@@ -58,7 +58,7 @@ RSpec.describe Admin::EmailLogsController doendend- it "should be able to filter by smtp_transaction_response" do+ it "filters by smtp_transaction_response" doemail_log_2 = Fabricate(:email_log, smtp_transaction_response: <<~RESPONSE)250 Ok: queued as [email protected]RESPONSE@@ -77,7 +77,7 @@ RSpec.describe Admin::EmailLogsController dolet(:email_type) { "group_smtp" }let(:target_email) { user.email }- it "should be able to filter across both to address and cc addresses" do+ it "filters across recipient and CC addresses" doother_email = "[email protected]"another_email = "[email protected]"email_log_matching_to_address =@@ -150,7 +150,7 @@ RSpec.describe Admin::EmailLogsController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "succeeds" do+ it "returns skipped email logs" doget "/admin/email-logs/skipped.json"expect(response.status).to eq(200)@@ -162,7 +162,7 @@ RSpec.describe Admin::EmailLogsController doendcontext "when filtered by username" do- it "should return the right response" do+ it "returns the matching username response" doget "/admin/email-logs/skipped.json", params: { user: user.username }expect(response.status).to eq(200)@@ -175,7 +175,7 @@ RSpec.describe Admin::EmailLogsController doendcontext "when filtered by address" do- it "should return the right response" do+ it "returns the matching address response" doget "/admin/email-logs/skipped.json", params: { address: "test@example" }expect(response.status).to eq(200)logs = response.parsed_body@@ -212,7 +212,7 @@ RSpec.describe Admin::EmailLogsController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "should provide a string for a blank error" do+ it "provides a string for a blank error" doFabricate(:incoming_email, error: "")get "/admin/email-logs/rejected.json"expect(response.status).to eq(200)@@ -247,7 +247,7 @@ RSpec.describe Admin::EmailLogsController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "should provide a string for a blank error" do+ it "provides a string for a blank error" doincoming_email = Fabricate(:incoming_email, error: "")get "/admin/email-logs/incoming/#{incoming_email.id}.json"expect(response.status).to eq(200)@@ -321,7 +321,7 @@ RSpec.describe Admin::EmailLogsController doexpect(json["error"]).to eq(error_message)end- it "returns an incoming email sent to the notification_email address" do+ it "returns an incoming email sent to a VERP notification address" doFabricate(:incoming_email,is_bounce: true,@@ -336,7 +336,7 @@ RSpec.describe Admin::EmailLogsController doexpect(json["error"]).to eq(error_message)end- it "returns an incoming email sent to the notification_email address" do+ it "returns an incoming email sent to a reply-by-email subdomain" doSiteSetting.reply_by_email_address = "replies+%{reply_key}@subdomain.example.com"Fabricate(:incoming_email,diff --git a/spec/requests/admin/email_templates_controller_spec.rb b/spec/requests/admin/email_templates_controller_spec.rbindex b5f390ec6d3..85617699cf4 100644--- a/spec/requests/admin/email_templates_controller_spec.rb+++ b/spec/requests/admin/email_templates_controller_spec.rb@@ -19,7 +19,7 @@ RSpec.describe Admin::EmailTemplatesController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "should work if you are an admin" do+ it "allows an administrator to update the template" doget "/admin/email/templates.json"expect(response.status).to eq(200)diff --git a/spec/requests/admin/embedding_controller_spec.rb b/spec/requests/admin/embedding_controller_spec.rbindex 0f092f93a63..66f6884681f 100644--- a/spec/requests/admin/embedding_controller_spec.rb+++ b/spec/requests/admin/embedding_controller_spec.rb@@ -91,7 +91,7 @@ RSpec.describe Admin::EmbeddingController doendend- context "when logged in as a moderator" do+ context "when logged in as a regular user" dobefore { sign_in(moderator) }include_examples "embedding updates not allowed"diff --git a/spec/requests/admin/emojis_controller_spec.rb b/spec/requests/admin/emojis_controller_spec.rbindex c45f145576e..8398352ff22 100644--- a/spec/requests/admin/emojis_controller_spec.rb+++ b/spec/requests/admin/emojis_controller_spec.rb@@ -54,7 +54,7 @@ RSpec.describe Admin::EmojiController dobefore { sign_in(admin) }context "when upload is invalid" do- it "should publish the right error" do+ it "publishes the expected error" dopost "/admin/config/emoji.json",params: {name: "test",@@ -75,7 +75,7 @@ RSpec.describe Admin::EmojiController doendcontext "when emoji name already exists" do- it "should publish the right error" do+ it "publishes the expected error" doCustomEmoji.create!(name: "test", upload: upload)post "/admin/config/emoji.json",@@ -92,7 +92,7 @@ RSpec.describe Admin::EmojiController doendend- it "should allow an admin to add a custom emoji" do+ it "allows an admin to add a custom emoji" doEmoji.expects(:clear_cache)post "/admin/config/emoji.json",@@ -115,7 +115,7 @@ RSpec.describe Admin::EmojiController doexpect(custom_emoji.user_id).to eq(admin.id)end- it "should log the action" do+ it "logs the action" doEmoji.expects(:clear_cache)post "/admin/config/emoji.json",@@ -131,7 +131,7 @@ RSpec.describe Admin::EmojiController doexpect(last_log.new_value).to eq("test")end- it "should allow an admin to add a custom emoji with a custom group" do+ it "allows an admin to add a custom emoji with a custom group" doEmoji.expects(:clear_cache)post "/admin/config/emoji.json",@@ -147,7 +147,7 @@ RSpec.describe Admin::EmojiController doexpect(custom_emoji.group).to eq("foo")end- it "should allow an admin to add a custom SVG emoji" do+ it "allows an admin to add a custom SVG emoji" doEmoji.expects(:clear_cache)post "/admin/config/emoji.json",@@ -165,7 +165,7 @@ RSpec.describe Admin::EmojiController doexpect(upload.extension).to eq("svg")end- it "should allow an admin to add a custom animated GIF emoji" do+ it "allows an admin to add a custom animated GIF emoji" doEmoji.expects(:clear_cache)post "/admin/config/emoji.json",@@ -183,7 +183,7 @@ RSpec.describe Admin::EmojiController doexpect(upload.extension).to eq("gif")end- it "should fix up the emoji name" do+ it "normalizes the emoji name" doEmoji.expects(:clear_cache).times(3)post "/admin/config/emoji.json",@@ -621,7 +621,7 @@ RSpec.describe Admin::EmojiController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "should allow an admin to delete a custom emoji" do+ it "allows an admin to delete a custom emoji" docustom_emoji = CustomEmoji.create!(name: "test", upload: upload)Emoji.clear_cache@@ -633,7 +633,7 @@ RSpec.describe Admin::EmojiController doexpect(response.parsed_body["success"]).to eq("OK")end- it "should log the action" do+ it "logs the action" docustom_emoji = CustomEmoji.create!(name: "test", upload: upload)Emoji.clear_cachediff --git a/spec/requests/admin/form_templates_controller_spec.rb b/spec/requests/admin/form_templates_controller_spec.rbindex c19fcd06771..c10e8c171f3 100644--- a/spec/requests/admin/form_templates_controller_spec.rb+++ b/spec/requests/admin/form_templates_controller_spec.rb@@ -9,7 +9,7 @@ RSpec.describe Admin::FormTemplatesController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "should work if you are an admin" do+ it "allows an administrator to create a form template" doget "/admin/customize/form-templates.json"expect(response.status).to eq(200)@@ -21,7 +21,7 @@ RSpec.describe Admin::FormTemplatesController docontext "when logged in as a non-admin user" dobefore { sign_in(user) }- it "should not work if you are not an admin" do+ it "forbids a non-administrator from creating a form template" doget "/admin/customize/form-templates.json"expect(response.status).to eq(404)@@ -34,7 +34,7 @@ RSpec.describe Admin::FormTemplatesController doSiteSetting.enable_form_templates = falseend- it "should not work if you are an admin" do+ it "rejects an invalid form template" doget "/admin/customize/form-templates.json"expect(response.status).to eq(403)@@ -46,7 +46,7 @@ RSpec.describe Admin::FormTemplatesController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "should work if you are an admin" do+ it "allows an administrator to update a form template" doget "/admin/customize/form-templates/#{form_template.id}.json"expect(response.status).to eq(200)diff --git a/spec/requests/admin/groups_controller_spec.rb b/spec/requests/admin/groups_controller_spec.rbindex 46cee9cb8ce..0c4a5dac482 100644--- a/spec/requests/admin/groups_controller_spec.rb+++ b/spec/requests/admin/groups_controller_spec.rb@@ -234,7 +234,7 @@ RSpec.describe Admin::GroupsController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "should work" do+ it "adds the user to the group" dogroup.add_owner(user)delete "/admin/groups/#{group.id}/owners.json", params: { user_id: user.id }@@ -243,7 +243,7 @@ RSpec.describe Admin::GroupsController doexpect(group.group_users.where(owner: true)).to eq([])end- it "should work with multiple users" do+ it "adds multiple users to the group" dogroup.add_owner(user)group.add_owner(user3)@@ -429,7 +429,7 @@ RSpec.describe Admin::GroupsController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "should return the right response for an invalid group_id" do+ it "returns an error for an invalid group ID" domax_id = Group.maximum(:id).to_idelete "/admin/groups/#{max_id + 1}.json"expect(response.status).to eq(404)diff --git a/spec/requests/admin/reports_controller_spec.rb b/spec/requests/admin/reports_controller_spec.rbindex 053219fc9d1..3a19cfefe6f 100644--- a/spec/requests/admin/reports_controller_spec.rb+++ b/spec/requests/admin/reports_controller_spec.rb@@ -442,7 +442,7 @@ RSpec.describe Admin::ReportsController dofab!(:topic) { Fabricate(:topic, category: category) }fab!(:other_topic, :topic)- it "should render the report as JSON" do+ it "renders the report as JSON" doget "/admin/reports/topics.json", params: { category_id: category.id }expect(response.status).to eq(200)@@ -459,7 +459,7 @@ RSpec.describe Admin::ReportsController dofab!(:other_user, :user)fab!(:group)- it "should render the report as JSON" do+ it "renders the report as JSON" dogroup.add(user)get "/admin/reports/signups.json", params: { group_id: group.id }diff --git a/spec/requests/admin/site_settings_controller_spec.rb b/spec/requests/admin/site_settings_controller_spec.rbindex bd9922f3fc2..bd9370b20fb 100644--- a/spec/requests/admin/site_settings_controller_spec.rb+++ b/spec/requests/admin/site_settings_controller_spec.rb@@ -75,7 +75,7 @@ RSpec.describe Admin::SiteSettingsController doexpect(response.status).to eq(404)end- it "should return correct user count for default categories change" do+ it "returns the affected user count for a default-category change" docategory_id = Fabricate(:category).idput "/admin/site_settings/default_categories_watching/user_count.json",@@ -95,7 +95,7 @@ RSpec.describe Admin::SiteSettingsController doexpect(response.parsed_body["user_count"]).to eq(User.real.where(staged: false).count - 1)end- it "should return correct user count for default tags change" do+ it "returns the affected user count for a default-tag change" dotag = Fabricate(:tag)put "/admin/site_settings/default_tags_watching/user_count.json",@@ -181,7 +181,7 @@ RSpec.describe Admin::SiteSettingsController doexpect(response.parsed_body["user_count"]).to eq(1)end- it "should return correct user count for boolean setting" do+ it "returns the affected user count for a boolean setting" doexpect_user_count(site_setting_name: "default_other_external_links_in_new_tab",user_setting_name: "external_links_in_new_tab",@@ -190,7 +190,7 @@ RSpec.describe Admin::SiteSettingsController do)end- it "should return correct user count for 'text_size_key'" do+ it "returns the affected user count for text_size_key" doexpect_user_count(site_setting_name: "default_text_size",user_setting_name: "text_size_key",@@ -201,7 +201,7 @@ RSpec.describe Admin::SiteSettingsController do)end- it "should return correct user count for 'title_count_mode_key'" do+ it "returns the affected user count for title_count_mode_key" doexpect_user_count(site_setting_name: "default_title_count_mode",user_setting_name: "title_count_mode_key",@@ -355,7 +355,7 @@ RSpec.describe Admin::SiteSettingsController dolet!(:user1) { Fabricate(:user) }let!(:user2) { Fabricate(:user) }- it "should update all existing user options" do+ it "updates every existing user option" doSiteSetting.default_email_in_reply_to = trueuser2.user_option.email_in_reply_to = true@@ -371,7 +371,7 @@ RSpec.describe Admin::SiteSettingsController doexpect(user2.user_option.email_in_reply_to).to eq(false)end- it "should not update existing user options" do+ it "does not update existing user options" doexpect {put "/admin/site_settings/default_email_in_reply_to.json",params: {@@ -380,7 +380,7 @@ RSpec.describe Admin::SiteSettingsController do}.not_to change { UserOption.where(email_in_reply_to: false).count }end- it "should update `email_digests` column in existing user options" do+ it "updates email_digests in existing user options" doUserOption.last.update(email_digests: false)expect {@@ -475,7 +475,7 @@ RSpec.describe Admin::SiteSettingsController do)end- it "should update existing users user preference" do+ it "updates existing users' category preferences" doput "/admin/site_settings/default_categories_watching.json",params: {default_categories_watching: category_ids.last(2).join("|"),@@ -510,7 +510,7 @@ RSpec.describe Admin::SiteSettingsController doexpect(response.status).to eq(204)end- it "should not update existing users user preference" do+ it "does not update existing users' category preferences" doexpect {put "/admin/site_settings/default_categories_watching.json",params: {@@ -548,7 +548,7 @@ RSpec.describe Admin::SiteSettingsController doexpect(response.status).to eq(204)end- it "should publish a MessageBus informing the correct groups" do+ it "publishes the affected groups through MessageBus" domessages =MessageBus.track_publish("/site_setting/default_categories_watching/process") doput "/admin/site_settings/default_categories_watching.json",@@ -577,7 +577,7 @@ RSpec.describe Admin::SiteSettingsController doTagUser.create!(tag_id: tags.last.id, notification_level: tracking, user: user2)end- it "should update existing users user preference" do+ it "updates existing users' tag preferences" doput "/admin/site_settings/default_tags_watching.json",params: {default_tags_watching: tags.last(2).pluck(:name).join("|"),@@ -596,7 +596,7 @@ RSpec.describe Admin::SiteSettingsController doexpect(response.status).to eq(204)end- it "should not update existing users user preference" do+ it "does not update existing users' tag preferences" doexpect {put "/admin/site_settings/default_tags_watching.json",params: {@@ -618,7 +618,7 @@ RSpec.describe Admin::SiteSettingsController doexpect(response.status).to eq(204)end- it "should publish a MessageBus informing the correct groups" do+ it "publishes the affected groups through MessageBus" domessages =MessageBus.track_publish("/site_setting/default_tags_watching/process") doput "/admin/site_settings/default_tags_watching.json",diff --git a/spec/requests/admin/themes_controller_spec.rb b/spec/requests/admin/themes_controller_spec.rbindex e543743cbaf..0350a828a01 100644--- a/spec/requests/admin/themes_controller_spec.rb+++ b/spec/requests/admin/themes_controller_spec.rb@@ -246,13 +246,13 @@ RSpec.describe Admin::ThemesController do)end- it "fails to import with a failing status" do+ it "returns 422 for a nonexistent remote theme" dopost "/admin/themes/import.json", params: { remote: "non-existent" }expect(response.status).to eq(422)end- it "fails to import with a failing status" do+ it "returns 422 for an excessively long remote URL" dopost "/admin/themes/import.json", params: { remote: "https://#{"a" * 10_000}.com" }expect(response.status).to eq(422)@@ -1261,7 +1261,7 @@ RSpec.describe Admin::ThemesController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "should return the right response when an invalid id is given" do+ it "rejects an invalid theme ID" doget "/admin/themes/9999/preview.json"expect(response.status).to eq(400)@@ -1303,7 +1303,7 @@ RSpec.describe Admin::ThemesController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "should update a theme setting" do+ it "updates a theme setting" doput "/admin/themes/#{theme.id}/setting.json", params: { name: "bg", value: "green" }expect(response.status).to eq(200)@@ -1316,7 +1316,7 @@ RSpec.describe Admin::ThemesController doexpect(user_history.action).to eq(UserHistory.actions[:change_theme_setting])end- it "should return the right error when value used to update a theme setting of `objects` typed is invalid" do+ it "returns an error for an invalid objects setting value" dotheme.set_field(target: :settings,name: "yaml",@@ -1341,7 +1341,7 @@ RSpec.describe Admin::ThemesController do)end- it "should be able to update a theme setting of `objects` typed" do+ it "updates an objects theme setting" dotheme.set_field(target: :settings,name: "yaml",@@ -1371,7 +1371,7 @@ RSpec.describe Admin::ThemesController do)end- it "should clear a theme setting" do+ it "clears a theme setting" doput "/admin/themes/#{theme.id}/setting.json", params: { name: "bg" }theme.reload@@ -1425,7 +1425,7 @@ RSpec.describe Admin::ThemesController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "should update a theme translation" do+ it "updates a theme translation" doput "/admin/themes/#{theme.id}.json",params: {theme: {@@ -1439,7 +1439,7 @@ RSpec.describe Admin::ThemesController dotheme.reload.translations.map { |t| expect(t.value).to eq("Hello there! updated") }end- it "should update a theme translation with locale" do+ it "updates a theme translation for the requested locale" doput "/admin/themes/#{theme.id}.json",params: {theme: {@@ -1454,7 +1454,7 @@ RSpec.describe Admin::ThemesController dotheme.reload.translations.map { |t| expect(t.value).to eq("Hello there! updated") }end- it "should fail update a theme translation when locale is wrong" do+ it "rejects a theme translation with an invalid locale" doput "/admin/themes/#{theme.id}.json",params: {theme: {@@ -1471,7 +1471,7 @@ RSpec.describe Admin::ThemesController do)end- it "should update other locale and do not change current one" do+ it "updates another locale without changing the current locale" doput "/admin/themes/#{theme.id}.json",params: {theme: {diff --git a/spec/requests/admin/users_controller_spec.rb b/spec/requests/admin/users_controller_spec.rbindex 95dc14dbef3..7e3149e93da 100644--- a/spec/requests/admin/users_controller_spec.rb+++ b/spec/requests/admin/users_controller_spec.rb@@ -679,7 +679,7 @@ RSpec.describe Admin::UsersController doexpect(response.status).to eq(200)end- it "won't delete a category topic" do+ it "preserves category topics" doc = Fabricate(:category_with_definition)cat_post = c.topic.posts.firstput(@@ -691,7 +691,7 @@ RSpec.describe Admin::UsersController doexpect(response.status).to eq(200)end- it "won't delete a category topic by replies" do+ it "preserves category topics when deleting replies" doc = Fabricate(:category_with_definition)cat_post = c.topic.posts.firstput(@@ -2038,7 +2038,7 @@ RSpec.describe Admin::UsersController doexpect(reg_user.active).to eq(true)end- it "should confirm email even when the tokens are expired" do+ it "confirms email even when the tokens are expired" doreg_user.email_tokens.update_all(confirmed: false, expired: true)reg_user.reload@@ -2233,7 +2233,7 @@ RSpec.describe Admin::UsersController doexpect(reg_user).to be_silencedend- it "will set a length of time if provided" do+ it "sets the provided duration" dofuture_date = 1.month.from_now.to_dateput "/admin/users/#{reg_user.id}/silence.json",params: {@@ -2247,7 +2247,7 @@ RSpec.describe Admin::UsersController doexpect(reg_user.silenced_till).to eq(future_date)end- it "will send a message if provided" do+ it "sends the provided message" doexpect doput "/admin/users/#{reg_user.id}/silence.json",params: {@@ -2575,7 +2575,7 @@ RSpec.describe Admin::UsersController dodescribe "#delete_other_accounts_with_same_ip" doshared_examples "deleting other accounts with same ip possible" do- it "works" do+ it "deletes other accounts with the same IP while preserving the target user" dotarget_user = Fabricate(:user, ip_address: "42.42.42.42")user_a = Fabricate(:user, ip_address: "42.42.42.42")user_b = Fabricate(:user, ip_address: "42.42.42.42")@@ -2734,7 +2734,7 @@ RSpec.describe Admin::UsersController doexpect(User.find_by(username: "bob").name).to eq("Bob~~~")end- it "should create new users" do+ it "creates new users" dosso.name = "Dr. Claw"sso.username = "dr_claw"sso.email = "[email protected]"@@ -2766,7 +2766,7 @@ RSpec.describe Admin::UsersController doexpect(events).to include(event_name: :sync_sso, params: [user])end- it "should return the right message if the record is invalid" do+ it "returns an error for an invalid record" dosso.email = ""sso.name = ""sso.external_id = "1"@@ -2776,7 +2776,7 @@ RSpec.describe Admin::UsersController doexpect(response.parsed_body["message"]).to include("Primary email can't be blank")end- it "should return the right message if the signature is invalid" do+ it "returns an error for an invalid signature" dosso.name = "Dr. Claw"sso.username = "dr_claw"sso.email = "[email protected]"@@ -2870,7 +2870,7 @@ RSpec.describe Admin::UsersController doexpect(user.reload.user_second_factors.totps.first).to eq(second_factor)end- it "should able to disable the second factor for another user" do+ it "disables second factor for another user" doexpect do put "/admin/users/#{user.id}/disable_second_factor.json" end.to change {Jobs::CriticalUserEmail.jobs.length}.by(1)@@ -2885,14 +2885,14 @@ RSpec.describe Admin::UsersController doexpect(job_args["type"]).to eq("account_second_factor_disabled")end- it "should not be able to disable the second factor for the current user" do+ it "rejects disabling second factor for the current user" doput "/admin/users/#{admin.id}/disable_second_factor.json"expect(response.status).to eq(403)enddescribe "when user has only one second factor type enabled" do- it "should succeed with security keys" do+ it "disables security key authentication" douser.user_second_factors.destroy_allput "/admin/users/#{user.id}/disable_second_factor.json"@@ -2900,7 +2900,7 @@ RSpec.describe Admin::UsersController doexpect(response.status).to eq(200)end- it "should succeed with totp" do+ it "disables TOTP authentication" douser.security_keys.destroy_allput "/admin/users/#{user.id}/disable_second_factor.json"@@ -2910,7 +2910,7 @@ RSpec.describe Admin::UsersController doenddescribe "when user does not have second factor enabled" do- it "should raise the right error" do+ it "returns 400 when second factor is not enabled" douser.user_second_factors.destroy_alluser.security_keys.destroy_all@@ -3010,7 +3010,7 @@ RSpec.describe Admin::UsersController dodescribe "#delete_posts_batch" doshared_examples "post batch deletion possible" docontext "when user is is invalid" do- it "should return the right response" do+ it "returns 404 for an invalid user" doput "/admin/users/nothing/delete_posts_batch.json"expect(response.status).to eq(404)@@ -3192,7 +3192,7 @@ RSpec.describe Admin::UsersController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "should merge source user to target user" do+ it "merges the source user into the target user" doJobs.run_immediately!post "/admin/users/#{user.id}/merge.json", params: { target_username: target_user.username }@@ -3342,7 +3342,7 @@ RSpec.describe Admin::UsersController dodescribe "#anonymize" doshared_examples "user anonymization possible" do- it "will make the user anonymous" do+ it "anonymizes the user" doput "/admin/users/#{user.id}/anonymize.json"expect(response.status).to eq(200)expect(response.parsed_body["username"]).to be_present@@ -3389,7 +3389,7 @@ RSpec.describe Admin::UsersController docontext "when logged in as a moderator" dobefore { sign_in(moderator) }- it "will reset the bounce score" do+ it "resets the bounce score" dopost "/admin/users/#{user.id}/reset-bounce-score.json"expect(response.status).to eq(200)diff --git a/spec/requests/admin/versions_controller_spec.rb b/spec/requests/admin/versions_controller_spec.rbindex 2396c350d74..ca974010947 100644--- a/spec/requests/admin/versions_controller_spec.rb+++ b/spec/requests/admin/versions_controller_spec.rb@@ -13,14 +13,14 @@ RSpec.describe Admin::VersionsController dodescribe "#show" doshared_examples "version info accessible" do- it "should return the currently available version" do+ it "returns the currently available version" doget "/admin/version_check.json"expect(response.status).to eq(200)json = response.parsed_bodyexpect(json["latest_version"]).to eq("1.2.33")end- it "should return the installed version" do+ it "returns the installed version" doget "/admin/version_check.json"json = response.parsed_bodyexpect(response.status).to eq(200)diff --git a/spec/requests/admin/watched_words_controller_spec.rb b/spec/requests/admin/watched_words_controller_spec.rbindex 7ff15d6d6b2..1ffd29c5dd2 100644--- a/spec/requests/admin/watched_words_controller_spec.rb+++ b/spec/requests/admin/watched_words_controller_spec.rb@@ -73,13 +73,13 @@ RSpec.describe Admin::WatchedWordsController docontext "when logged in as staff user" dobefore { sign_in(admin) }- it "should return the right response when given an invalid id param" do+ it "rejects an invalid watched word ID" dodelete "/admin/customize/watched_words/9999.json"expect(response.status).to eq(400)end- it "should be able to delete a watched word" do+ it "deletes the watched word" dodelete "/admin/customize/watched_words/#{watched_word.id}.json"expect(response.status).to eq(200)@@ -87,7 +87,7 @@ RSpec.describe Admin::WatchedWordsController doexpect(UserHistory.where(action: UserHistory.actions[:watched_word_destroy]).count).to eq(1)end- it "should delete watched word group if it's the last word" do+ it "deletes the watched word group after its last word is removed" dowatched_word_group = Fabricate(:watched_word_group)watched_word = watched_word_group.watched_words.first@@ -228,7 +228,7 @@ RSpec.describe Admin::WatchedWordsController doFabricate(:tag, name: "tag3")end- it "creates the words from the file" do+ it "imports flagged words from the CSV file" dopost "/admin/customize/watched_words/upload.json",params: {action_key: "flag",@@ -251,7 +251,7 @@ RSpec.describe Admin::WatchedWordsController doexpect(UserHistory.where(action: UserHistory.actions[:watched_word_create]).count).to eq(6)end- it "creates the words from the file" do+ it "imports tagged words and replacements from the CSV file" dopost "/admin/customize/watched_words/upload.json",params: {action_key: "tag",diff --git a/spec/requests/application_controller_spec.rb b/spec/requests/application_controller_spec.rbindex 9d701f06a06..95fda889483 100644--- a/spec/requests/application_controller_spec.rb+++ b/spec/requests/application_controller_spec.rb@@ -134,18 +134,18 @@ RSpec.describe ApplicationController doSiteSetting.login_required = trueend- it "should never cache a login redirect" do+ it "does not cache login redirects" doget "/"expect(response.headers["Cache-Control"]).to eq("no-cache, no-store")end- it "should not redirect to login" do+ it "does not redirect to login" doget "/"expect(response).not_to redirect_to("/login")expect(response.status).to eq(200)end- it "should redirect to SSO if enabled" do+ it "redirects to SSO when enabled" doSiteSetting.discourse_connect_url = "http://someurl.com"SiteSetting.discourse_connect_secret = "x" * 10SiteSetting.enable_discourse_connect = true@@ -153,7 +153,7 @@ RSpec.describe ApplicationController doexpect(response).to redirect_to("/session/sso")end- it "should redirect to authenticator if only one, and local logins disabled" do+ it "redirects to the sole authenticator when local logins are disabled" do# Local logins and google enabled, show login UISiteSetting.enable_google_oauth2_logins = trueget "/"@@ -172,7 +172,7 @@ RSpec.describe ApplicationController doexpect(response.status).to eq(200)end- it "should not redirect to SSO when auth_immediately is disabled" do+ it "does not redirect to SSO when auth_immediately is disabled" doSiteSetting.auth_immediately = falseSiteSetting.discourse_connect_url = "http://someurl.com"SiteSetting.discourse_connect_secret = "x" * 10@@ -183,7 +183,7 @@ RSpec.describe ApplicationController doexpect(response.status).to eq(200)end- it "should not redirect to authenticator when auth_immediately is disabled" do+ it "does not redirect to the authenticator when auth_immediately is disabled" doSiteSetting.auth_immediately = falseSiteSetting.enable_google_oauth2_logins = trueSiteSetting.enable_local_logins = false@@ -213,7 +213,7 @@ RSpec.describe ApplicationController doOmniAuth.config.test_mode = falseend- it "should not redirect to authenticator if registration in progress" do+ it "does not redirect to the authenticator during registration" doSiteSetting.enable_local_logins = falseSiteSetting.enable_google_oauth2_logins = true@@ -267,7 +267,7 @@ RSpec.describe ApplicationController doadmin # to skip welcome wizard at home page `/`end- it "should redirect admins when enforce_second_factor is 'all'" do+ it "redirects admins when second factor is enforced for everyone" doSiteSetting.enforce_second_factor = "all"sign_in(admin)@@ -275,7 +275,7 @@ RSpec.describe ApplicationController doexpect(response).to redirect_to("/u/#{admin.username}/preferences/second-factor")end- it "should properly redirect admins when enforce_second_factor is 'all' in subfolder" do+ it "includes the subfolder when redirecting admins for enforced second factor" doset_subfolder "/forum"SiteSetting.enforce_second_factor = "all"sign_in(admin)@@ -284,7 +284,7 @@ RSpec.describe ApplicationController doexpect(response).to redirect_to("/forum/u/#{admin.username}/preferences/second-factor")end- it "should redirect users when enforce_second_factor is 'all'" do+ it "redirects users when second factor is enforced for everyone" doSiteSetting.enforce_second_factor = "all"sign_in(user)@@ -292,7 +292,7 @@ RSpec.describe ApplicationController doexpect(response).to redirect_to("/u/#{user.username}/preferences/second-factor")end- it "should redirect users when enforce_second_factor is 'all' and authenticated via oauth" do+ it "redirects OAuth users when second factor is enforced for everyone" doSiteSetting.enforce_second_factor = "all"sign_in(user)user.user_auth_tokens.last.update(authenticated_with_oauth: true)@@ -301,7 +301,7 @@ RSpec.describe ApplicationController doexpect(response).to redirect_to("/u/#{user.username}/preferences/second-factor")end- it "should not redirect users when enforce_second_factor is 'all', authenticated via oauth but enforce_second_factor_on_external_auth is false" do+ it "exempts OAuth users when second factor enforcement excludes external authentication" doSiteSetting.enforce_second_factor = "all"SiteSetting.enforce_second_factor_on_external_auth = falsesign_in(user)@@ -311,7 +311,7 @@ RSpec.describe ApplicationController doexpect(response.status).to eq(200)end- it "should not redirect anonymous users when enforce_second_factor is 'all'" do+ it "does not redirect anonymous users for enforced second factor" doSiteSetting.enforce_second_factor = "all"SiteSetting.allow_anonymous_mode = true@@ -324,7 +324,7 @@ RSpec.describe ApplicationController doexpect(response.status).to eq(200)end- it "should redirect admins when enforce_second_factor is 'staff'" do+ it "redirects admins when second factor is enforced for staff" doSiteSetting.enforce_second_factor = "staff"sign_in(admin)@@ -332,7 +332,7 @@ RSpec.describe ApplicationController doexpect(response).to redirect_to("/u/#{admin.username}/preferences/second-factor")end- it "should not redirect users when enforce_second_factor is 'staff'" do+ it "does not redirect regular users when second factor is enforced for staff" doSiteSetting.enforce_second_factor = "staff"sign_in(user)@@ -340,7 +340,7 @@ RSpec.describe ApplicationController doexpect(response.status).to eq(200)end- it "should not redirect admins when turned off" do+ it "does not redirect admins when enforcement is disabled" doSiteSetting.enforce_second_factor = "no"sign_in(admin)@@ -348,7 +348,7 @@ RSpec.describe ApplicationController doexpect(response.status).to eq(200)end- it "should not redirect users when turned off" do+ it "does not redirect users when enforcement is disabled" doSiteSetting.enforce_second_factor = "no"sign_in(user)@@ -444,7 +444,7 @@ RSpec.describe ApplicationController doafter { Rails.logger.stop_broadcasting_to(fake_logger) }- it "should not raise a 500 (nor should it log a warning) for bad params" do+ it "handles invalid parameters without a 500 response or warning" dobad_str = (+"d\xDE").force_encoding("utf-8")expect(bad_str.valid_encoding?).to eq(false)@@ -458,7 +458,7 @@ RSpec.describe ApplicationController doenddescribe "missing required param" do- it "should return a 400" do+ it "returns 400" doget "/search/query.json", params: { trem: "misspelled term" }expect(response.status).to eq(400)@@ -470,7 +470,7 @@ RSpec.describe ApplicationController dodescribe "build_not_found_page" dodescribe "topic not found" do- it "should not redirect to permalink if topic/category does not exist" do+ it "does not redirect to a permalink for a missing topic or category" dotopic = create_post.topicPermalink.create!(url: topic.relative_url, topic_id: topic.id + 1)topic.trash!@@ -484,7 +484,7 @@ RSpec.describe ApplicationController doexpect(response.status).to eq(410)end- it "should return permalink for deleted topics" do+ it "returns the permalink for deleted topics" dotopic = create_post.topicexternal_url = "https://somewhere.over.rainbow"Permalink.create!(url: topic.relative_url, external_url: external_url)@@ -533,7 +533,7 @@ RSpec.describe ApplicationController do)end- it "should return 404 and show Google search for an invalid topic route" do+ it "returns 404 with Google search for an invalid topic route" doget "/t/nope-nope/99999999"expect(response.status).to eq(404)@@ -544,7 +544,7 @@ RSpec.describe ApplicationController doexpect(response_body).to have_tag("input", with: { value: "nope nope" })end- it "should not include Google search if login_required is enabled" do+ it "omits Google search when login is required" doSiteSetting.login_required = truesign_in(Fabricate(:user))get "/t/nope-nope/99999999"@@ -561,7 +561,7 @@ RSpec.describe ApplicationController doexpect(response.body).not_to include(I18n.t("page_not_found.search_title"))end- it "should allow anchor tags in title" do+ it "allows anchor tags in the title" doTranslationOverride.upsert!(I18n.locale,"page_not_found.title",@@ -573,7 +573,7 @@ RSpec.describe ApplicationController doexpect(response.body).to include('<a href="/search">search</a>')end- it "should sanitize unsafe HTML in title" do+ it "sanitizes unsafe HTML in the title" doTranslationOverride.upsert!(I18n.locale,"page_not_found.title",@@ -593,7 +593,7 @@ RSpec.describe ApplicationController doafter { Rails.logger.stop_broadcasting_to(fake_logger) }- it "should handle 404 to a css file" do+ it "handles a missing CSS file" doDiscourse.cache.delete("page_not_found_topics:#{I18n.locale}")topic1 = Fabricate(:topic)@@ -618,7 +618,7 @@ RSpec.describe ApplicationController doexpect(fake_logger.warnings.length).to eq(0)end- it "should render category badges with correct style classes on 404 page" do+ it "renders category badge style classes on the 404 page" doDiscourse.cache.delete("page_not_found_topics:#{I18n.locale}")square_cat = Fabricate(:category, style_type: :square)@@ -694,7 +694,7 @@ RSpec.describe ApplicationController doendend- it "should cache results" do+ it "caches results" doDiscourse.cache.delete("page_not_found_topics:#{I18n.locale}")Discourse.cache.delete("page_not_found_topics:fr")@@ -800,12 +800,12 @@ RSpec.describe ApplicationController doenddescribe "allow_embedding_site_in_an_iframe" do- it "should have the 'X-Frame-Options' header with value 'sameorigin'" do+ it "sets X-Frame-Options to sameorigin" doget("/latest")expect(response.headers["X-Frame-Options"]).to eq("SAMEORIGIN")end- it "should not include the 'X-Frame-Options' header" do+ it "omits the X-Frame-Options header" doSiteSetting.allow_embedding_site_in_an_iframe = trueget("/latest")expect(response.headers).not_to include("X-Frame-Options")@@ -1436,7 +1436,7 @@ RSpec.describe ApplicationController doendcontext "with a logged in user" do- it "it uses the default locale" do+ it "uses the default locale" douser = Fabricate(:user, locale: :fr)sign_in(user)diff --git a/spec/requests/associate_accounts_controller_spec.rb b/spec/requests/associate_accounts_controller_spec.rbindex 3b92af9f434..cf8854d36f2 100644--- a/spec/requests/associate_accounts_controller_spec.rb+++ b/spec/requests/associate_accounts_controller_spec.rb@@ -30,7 +30,7 @@ RSpec.describe Users::AssociateAccountsController doRails.application.env_config["omniauth.auth"] = OmniAuth.config.mock_auth[:google_oauth2]end- it "should work correctly" do+ it "associates the external account" dosign_in(user)# Reconnect flow:@@ -70,7 +70,7 @@ RSpec.describe Users::AssociateAccountsController doexpect(response.status).to eq(404)end- it "should only work within the current session" do+ it "restricts association to the current session" dosign_in(user)post "/auth/google_oauth2?reconnect=true"diff --git a/spec/requests/badges_controller_spec.rb b/spec/requests/badges_controller_spec.rbindex 5611d35d7c7..4642119b345 100644--- a/spec/requests/badges_controller_spec.rb+++ b/spec/requests/badges_controller_spec.rb@@ -7,7 +7,7 @@ RSpec.describe BadgesController dobefore { SiteSetting.enable_badges = true }describe "#index" do- it "should return a list of all badges" do+ it "returns all badges" doget "/badges.json"expect(response.status).to eq(200)@@ -125,14 +125,14 @@ RSpec.describe BadgesController doenddescribe "#show" do- it "should return a badge" do+ it "returns the badge" doget "/badges/#{badge.id}.json"expect(response.status).to eq(200)parsed = response.parsed_bodyexpect(parsed["badge"]).to be_presentend- it "should mark the notification as viewed" do+ it "marks the notification as viewed" dosign_in(user)user_badge = BadgeGranter.grant(badge, user)expect(user_badge.notification.read).to eq(false)diff --git a/spec/requests/categories_controller_spec.rb b/spec/requests/categories_controller_spec.rbindex 6b96b2b30e5..bddd4a16190 100644--- a/spec/requests/categories_controller_spec.rb+++ b/spec/requests/categories_controller_spec.rb@@ -620,7 +620,7 @@ RSpec.describe CategoriesController doenddescribe "success" do- it "works" do+ it "creates the category with group permissions" doSiteSetting.enable_category_group_moderation = truereadonly = CategoryGroup.permission_types[:readonly]@@ -741,7 +741,7 @@ RSpec.describe CategoriesController doexpect(SiteSetting.max_category_nesting).to eq(3)end- it "will set the schema value for site settings when overrides are not provided" do+ it "uses the schema value when no site-setting override is provided" doSiteSetting.max_category_nesting = 3Categories::Types::Discussion.stubs(:configuration_schema).returns({ site_settings: { max_category_nesting: 2 } },@@ -2391,7 +2391,7 @@ RSpec.describe CategoriesController docontext "when in readonly mode" dobefore { Discourse.enable_readonly_mode }- it "works" do+ it "returns category search results in read-only mode" dopost "/categories/search.json", params: { term: "" }expect(response.status).to eq(200)diff --git a/spec/requests/directory_items_controller_spec.rb b/spec/requests/directory_items_controller_spec.rbindex 936a7f69a43..f372d7e8f71 100644--- a/spec/requests/directory_items_controller_spec.rb+++ b/spec/requests/directory_items_controller_spec.rb@@ -142,7 +142,7 @@ RSpec.describe DirectoryItemsController docontext "with a logged in user" dobefore { sign_in(user) }- it "succeeds" do+ it "returns 200 when the directory has no data" doget "/directory_items.json", params: { period: "all" }expect(response.status).to eq(200)enddiff --git a/spec/requests/do_not_disturb_controller_spec.rb b/spec/requests/do_not_disturb_controller_spec.rbindex 9a52b14047f..ea448b6f37c 100644--- a/spec/requests/do_not_disturb_controller_spec.rb+++ b/spec/requests/do_not_disturb_controller_spec.rb@@ -16,7 +16,7 @@ RSpec.describe DoNotDisturbController doexpect(response.status).to eq(400)end- it "works properly with integer minute durations" do+ it "accepts a positive integer minute duration" dofreeze_timepost "/do-not-disturb.json", params: { duration: 30 }@@ -24,7 +24,7 @@ RSpec.describe DoNotDisturbController doexpect(user.do_not_disturb_timings.last.ends_at).to eq_time(30.minutes.from_now)end- it "works properly with integer minute durations" do+ it "rejects a negative integer minute duration" dopost "/do-not-disturb.json", params: { duration: -30 }expect(response.status).to eq(422)expect(response.parsed_body).to eq({ "errors" => ["Ends at is invalid"] })diff --git a/spec/requests/email_controller_spec.rb b/spec/requests/email_controller_spec.rbindex 380c88beaf4..c64412f4f51 100644--- a/spec/requests/email_controller_spec.rb+++ b/spec/requests/email_controller_spec.rb@@ -202,7 +202,7 @@ RSpec.describe EmailController dodescribe "#unsubscribed" dodescribe "when email is invalid" do- it "should return the right response" do+ it "returns an invalid-email response" doget "/email/unsubscribed", params: { email: "somerandomstring" }expect(response.status).to eq(404)end@@ -211,7 +211,7 @@ RSpec.describe EmailController dodescribe "when topic is public" dofab!(:topic)- it "should return the right response" do+ it "returns the public topic details" dokey = SecureRandom.hexDiscourse.cache.write(key, user.email)get "/email/unsubscribed", params: { key: key, topic_id: topic.id }@@ -223,7 +223,7 @@ RSpec.describe EmailController dodescribe "when topic is private" dofab!(:private_topic, :private_message_topic)- it "should return the right response" do+ it "does not expose the private topic" dokey = SecureRandom.hexDiscourse.cache.write(key, user.email)get "/email/unsubscribed", params: { key: key, topic_id: private_topic.id }diff --git a/spec/requests/embed_controller_spec.rb b/spec/requests/embed_controller_spec.rbindex c0e98396dc3..b51e1aed7b9 100644--- a/spec/requests/embed_controller_spec.rb+++ b/spec/requests/embed_controller_spec.rb@@ -8,7 +8,7 @@ RSpec.describe EmbedController dodescribe "#info" docontext "without api key" do- it "fails" do+ it "returns an embed error without an API key" doget "/embed/info.json"expect(response.body).to match(I18n.t("embed.error"))diff --git a/spec/requests/exceptions_controller_spec.rb b/spec/requests/exceptions_controller_spec.rbindex 45efffe151f..e5307576aa1 100644--- a/spec/requests/exceptions_controller_spec.rb+++ b/spec/requests/exceptions_controller_spec.rb@@ -2,7 +2,7 @@RSpec.describe ExceptionsController dodescribe "#not_found" do- it "should return the right response" do+ it "renders the not-found page" doget "/404"expect(response.status).to eq(404)@@ -18,7 +18,7 @@ RSpec.describe ExceptionsController dodescribe "text site logo" dobefore { SiteSetting.logo = "" }- it "should return the right response" do+ it "renders the not-found page with the text logo" doget "/404"expect(response.status).to eq(404)diff --git a/spec/requests/export_csv_controller_spec.rb b/spec/requests/export_csv_controller_spec.rbindex 22cf1a186aa..b50c9d44e40 100644--- a/spec/requests/export_csv_controller_spec.rb+++ b/spec/requests/export_csv_controller_spec.rb@@ -28,7 +28,7 @@ RSpec.describe ExportCsvController doexpect(job_data["user_id"]).to eq(user.id)end- it "should not enqueue export job if rate limit is reached" do+ it "does not enqueue an export job after reaching the rate limit" doUserExport.create(file_name: "user-archive-codinghorror-150116-003249", user_id: user.id)post "/export_csv/export_entity.json", params: { entity: "user_archive" }expect(response.status).to eq(422)@@ -127,7 +127,7 @@ RSpec.describe ExportCsvController doexpect(job_data["user_id"]).to eq(admin.id)end- it "should not rate limit export for staff" do+ it "does not rate-limit exports for staff" doUserExport.create(file_name: "screened-email-150116-010145", user_id: admin.id)post "/export_csv/export_entity.json", params: { entity: "staff_action" }expect(response.status).to eq(200)diff --git a/spec/requests/extra_locales_controller_spec.rb b/spec/requests/extra_locales_controller_spec.rbindex 44d04b6cb50..448ae4054de 100644--- a/spec/requests/extra_locales_controller_spec.rb+++ b/spec/requests/extra_locales_controller_spec.rb@@ -8,7 +8,7 @@ RSpec.describe ExtraLocalesController dolet(:fake_digest) { "a" * 40 }describe "#show" do- it "won't work with a weird parameter" do+ it "rejects an invalid parameter" doget "/extra-locales/#{fake_digest}/en/-invalid..character!!.js"expect(response.status).to eq(404)end@@ -238,7 +238,7 @@ RSpec.describe ExtraLocalesController doenddescribe ".url" do- it "works" do+ it "builds the locale bundle URL with a version digest" doexpect(ExtraLocalesController.url("admin")).to match(%r{\A/extra-locales/\h{40}/en/admin\.js\z},)diff --git a/spec/requests/form_templates_controller_spec.rb b/spec/requests/form_templates_controller_spec.rbindex 6ae86134bc4..6b57f69ea3c 100644--- a/spec/requests/form_templates_controller_spec.rb+++ b/spec/requests/form_templates_controller_spec.rb@@ -11,7 +11,7 @@ RSpec.describe FormTemplatesController docontext "when logged in as a user" dobefore { sign_in(user) }- it "should return all form templates ordered by its ids" do+ it "returns all form templates ordered by ID" doget "/form-templates.json"expect(response.status).to eq(200)json = response.parsed_body@@ -57,7 +57,7 @@ RSpec.describe FormTemplatesController doendcontext "when you are not logged in" do- it "should deny access" do+ it "denies access" doget "/form-templates.json"expect(response.status).to eq(403)end@@ -69,7 +69,7 @@ RSpec.describe FormTemplatesController doSiteSetting.enable_form_templates = falseend- it "should not work if you are a logged in user" do+ it "rejects a logged-in user" doget "/form-templates.json"expect(response.status).to eq(403)end@@ -82,7 +82,7 @@ RSpec.describe FormTemplatesController docontext "when logged in as a user" dobefore { sign_in(user) }- it "should return a single template" do+ it "returns one template" doget "/form-templates/#{form_template.id}.json"expect(response.status).to eq(200)json = response.parsed_body@@ -151,7 +151,7 @@ RSpec.describe FormTemplatesController dosign_in(user)end- it "should return a single template with the correct data" do+ it "returns one template with the expected data" doget "/form-templates/#{tag_groups_form_template.id}.json"expect(response.status).to eq(200)json = response.parsed_body@@ -186,7 +186,7 @@ RSpec.describe FormTemplatesController do)end- it "should return a single template with the correct data in order" do+ it "returns one template with ordered data" donew_tag = Fabricate(:tag, description: "Custom Tag")tag_group1.tags = [tag3, tag1, new_tag]tag_group1.save@@ -209,7 +209,7 @@ RSpec.describe FormTemplatesController doendcontext "when you are not logged in" do- it "should deny access" do+ it "denies access" doget "/form-templates/#{form_template.id}.json"expect(response.status).to eq(403)end@@ -221,7 +221,7 @@ RSpec.describe FormTemplatesController doSiteSetting.enable_form_templates = falseend- it "should not work if you are a logged in user" do+ it "rejects a logged-in user" doget "/form-templates/#{form_template.id}.json"expect(response.status).to eq(403)enddiff --git a/spec/requests/groups_controller_spec.rb b/spec/requests/groups_controller_spec.rbindex cc5bf6367b5..cbc7944a928 100644--- a/spec/requests/groups_controller_spec.rb+++ b/spec/requests/groups_controller_spec.rb@@ -53,26 +53,26 @@ RSpec.describe GroupsController docontext "when group directory is disabled" dobefore { SiteSetting.enable_group_directory = false }- it "should deny access for an anon" do+ it "denies access to an anonymous user" doget "/groups.json"expect(response.status).to eq(403)end- it "should deny access for a normal user" do+ it "denies access to a regular user" dosign_in(user)get "/groups.json"expect(response.status).to eq(403)end- it "should allow access for an admin" do+ it "allows access for an admin" dosign_in(admin)get "/groups.json"expect(response.status).to eq(200)end- it "should allow access for a moderator" do+ it "allows access for a moderator" dosign_in(moderator)get "/groups.json"@@ -81,7 +81,7 @@ RSpec.describe GroupsController doendcontext "with searchable" do- it "should return the searched groups" do+ it "returns the matching groups" dotesting_group = Fabricate(:group, name: "testing")get "/groups.json", params: { filter: "test" }@@ -187,7 +187,7 @@ RSpec.describe GroupsController doendend- it "should return the right response" do+ it "returns the expected response" dogroupstaff_group@@ -230,7 +230,7 @@ RSpec.describe GroupsController docontext "when viewing groups of another user" dodescribe "when an invalid username is given" do- it "should return the right response" do+ it "returns the expected response" dogroupget "/groups.json", params: { username: "asdasd" }@@ -238,7 +238,7 @@ RSpec.describe GroupsController doendend- it "should return the right response" do+ it "returns the expected response" dou = Fabricate(:user)m = Fabricate(:user)o = Fabricate(:user)@@ -365,7 +365,7 @@ RSpec.describe GroupsController dogroup.add_owner(admin)end- it "should return the right response" do+ it "returns the expected response" dostaff_groupget "/groups.json"@@ -401,13 +401,13 @@ RSpec.describe GroupsController doenddescribe "my groups" do- it "should return the groups admin is a member of" do+ it "returns groups the admin belongs to" doexpect_type_to_return_right_groups("my", admin.group_users.map(&:group_id))endenddescribe "owner groups" do- it "should return the groups admin is a owner of" do+ it "returns groups the admin owns" dogroup2 = Fabricate(:group)_group3 = Fabricate(:group)group2.add_owner(admin)@@ -420,7 +420,7 @@ RSpec.describe GroupsController doenddescribe "automatic groups" do- it "should return the right response" do+ it "returns the expected response" doexpect_type_to_return_right_groups("automatic",Group::AUTO_GROUP_IDS.keys -@@ -434,14 +434,14 @@ RSpec.describe GroupsController doenddescribe "non automatic groups" do- it "should return the right response" do+ it "returns the expected response" dogroup2 = Fabricate(:group)expect_type_to_return_right_groups("non_automatic", [group.id, group2.id])endenddescribe "public groups" do- it "should return the right response" do+ it "returns the expected response" dogroup2 = Fabricate(:group, public_admission: true)expect_type_to_return_right_groups("public", [group2.id])@@ -449,7 +449,7 @@ RSpec.describe GroupsController doenddescribe "close groups" do- it "should return the right response" do+ it "returns the expected response" dogroup2 = Fabricate(:group, public_admission: false)_group3 = Fabricate(:group, public_admission: true)@@ -549,7 +549,7 @@ RSpec.describe GroupsController doendend- it "should respond to HTML" do+ it "responds to HTML" dogroup.update!(bio_raw: "testing **group** bio")get "/groups/#{group.name}.html"@@ -593,7 +593,7 @@ RSpec.describe GroupsController doinclude_examples "group show behavior", "/groups", :namedescribe "when viewing activity filters" do- it "should return the right response" do+ it "returns the expected response" doget "/groups/#{group.name}/activity/posts.json"expect(response.status).to eq(200)@@ -929,7 +929,7 @@ RSpec.describe GroupsController doendend- describe "#members" do+ describe "#members membership changes" doit "returns correct error code with invalid params" dosign_in(user)@@ -1156,7 +1156,7 @@ RSpec.describe GroupsController doenddescribe "#mentionable" do- it "should return the right response" do+ it "returns the expected response" dosign_in(user)group.update!(@@ -1195,7 +1195,7 @@ RSpec.describe GroupsController doenddescribe "#messageable" do- it "should return the right response" do+ it "returns the expected response" douser.change_trust_level!(1)sign_in(user)@@ -1296,7 +1296,7 @@ RSpec.describe GroupsController dosign_in(user)end- it "should be able update the group" do+ it "updates the group" dogroup.update!(allow_membership_requests: false,visibility_level: 2,@@ -1363,7 +1363,7 @@ RSpec.describe GroupsController doexpect(group.group_tag_notification_defaults.first&.tag).to eq(tag)end- it "should not clear group title when owner updates other settings" do+ it "preserves the group title when an owner updates other settings" dogroup.update!(title: "Original Title")put "/groups/#{group.id}.json",@@ -1382,7 +1382,7 @@ RSpec.describe GroupsController doexpect(group.flair_bg_color).to eq("FFF")end- it "should not allow group owner to modify the group title" do+ it "does not allow a group owner to modify the title" dogroup.update!(title: "Original Title")put "/groups/#{group.id}.json",@@ -1400,7 +1400,7 @@ RSpec.describe GroupsController doexpect(group.flair_bg_color).to eq("FFF")end- it "should not clear automatic_membership_email_domains when moderator owner updates group" do+ it "preserves automatic membership domains when a moderator owner updates the group" doSiteSetting.moderators_manage_groups = falseuser.update!(moderator: true)group.update!(automatic_membership_email_domains: "test.org")@@ -1420,7 +1420,7 @@ RSpec.describe GroupsController doexpect(group.bio_raw).to eq("updated bio")end- it "should not be allowed to update automatic groups" do+ it "does not allow automatic groups to be updated" dogroup = Group.find(Group::AUTO_GROUPS[:admins])put "/groups/#{group.id}.json", params: { group: { messageable_level: 1 } }@@ -1432,7 +1432,7 @@ RSpec.describe GroupsController docontext "when user is group admin" dobefore { sign_in(admin) }- it "should be able to update the group" do+ it "updates the group" dogroup.update!(visibility_level: 2, members_visibility_level: 2, grant_trust_level: 0)put "/groups/#{group.id}.json",@@ -1530,7 +1530,7 @@ RSpec.describe GroupsController doendcontext "with user default notifications" do- it "should update default notification preference for existing users" do+ it "updates the default notification preference for existing users" dogroup.update!(default_notification_level: NotificationLevels.all[:watching])user1 = Fabricate(:user)group.add(user1)@@ -1594,7 +1594,7 @@ RSpec.describe GroupsController doexpect(group_user2.reload.notification_level).to eq(NotificationLevels.all[:tracking])end- it "should update category & tag notification preferences for existing users" do+ it "updates category and tag notification preferences for existing users" douser1 = Fabricate(:user)CategoryUser.create!(user: user1, category: category, notification_level: 4)TagUser.create!(user: user1, tag: tag, notification_level: 4)@@ -1673,7 +1673,7 @@ RSpec.describe GroupsController dosign_in(moderator)end- it "should not be able to update the group if the SiteSetting is false" do+ it "does not update the group when the site setting is disabled" doSiteSetting.moderators_manage_groups = falseput "/groups/#{group.id}.json", params: { group: { name: "testing" } }@@ -1681,7 +1681,7 @@ RSpec.describe GroupsController doexpect(response.status).to eq(403)end- it "should not be able to update a group it cannot see" do+ it "does not update a group the user cannot see" dogroup.update!(visibility_level: Group.visibility_levels[:owners])put "/groups/#{group.id}.json", params: { group: { name: "testing" } }@@ -1689,7 +1689,7 @@ RSpec.describe GroupsController doexpect(response.status).to eq(403)end- it "should be able to update the group" do+ it "updates the group" doput "/groups/#{group.id}.json",params: {group: {@@ -1768,7 +1768,7 @@ RSpec.describe GroupsController doexpect(group.allow_unknown_sender_topic_replies).to eq(false)end- it "should be able to update an automatic group" do+ it "updates an automatic group" dogroup = Group.find(Group::AUTO_GROUPS[:trust_level_4])group.update!(mentionable_level: 2, messageable_level: 2, default_notification_level: 2)@@ -1812,7 +1812,7 @@ RSpec.describe GroupsController doendcontext "when user is not a group owner or admin" do- it "should not be able to update the group" do+ it "does not update the group" dosign_in(user)put "/groups/#{group.id}.json", params: { group: { name: "testing" } }@@ -1822,7 +1822,7 @@ RSpec.describe GroupsController doendend- describe "#members" do+ describe "#members listing" dolet(:user1) doFabricate(:user, last_seen_at: Time.zone.now, last_posted_at: 1.day.ago, email: "[email protected]")end@@ -1836,7 +1836,7 @@ RSpec.describe GroupsController dofab!(:bot)let(:group) { Fabricate(:group, users: [user1, user2, user3, bot]) }- it "should allow members to be sorted by" do+ it "allows members to be sorted by supported columns" doget "/groups/#{group.name}/members.json", params: { order: "last_seen_at" }expect(response.status).to eq(200)@@ -1862,7 +1862,7 @@ RSpec.describe GroupsController doexpect(members.map { |m| m["id"] }).to eq([user2.id, user1.id, user3.id])end- it "should not allow members to be sorted by columns that are not allowed" do+ it "rejects unsupported sort columns" doget "/groups/#{group.name}/members.json", params: { order: "email" }expect(response.status).to eq(200)@@ -1888,7 +1888,7 @@ RSpec.describe GroupsController dodescribe "filterable" dodescribe "as a normal user" do- it "should not allow members to be filterable by email" do+ it "does not allow filtering members by email" doemail = "[email protected]"user1.update!(email: email)@@ -1903,7 +1903,7 @@ RSpec.describe GroupsController dodescribe "as an admin" dobefore { sign_in(admin) }- it "should allow members to be filterable by username" do+ it "allows filtering members by username" doemail = "[email protected]"user1.update!(email: email)@@ -1920,7 +1920,7 @@ RSpec.describe GroupsController doendend- it "should allow members to be filterable by email" do+ it "allows filtering members by email" dousername = "uniquetest"user1.update!(username: username)@@ -1940,7 +1940,7 @@ RSpec.describe GroupsController dofab!(:group)context "when user is not signed in" do- it "should be forbidden" do+ it "returns a forbidden response" doput "/groups/#{group.id}/members.json", params: { usernames: "bob" }expect(response).to be_forbidden@@ -1949,7 +1949,7 @@ RSpec.describe GroupsController doendcontext "with public group" do- it "should be forbidden" do+ it "returns a forbidden response" dogroup.update!(public_admission: true, public_exit: true)put "/groups/#{group.id}/members.json", params: { usernames: "bob" }@@ -2262,7 +2262,7 @@ RSpec.describe GroupsController doendend- it "will send invites to each email with group_id set" do+ it "sends invitations to each email with group_id set" doemails = %w[[email protected] [email protected]]put "/groups/#{group.id}/members.json", params: { emails: emails.join(",") }@@ -2289,7 +2289,7 @@ RSpec.describe GroupsController doexpect(response.status).to eq(200)end- it "will find users by email, and invite the correct user" do+ it "finds users by email and invites the matching user" donew_user = Fabricate(:user)expect(new_user.group_ids.include?(group.id)).to eq(false)@@ -2298,7 +2298,7 @@ RSpec.describe GroupsController doexpect(new_user.reload.group_ids.include?(group.id)).to eq(true)end- it "will invite the user if their username and email are both invited" do+ it "invites the user once when both username and email are supplied" donew_user = Fabricate(:user)put "/groups/#{group.id}/members.json",params: {@@ -2334,7 +2334,7 @@ RSpec.describe GroupsController docontext "when logged in as an admin" dobefore { sign_in(admin) }- it "should work" do+ it "invites the user to the group" doput "/groups/#{group.id}/owners.json",params: {usernames: [user.username, admin.username].join(","),@@ -2492,7 +2492,7 @@ RSpec.describe GroupsController dodescribe "#join" dolet(:public_group) { Fabricate(:public_group) }- it "should allow a user to join a public group" do+ it "allows a user to join a public group" dosign_in(user)expect do put "/groups/#{public_group.id}/join.json" end.to change {@@ -2502,7 +2502,7 @@ RSpec.describe GroupsController doexpect(response.status).to eq(204)end- it "should not allow a user to join a public group they cannot see" do+ it "does not allow joining a hidden public group" dohidden_group =Fabricate(:public_group,@@ -2523,7 +2523,7 @@ RSpec.describe GroupsController doexpect(user.reload.trust_level).to eq(TrustLevel[0])end- it "should not allow a user to join a nonpublic group" do+ it "does not allow joining a nonpublic group" dosign_in(user)expect do put "/groups/#{group.id}/join.json" end.not_to change { group.users.count }@@ -2531,7 +2531,7 @@ RSpec.describe GroupsController doexpect(response).to be_forbiddenend- it "should not allow an anonymous user to call the join method" do+ it "does not allow an anonymous user to join" doexpect do put "/groups/#{group.id}/join.json" end.not_to change { group.users.count }expect(response).to be_forbidden@@ -2638,7 +2638,7 @@ RSpec.describe GroupsController doendend- it "should not allow a underprivileged user to leave a group for another user" do+ it "does not allow an underprivileged user to remove another member" dosign_in(user)delete "/groups/#{group.id}/members.json", params: { username: other_user.username }@@ -2715,7 +2715,7 @@ RSpec.describe GroupsController dodescribe "#leave" dolet(:group_with_public_exit) { Fabricate(:group, public_exit: true, users: [user]) }- it "should allow a user to leave a group with public exit" do+ it "allows a user to leave a group with public exit" dosign_in(user)expect do delete "/groups/#{group_with_public_exit.id}/leave.json" end.to change {@@ -2725,7 +2725,7 @@ RSpec.describe GroupsController doexpect(response.status).to eq(204)end- it "should not allow a user to leave a group without public exit" do+ it "does not allow leaving a group without public exit" dosign_in(user)expect do delete "/groups/#{group.id}/leave.json" end.not_to change { group.users.count }@@ -2733,7 +2733,7 @@ RSpec.describe GroupsController doexpect(response).to be_forbiddenend- it "should not allow an anonymous user to call the leave method" do+ it "does not allow an anonymous user to leave" doexpect do delete "/groups/#{group_with_public_exit.id}/leave.json" end.not_to change {group_with_public_exit.users.count}@@ -2874,7 +2874,7 @@ RSpec.describe GroupsController dodescribe "#histories" docontext "when user is not signed in" do- it "should raise the right error" do+ it "raises the expected error" doget "/groups/#{group.name}/logs.json"expect(response.status).to eq(403)end@@ -2883,7 +2883,7 @@ RSpec.describe GroupsController docontext "when user is not a group owner" dobefore { sign_in(user) }- it "should be forbidden" do+ it "returns a forbidden response" doget "/groups/#{group.name}/logs.json"expect(response).to be_forbidden@@ -2903,7 +2903,7 @@ RSpec.describe GroupsController doGroupActionLogger.new(user, group).log_change_group_settingsend- it "should allow group owner to view history" do+ it "allows a group owner to view history" doget "/groups/#{group.name}/logs.json"expect(response.status).to eq(200)@@ -2940,7 +2940,7 @@ RSpec.describe GroupsController doendend- it "should not be allowed to view history of an automatic group" do+ it "does not allow viewing an automatic group's history" dogroup = Group.find_by(id: Group::AUTO_GROUPS[:admins])get "/groups/#{group.name}/logs.json"@@ -2952,7 +2952,7 @@ RSpec.describe GroupsController docontext "when user is an admin" dobefore { sign_in(admin) }- it "should be able to view history" do+ it "returns the group history" doGroupActionLogger.new(admin, group).log_remove_user_from_group(user)get "/groups/#{group.name}/logs.json"@@ -2964,7 +2964,7 @@ RSpec.describe GroupsController doexpect(result["action"]).to eq(GroupHistory.actions[3].to_s)end- it "should be able to view history of automatic groups" do+ it "returns history for automatic groups" dogroup = Group.find_by(id: Group::AUTO_GROUPS[:admins])get "/groups/#{group.name}/logs.json"@@ -2972,7 +2972,7 @@ RSpec.describe GroupsController doexpect(response.status).to eq(200)end- it "should be able to filter through the history" do+ it "filters the group history" doGroupActionLogger.new(admin, group).log_add_user_to_group(user)GroupActionLogger.new(admin, group).log_remove_user_from_group(user)@@ -3055,7 +3055,7 @@ RSpec.describe GroupsController do)end- it "should create the right PM" do+ it "creates the expected private message" doowner1 = Fabricate(:user, last_seen_at: Time.zone.now)owner2 = Fabricate(:user, last_seen_at: 1.day.ago)[owner1, owner2].each { |owner| group.add_owner(owner) }@@ -3255,7 +3255,7 @@ RSpec.describe GroupsController dodescribe "#new" dodescribe "for an anon user" do- it "should return 404" do+ it "returns 404" doget "/groups/custom/new"expect(response.status).to eq(404)@@ -3265,7 +3265,7 @@ RSpec.describe GroupsController dodescribe "for a normal user" dobefore { sign_in(user) }- it "should return 404" do+ it "returns 404" doget "/groups/custom/new"expect(response.status).to eq(404)@@ -3275,7 +3275,7 @@ RSpec.describe GroupsController dodescribe "for an admin user" dobefore { sign_in(admin) }- it "should return 200" do+ it "returns 200" doget "/groups/custom/new"expect(response.status).to eq(200)@@ -3285,13 +3285,13 @@ RSpec.describe GroupsController dodescribe "#check_name" dodescribe "for an anon user" do- it "should return the right response" do+ it "returns the expected response" doget "/groups/check-name.json", params: { group_name: "test" }expect(response.status).to eq(403)endend- it "should return the right response" do+ it "returns the expected response" dosign_in(Fabricate(:user))SiteSetting.reserved_usernames = "test|donkey"get "/groups/check-name.json", params: { group_name: "test" }diff --git a/spec/requests/hashtags_controller_spec.rb b/spec/requests/hashtags_controller_spec.rbindex e342c0b9a28..b81a5b29cb1 100644--- a/spec/requests/hashtags_controller_spec.rb+++ b/spec/requests/hashtags_controller_spec.rb@@ -300,7 +300,7 @@ RSpec.describe HashtagsController dosign_in(Fabricate(:user))end- it "works" do+ it "resolves hashtags for deeply nested categories" dofoo = Fabricate(:category_with_definition, slug: "foo")foobar = Fabricate(:category_with_definition, slug: "bar", parent_category_id: foo.id)foobarbaz =diff --git a/spec/requests/home_page_controller_spec.rb b/spec/requests/home_page_controller_spec.rbindex 148bf2a41d1..bbde504f039 100644--- a/spec/requests/home_page_controller_spec.rb+++ b/spec/requests/home_page_controller_spec.rb@@ -8,7 +8,7 @@ RSpec.describe HomePageController doSiteSetting.has_login_hint = falseend- it "should display the menu by default" do+ it "displays the menu by default" doget "/custom", headers: { "HTTP_USER_AGENT" => "Googlebot" }expect(response.status).to eq(200)@@ -26,7 +26,7 @@ RSpec.describe HomePageController doendend- it "should allow plugin to override output" do+ it "allows a plugin to override the output" doplugin =plugin_class.new(nil,@@ -52,7 +52,7 @@ RSpec.describe HomePageController doendend- it "should display the site description on the homepage" do+ it "displays the site description on the homepage" doget "/", headers: { "HTTP_USER_AGENT" => "Googlebot" }expect(response.status).to eq(200)@@ -74,7 +74,7 @@ RSpec.describe HomePageController doexpect(response.body).not_to include("crawler-view-anon-menu")end- it "should not display the site description on another route" do+ it "does not display the site description on another route" doget "/top", headers: { "HTTP_USER_AGENT" => "Googlebot" }expect(response.status).to eq(200)diff --git a/spec/requests/invites_controller_spec.rb b/spec/requests/invites_controller_spec.rbindex c8833e4688b..cac75f4071a 100644--- a/spec/requests/invites_controller_spec.rb+++ b/spec/requests/invites_controller_spec.rb@@ -412,7 +412,7 @@ RSpec.describe InvitesController docontext "with invite to topic" dofab!(:topic)- it "works" do+ it "enqueues an email invitation to the topic" dosign_in(user)post "/invites.json",@@ -571,7 +571,7 @@ RSpec.describe InvitesController docontext "when validations fail" dolet(:email) { "[email protected]" }- it "fails" do+ it "returns validation errors for a blocked email domain" docreate_inviteexpect(response).to have_http_status :unprocessable_entityexpect(response.parsed_body["errors"]).to be_present@@ -581,7 +581,7 @@ RSpec.describe InvitesController docontext "when email address is too long" dolet(:email) { "a" * 495 + "@example.com" }- it "fails" do+ it "returns a validation error for an excessively long email address" docreate_inviteexpect(response).to have_http_status :unprocessable_entityexpect(response.parsed_body["errors"]).to be_present@@ -618,7 +618,7 @@ RSpec.describe InvitesController doendcontext "with domain invite" do- it "works" do+ it "creates a domain invitation" dosign_in(admin)post "/invites.json", params: { domain: "example.com" }@@ -912,7 +912,7 @@ RSpec.describe InvitesController doendcontext "with link invite" do- it "works" do+ it "creates a single-use link invitation without an email" dosign_in(admin)post "/invites.json"@@ -1006,7 +1006,7 @@ RSpec.describe InvitesController docontext "with invite to topic" dofab!(:topic)- it "works" do+ it "enqueues topic invitation emails through the multiple-invite endpoint" dosign_in(admin)post "/invites/create-multiple.json",@@ -1477,7 +1477,7 @@ RSpec.describe InvitesController doOmniAuth.config.test_mode = falseend- it "should associate the invited user with authenticator records" do+ it "associates the invited user with authenticator records" doSiteSetting.auth_overrides_name = trueinvite.update!(email: authenticated_email)diff --git a/spec/requests/list_controller_spec.rb b/spec/requests/list_controller_spec.rbindex 81b2f942a41..257d1d8e046 100644--- a/spec/requests/list_controller_spec.rb+++ b/spec/requests/list_controller_spec.rb@@ -28,12 +28,12 @@ RSpec.describe ListController doendcontext "when params are invalid" do- it "should return a 400 response when `page` param is a string that represent a negative integer" do+ it "returns 400 when page is a negative integer string" doget "/latest?page=-1"expect(response.status).to eq(400)end- it "should return a 400 response when `page` param is a string larger than maximum integer value" do+ it "returns 400 when page exceeds the maximum integer" doget "/latest?page=2147483648"expect(response.status).to eq(400)@@ -41,117 +41,117 @@ RSpec.describe ListController doexpect(response.status).to eq(400)end- it "should return a 400 response when `before` param is not a string represetning an integer" do+ it "returns 400 when before is not an integer string" doget "/latest?before[1]=haxx"expect(response.status).to eq(400)end- it "should return a 400 response when `bumped_before` param is not a string representing an integer" do+ it "returns 400 when bumped_before is not an integer string" doget "/latest?bumped_before[1]=haxx"expect(response.status).to eq(400)end- it "should return a 400 response when `topic_ids` param is not a string representing an integer" do+ it "returns 400 when topic_ids is not an integer string" doget "/latest?topic_ids[1]=haxx"expect(response.status).to eq(400)end- it "should return a 400 response when `category` param is not a string representing an integer" do+ it "returns 400 when category is not an integer string" doget "/latest?category[1]=haxx"expect(response.status).to eq(400)end- it "should return a 400 response when `order` param is not a string" do+ it "returns 400 when order is not a string" doget "/latest?order[1]=haxx"expect(response.status).to eq(400)end- it "should return a 400 response when `ascending` param is not a string that is either `true` or `false`" do+ it "returns 400 when ascending is not a boolean string" doget "/latest?ascending=maybe"expect(response.status).to eq(400)end- it "should return a 400 response when `min_posts` param is a string that does not represent an integer" do+ it "returns 400 when min_posts is not an integer string" doget "/latest?min_posts=bob"expect(response.status).to eq(400)end- it "should return a 400 response when `max_posts` param is a string that does not represent an integer" do+ it "returns 400 when max_posts is not an integer string" doget "/latest?max_posts=bob"expect(response.status).to eq(400)end- it "should return a 400 response when `max_posts` param is a string larger than maximum integer value" do+ it "returns 400 when max_posts exceeds the maximum integer" doget "/latest?max_posts=1111111111111111111111111111111111111111"expect(response.status).to eq(400)end- it "should return a 400 response when `status` param is not a string" do+ it "returns 400 when status is not a string" doget "/latest?status%5Bsomehash%5D=something"expect(response.status).to eq(400)end- it "should return a 400 response when `filter` param is not a string" do+ it "returns 400 when the list filter is not a string" doget "/latest?filter%5Bsomehash%5D=something"expect(response.status).to eq(400)end- it "should return a 400 response when `state` param is not a string" do+ it "returns 400 when state is not a string" doget "/latest?state%5Bsomehash%5D=something"expect(response.status).to eq(400)end- it "should return a 400 response when `search` param is not a string" do+ it "returns 400 when search is not a string" doget "/latest?search%5Bsomehash%5D=something"expect(response.status).to eq(400)end- it "should return a 400 response when `q` param is not a string" do+ it "returns 400 when q is not a string" doget "/latest?q%5Bsomehash%5D=something"expect(response.status).to eq(400)end- it "should return a 400 response when `f` param is not a string" do+ it "returns 400 when f is not a string" doget "/latest?f%5Bsomehash%5D=something"expect(response.status).to eq(400)end- it "should return a 400 response when `subset` param is not a string" do+ it "returns 400 when subset is not a string" doget "/latest?subset%5Bsomehash%5D=something"expect(response.status).to eq(400)end- it "should return a 400 response when `group_name` param is not a string" do+ it "returns 400 when group_name is not a string" doget "/latest?group_name%5Bsomehash%5D=something"expect(response.status).to eq(400)end- it "should return a 400 response when `tags` param is not an array or string" do+ it "returns 400 when tags is neither an array nor a string" doget "/latest?tags[1]=hello"expect(response.status).to eq(400)end- it "should return a 400 response when `filter` param is not a string" do+ it "returns 400 when the user filter is not a string" doget "/latest?filter%5Bsomehash%5D=something"expect(response.status).to eq(400)end- it "should return a 400 response when `match_all_tags` param is not a string that is either `true` or `false`" do+ it "returns 400 when match_all_tags is not a boolean string" doget "/latest?match_all_tags=something"expect(response.status).to eq(400)end- it "should return a 400 response when `no_subcategories` param is not a string that is either `true` or `false`" do+ it "returns 400 when no_subcategories is not a boolean string" doget "/latest?no_subcategories=something"expect(response.status).to eq(400)end- it "should return a 400 response when `no_tags` param is not a string that is either `true` or `false`" do+ it "returns 400 when no_tags is not a boolean string" doget "/latest?no_tags=something"expect(response.status).to eq(400)end- it "should return a 400 response when `exclude_tag` param is not a string" do+ it "returns 400 when exclude_tag is not a string" doget "/latest?exclude_tag%5Bsomehash%5D=something"expect(response.status).to eq(400)end@@ -191,7 +191,7 @@ RSpec.describe ListController do(Discourse.anonymous_filters - [:categories]).each do |filter|context "with #{filter}" do- it "succeeds" do+ it "returns the requested list" doget "/#{filter}"expect(response.status).to eq(200)end@@ -500,13 +500,13 @@ RSpec.describe ListController doFabricate(:topic_tag, tag: tag, topic: private_message)end- it "should fail for non-staff users" do+ it "fails for non-staff users" dosign_in(user)get "/topics/private-messages-tags/#{user.username}/#{tag.name}.json"expect(response.status).to eq(404)end- it "should fail for staff users if empty" do+ it "fails for staff users when empty" doSiteSetting.pm_tags_allowed_for_groups = ""[moderator, admin].each do |user|@@ -516,7 +516,7 @@ RSpec.describe ListController doendend- it "should be success for staff users" do+ it "succeeds for staff users" do[moderator, admin].each do |user|sign_in(user)get "/topics/private-messages-tags/#{user.username}/#{tag.name}.json"@@ -524,7 +524,7 @@ RSpec.describe ListController doendend- it "should work for tag with unicode name" do+ it "supports a tag with a Unicode name" dounicode_tag = Fabricate(:tag, name: "hello-🇺🇸")Fabricate(:topic_tag, tag: unicode_tag, topic: private_message)@@ -534,7 +534,7 @@ RSpec.describe ListController doexpect(response.parsed_body["topic_list"]["topics"].first["id"]).to eq(private_message.id)end- it "should work for users who are allowed and direct links" do+ it "supports direct links for authorized users" doSiteSetting.pm_tags_allowed_for_groups = group.namegroup.add(user)sign_in(user)@@ -593,7 +593,7 @@ RSpec.describe ListController doSiteSetting.personal_message_enabled_groups = Group::AUTO_GROUPS[:staff]end- it "should display group private messages for an admin" do+ it "displays group private messages for an admin" dosign_in(Fabricate(:admin))get "/topics/private-messages-group/#{user.username}/#{group.name}.json"@@ -603,7 +603,7 @@ RSpec.describe ListController doexpect(response.parsed_body["topic_list"]["topics"].first["id"]).to eq(topic.id)end- it "should display moderator group private messages for a moderator" do+ it "displays moderator-group private messages for a moderator" domoderator = Fabricate(:moderator)group = Group.find(Group::AUTO_GROUPS[:moderators])Fabricate(:private_message_topic, allowed_groups: [group])@@ -614,7 +614,7 @@ RSpec.describe ListController doexpect(response.status).to eq(200)end- it "should not display group private messages for a moderator's group" do+ it "does not display private messages for a moderator's group" domoderator = Fabricate(:moderator)sign_in(moderator)@@ -623,7 +623,7 @@ RSpec.describe ListController doexpect(response.status).to eq(404)end- it "should sort group private messages by posts_count" do+ it "sorts group private messages by posts_count" dotopic2 = Fabricate(:private_message_topic, allowed_groups: [group])topic3 = Fabricate(:private_message_topic, allowed_groups: [group])2.times { Fabricate(:post, topic: topic2) }@@ -643,14 +643,14 @@ RSpec.describe ListController doendend- describe "with unicode_usernames" do+ describe "with unicode_usernames disabled" dobefore dogroup.add(user)sign_in(user)SiteSetting.unicode_usernames = falseend- it "should return the right response when user does not belong to group" do+ it "returns not found when the user does not belong to the group" doFabricate(:private_message_topic, allowed_groups: [group])group.remove(user)@@ -660,7 +660,7 @@ RSpec.describe ListController doexpect(response.status).to eq(404)end- it "should return the right response" do+ it "returns the group's private messages" dotopic = Fabricate(:private_message_topic, allowed_groups: [group])get "/topics/private-messages-group/#{user.username}/awesomegroup.json"@@ -670,7 +670,7 @@ RSpec.describe ListController doendend- describe "with unicode_usernames" do+ describe "with unicode_usernames enabled" dobefore dosign_in(user)SiteSetting.unicode_usernames = true@@ -702,7 +702,7 @@ RSpec.describe ListController dolet!(:another_topic) { Fabricate(:topic) }describe "when an invalid group name is given" do- it "should return the right response" do+ it "returns the expected response" doget "/topics/groups/something.json"expect(response.status).to eq(404)@@ -711,7 +711,7 @@ RSpec.describe ListController dodescribe "for an anon user" dodescribe "public visible group" do- it "should return the right response" do+ it "returns the expected response" doget "/topics/groups/#{group.name}.json"expect(response.status).to eq(200)@@ -722,7 +722,7 @@ RSpec.describe ListController dodescribe "group restricted to logged-on-users" dobefore { group.update!(visibility_level: Group.visibility_levels[:logged_on_users]) }- it "should return the right response" do+ it "returns the expected response" doget "/topics/groups/#{group.name}.json"expect(response.status).to eq(403)@@ -732,7 +732,7 @@ RSpec.describe ListController dodescribe "restricted group" dobefore { group.update!(visibility_level: Group.visibility_levels[:staff]) }- it "should return the right response" do+ it "returns the expected response" doget "/topics/groups/#{group.name}.json"expect(response.status).to eq(403)@@ -744,7 +744,7 @@ RSpec.describe ListController dogroup.update!(members_visibility_level: Group.visibility_levels[:logged_on_users])end- it "should return the right response" do+ it "returns the expected response" doget "/topics/groups/#{group.name}.json"expect(response.status).to eq(403)@@ -758,7 +758,7 @@ RSpec.describe ListController dodescribe "restricted group" dobefore { group.update!(visibility_level: Group.visibility_levels[:staff]) }- it "should return the right response" do+ it "returns the expected response" doget "/topics/groups/#{group.name}.json"expect(response.status).to eq(403)@@ -768,7 +768,7 @@ RSpec.describe ListController dodescribe "group restricted to logged-on-users" dobefore { group.update!(visibility_level: Group.visibility_levels[:logged_on_users]) }- it "should return the right response" do+ it "returns the expected response" doget "/topics/groups/#{group.name}.json"expect(response.status).to eq(200)@@ -779,7 +779,7 @@ RSpec.describe ListController dodescribe "for a group user" dobefore { sign_in(user) }- it "should be able to view the topics started by group users" do+ it "allows viewing topics started by group members" doget "/topics/groups/#{group.name}.json"expect(response.status).to eq(200)@@ -1025,7 +1025,7 @@ RSpec.describe ListController doendcontext "with access to see the category" do- it "succeeds" do+ it "returns the category list" doget "/c/#{category.slug}/#{category.id}/l/latest"expect(response.status).to eq(200)end@@ -1036,7 +1036,7 @@ RSpec.describe ListController dobefore { SiteSetting.slug_generation_method = "encoded" }- it "succeeds" do+ it "returns the encoded-slug category list" doget "/c/#{category.slug}/#{category.id}/l/latest"expect(response.status).to eq(200)end@@ -1046,7 +1046,7 @@ RSpec.describe ListController dolet(:child_category) { Fabricate(:category_with_definition, parent_category: category) }context "with valid slug" do- it "succeeds" do+ it "returns the child-category list" doget "/c/#{category.slug}/#{child_category.slug}/#{child_category.id}/l/latest"expect(response.status).to eq(200)end@@ -1083,7 +1083,7 @@ RSpec.describe ListController dolet(:sub_category) { Fabricate(:category_with_definition, parent_category_id: category.id) }context "when parent and child are requested" do- it "succeeds" do+ it "returns the nested child-category list" doget "/c/#{category.slug}/#{sub_category.slug}/#{sub_category.id}/l/latest"expect(response.status).to eq(200)end@@ -1307,14 +1307,14 @@ RSpec.describe ListController dosign_in(user2)end- it "should respond with a list" do+ it "responds with a list" doget "/topics/created-by/#{user.username}.json"expect(response.status).to eq(200)json = response.parsed_bodyexpect(json["topic_list"]["topics"].size).to eq(2)end- it "should work with period in username" do+ it "supports a period in the username" douser.update!(username: "myname.test")get "/topics/created-by/#{user.username}", xhr: trueexpect(response.status).to eq(200)@@ -1325,7 +1325,7 @@ RSpec.describe ListController docontext "with unicode usernames" dobefore { SiteSetting.unicode_usernames = true }- it "should return the more_topics_url in the encoded form" do+ it "returns more_topics_url in encoded form" dostub_const(TopicQuery, "DEFAULT_PER_PAGE_COUNT", 1) douser.update!(username: "快快快")@@ -1350,7 +1350,7 @@ RSpec.describe ListController doexpect(response.status).to eq(404)end- it "should respond with a list when `allow_users_to_hide_profile` is false" do+ it "responds with a list when profile hiding is disabled" doSiteSetting.allow_users_to_hide_profile = falseget "/topics/created-by/#{user.username}.json"expect(response.status).to eq(200)@@ -1533,7 +1533,7 @@ RSpec.describe ListController doendcontext "when logged in" do- it "succeeds" do+ it "returns the read-topic list" dosign_in(user)get "/read"expect(response.status).to eq(200)@@ -1542,7 +1542,7 @@ RSpec.describe ListController doenddescribe "best_periods_for" do- it "works" do+ it "returns the applicable best periods" doexpect(ListController.best_periods_for(nil)).to eq([:all])expect(ListController.best_periods_for(5.years.ago)).to eq([:all])expect(ListController.best_periods_for(2.years.ago)).to eq(%i[yearly all])@@ -1759,7 +1759,7 @@ RSpec.describe ListController dofab!(:topic_in_private_category) { Fabricate(:topic, category: private_category) }fab!(:user2, :user)- it "should not return topics that the user is not allowed to view" do+ it "does not return topics the user cannot view" dosign_in(user)get "/filter.json"@@ -1771,7 +1771,7 @@ RSpec.describe ListController do).to contain_exactly(topic.id)end- it "should not return topics that an anon user is not allowed to view" do+ it "does not return topics an anonymous user cannot view" doget "/filter.json"expect(response.status).to eq(200)@@ -1815,7 +1815,7 @@ RSpec.describe ListController do).to contain_exactly(topic.id)end- it "should accept the `page` query parameter" do+ it "accepts the page query parameter" dotopic_with_tag = Fabricate(:topic, tags: [tag])topic2_with_tag = Fabricate(:topic, tags: [tag])@@ -1880,7 +1880,7 @@ RSpec.describe ListController doendend- it "should include filter_option_info in the response" do+ it "includes filter_option_info in the response" doget "/filter.json"parsed = response.parsed_bodyexpect(response.status).to eq(200)@@ -1889,7 +1889,7 @@ RSpec.describe ListController do)end- it "should filter with tag_group option" do+ it "filters with the tag_group option" dotopic_with_tag = Fabricate(:topic, tags: [tag])topic2_with_tag = Fabricate(:topic, tags: [tag])tag_group = Fabricate(:tag_group, tags: [tag])@@ -2308,7 +2308,7 @@ RSpec.describe ListController doendend- it "should not have N+1s when loading localizations" do+ it "does not issue N+1 queries while loading localizations" doFabricate.times(5, :topic, category:, locale: "en")Topic.all.each { |t| Fabricate(:topic_localization, topic: t, locale: "ja") }diff --git a/spec/requests/net_http_header_spec.rb b/spec/requests/net_http_header_spec.rbindex ce96a88cdaf..7b8de2ca660 100644--- a/spec/requests/net_http_header_spec.rb+++ b/spec/requests/net_http_header_spec.rb@@ -2,7 +2,7 @@# We can use the redeliver event to test the user-agent headerRSpec.describe "Net::HTTPHeader sets a default user-agent" do- it "should set a user-agent when none has been set" do+ it "sets a User-Agent when none is present" doget "/test_net_http_headers.json"expect(response).to have_http_status(:success)diff --git a/spec/requests/net_http_timeout_spec.rb b/spec/requests/net_http_timeout_spec.rbindex 350d489af81..d56e6f59473 100644--- a/spec/requests/net_http_timeout_spec.rb+++ b/spec/requests/net_http_timeout_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe "Net::HTTP timeouts when processing a request" do- it "should set the right timeouts for any `Net::HTTP` instances initialized while processing a request" do+ it "sets timeouts on Net::HTTP instances initialized during a request" dostub_const(NetHTTPPatch, :OPEN_TIMEOUT, 0.001) dostub_const(NetHTTPPatch, :READ_TIMEOUT, 0.002) dostub_const(NetHTTPPatch, :WRITE_TIMEOUT, 0.003) dodiff --git a/spec/requests/notifications_controller_spec.rb b/spec/requests/notifications_controller_spec.rbindex 8613ab53f34..dd999bfefa7 100644--- a/spec/requests/notifications_controller_spec.rb+++ b/spec/requests/notifications_controller_spec.rb@@ -38,12 +38,12 @@ RSpec.describe NotificationsController doenddescribe "#index" do- it "should succeed for recent" do+ it "returns recent notifications" doget "/notifications", params: { recent: true }expect(response.status).to eq(200)end- it "should succeed for history" do+ it "returns notification history" doget "/notifications.json"expect(response.status).to eq(200)@@ -54,7 +54,7 @@ RSpec.describe NotificationsController doexpect(notifications.first["id"]).to eq(notification.id)end- it "should mark notifications as viewed" do+ it "marks notifications as viewed" doexpect(user.reload.unread_notifications).to eq(1)expect(user.reload.total_unread_notifications).to eq(1)@@ -65,7 +65,7 @@ RSpec.describe NotificationsController doexpect(user.reload.total_unread_notifications).to eq(1)end- it "should not mark notifications as viewed if silent param is present" do+ it "does not mark notifications viewed with the silent parameter" doexpect(user.reload.unread_notifications).to eq(1)expect(user.reload.total_unread_notifications).to eq(1)@@ -76,7 +76,7 @@ RSpec.describe NotificationsController doexpect(user.reload.total_unread_notifications).to eq(1)end- it "should not mark notifications as viewed in readonly mode" do+ it "does not mark notifications viewed in read-only mode" doDiscourse.received_redis_readonly!expect(user.reload.unread_notifications).to eq(1)expect(user.reload.total_unread_notifications).to eq(1)@@ -206,7 +206,7 @@ RSpec.describe NotificationsController do)end- it "should not bump last seen reviewable in readonly mode" do+ it "does not update the last-seen reviewable in read-only mode" douser.update!(admin: true)Discourse.received_redis_readonly!@@ -219,14 +219,14 @@ RSpec.describe NotificationsController doDiscourse.clear_redis_readonly!end- it "should not bump last seen reviewable if the user can't see reviewables" do+ it "does not update the last-seen reviewable without review access" doexpect {get "/notifications.json", params: { recent: true, bump_last_seen_reviewable: true }expect(response.status).to eq(200)}.not_to change { user.reload.last_seen_reviewable_id }end- it "should not bump last seen reviewable if the silent param is present" do+ it "does not update the last-seen reviewable with the silent parameter" douser.update!(admin: true)expect {@@ -240,7 +240,7 @@ RSpec.describe NotificationsController do}.not_to change { user.reload.last_seen_reviewable_id }end- it "should not bump last seen reviewable if the bump_last_seen_reviewable param is not present" do+ it "does not update the last-seen reviewable without the bump parameter" douser.update!(admin: true)expect {@@ -373,7 +373,7 @@ RSpec.describe NotificationsController doendcontext "when username params is not valid" do- it "should raise the right error" do+ it "returns the permission error" doget "/notifications.json", params: { username: "somedude" }expect(response.status).to eq(404)end@@ -586,7 +586,7 @@ RSpec.describe NotificationsController doendend- it "should succeed" do+ it "marks every notification as read" doput "/notifications/mark-read.json"expect(response.status).to eq(200)end@@ -737,7 +737,7 @@ RSpec.describe NotificationsController docontext "when not logged in" dodescribe "#index" do- it "should raise an error" do+ it "requires authentication" doget "/notifications.json", params: { recent: true }expect(response.status).to eq(403)enddiff --git a/spec/requests/omniauth_callbacks_controller_spec.rb b/spec/requests/omniauth_callbacks_controller_spec.rbindex e70e0854438..5b5f9cca755 100644--- a/spec/requests/omniauth_callbacks_controller_spec.rb+++ b/spec/requests/omniauth_callbacks_controller_spec.rb@@ -154,14 +154,14 @@ RSpec.describe Users::OmniauthCallbacksController doenddescribe "request" do- it "should error for non existant authenticators" do+ it "returns an error for nonexistent authenticators" dopost "/auth/fake_auth"expect(response.status).to eq(404)get "/auth/fake_auth"expect(response.status).to eq(403)end- it "should error for disabled authenticators" do+ it "returns an error for disabled authenticators" doSiteSetting.enable_google_oauth2_logins = falsepost "/auth/google_oauth2"expect(response.status).to eq(404)@@ -169,7 +169,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(response.status).to eq(403)end- it "should handle common errors" do+ it "handles common authentication errors" doOmniAuth::Strategies::GoogleOauth2.any_instance.stubs(:mock_request_call)@@ -194,7 +194,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(response.location).to include("/auth/failure?message=invalid_iat")end- it "should only start auth with a POST request" do+ it "starts authentication only through a POST request" dopost "/auth/google_oauth2"expect(response.status).to eq(302)get "/auth/google_oauth2"@@ -205,7 +205,7 @@ RSpec.describe Users::OmniauthCallbacksController dobefore { ActionController::Base.allow_forgery_protection = true }after { ActionController::Base.allow_forgery_protection = false }- it "should be CSRF protected" do+ it "requires CSRF protection" dopost "/auth/google_oauth2"expect(response.status).to eq(302)expect(response.location).to include("/auth/failure?message=csrf_detected")@@ -221,7 +221,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(response.status).to eq(302)end- it "should not be CSRF protected if it is the only auth method" do+ it "allows authentication without CSRF protection when it is the only method" doget "/auth/google_oauth2"expect(response.status).to eq(200)SiteSetting.enable_local_logins = false@@ -229,7 +229,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(response.status).to eq(302)end- it "should not be CSRF protected if the setting has been disabled" do+ it "allows authentication without CSRF protection when disabled in settings" doSiteSetting.auth_require_interaction = falseSiteSetting.enable_local_logins = trueget "/auth/google_oauth2"@@ -287,7 +287,7 @@ RSpec.describe Users::OmniauthCallbacksController doendcontext "without an `omniauth.auth` env" do- it "should return a 404" do+ it "returns 404" doget "/auth/eviltrout/callback"expect(response.code).to eq("404")end@@ -300,7 +300,7 @@ RSpec.describe Users::OmniauthCallbacksController dobefore { mock_auth(email, username, name) }- it "should return the right response" do+ it "redirects with authentication details for the new user" dodestination_url = "/somepath"Rails.application.env_config["omniauth.origin"] = destination_url@@ -326,7 +326,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(data["destination_url"]).to eq(destination_url)end- it "should return the right response for staged users" do+ it "redirects with authentication details for staged users" doFabricate(:user, username: username, email: email, staged: true)destination_url = "/somepath"@@ -354,7 +354,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(data["destination_url"]).to eq(destination_url)end- it "should include destination url in response" do+ it "includes the destination URL in the response" dodestination_url = "/cookiepath"cookies[:destination_url] = destination_url@@ -364,7 +364,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(data["destination_url"]).to eq(destination_url)end- it "should return an associate url when multiple login methods are enabled" do+ it "returns an association URL when multiple login methods are enabled" doget "/auth/google_oauth2/callback.json"expect(response.status).to eq(302)@@ -421,7 +421,7 @@ RSpec.describe Users::OmniauthCallbacksController dodescribe "when site is invite_only" dobefore { SiteSetting.invite_only = true }- it "should return the right response without any origin" do+ it "requires an invitation when no origin is supplied" doget "/auth/google_oauth2/callback.json"expect(response.status).to eq(302)@@ -439,7 +439,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(response.status).to eq(302)end- it "should return the right response when origin is invites page" do+ it "redirects to the invitation page without requiring another invite" doorigin =Rails.application.routes.url_helpers.invite_url(Fabricate(:invite).invite_key,@@ -492,7 +492,7 @@ RSpec.describe Users::OmniauthCallbacksController dobefore { mock_auth(user.email, "Somenickname", "Some name", uid) }- it "should return the right response" do+ it "authenticates the user and confirms their email" doexpect(user.email_confirmed?).to eq(false)events = DiscourseEvent.track_events { get "/auth/google_oauth2/callback.json" }@@ -517,7 +517,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(user.user_auth_tokens.last.authenticated_with_oauth).to be trueend- it "should return the authenticated response with the correct path for subfolders" do+ it "includes the subfolder in the authenticated response path" doset_subfolder "/forum"events = DiscourseEvent.track_events { get "/auth/google_oauth2/callback.json" }@@ -544,7 +544,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(user.email_confirmed?).to eq(true)end- it "should confirm email even when the tokens are expired" do+ it "confirms email even when the tokens are expired" douser.email_tokens.update_all(confirmed: false, expired: true)user.reload@@ -563,7 +563,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(user.email_confirmed?).to eq(true)end- it "should treat a staged user the same as an unregistered user" do+ it "treats a staged user as an unregistered user" douser.update!(staged: true, registration_ip_address: nil)user.reload@@ -601,7 +601,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(user.name).to eq("My new name")end- it "should activate user with matching email" do+ it "activates the user with a matching email" douser.update!(password: "securepassword", active: false, registration_ip_address: "1.1.1.1")user.reload@@ -617,7 +617,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(user.confirm_password?("securepassword")).to eq(false)end- it "should work if the user has no email_tokens, and an invite" do+ it "authenticates an invited user without email tokens" do# Confirming existing email_tokens has a side effect of redeeming invites.# Pretend we don't have any email_tokensuser.email_tokens.destroy_all@@ -631,7 +631,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(invite.reload.invalidated_at).not_to eq(nil)end- it "should update name/username/email when SiteSetting.auth_overrides_* are enabled" do+ it "updates name, username, and email when authentication overrides are enabled" doSiteSetting.email_editable = falseSiteSetting.auth_overrides_email = trueSiteSetting.auth_overrides_name = true@@ -655,7 +655,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(user.name).to eq("Some name")end- it "should preserve username when several users login with the same username" do+ it "preserves usernames when several users log in with the same username" doSiteSetting.auth_overrides_username = true# if several users have username "bill" on the external site,@@ -683,7 +683,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(user.username).to eq("bill3")end- it "will not update email if not verified" do+ it "does not update an unverified email" doSiteSetting.email_editable = falseSiteSetting.auth_overrides_email = true@@ -762,7 +762,7 @@ RSpec.describe Users::OmniauthCallbacksController docontext "when user has TOTP enabled" dobefore { user.create_totp(enabled: true) }- it "should return the right response" do+ it "requires second factor for a user with TOTP enabled" doget "/auth/google_oauth2/callback.json"expect(response.status).to eq(302)@@ -783,7 +783,7 @@ RSpec.describe Users::OmniauthCallbacksController docontext "when user has TOTP enabled but enforce_second_factor_on_external_auth is false" dobefore { user.create_totp(enabled: true) }- it "should return the right response" do+ it "authenticates without TOTP when external authentication is exempt" doSiteSetting.enforce_second_factor_on_external_auth = falseget "/auth/google_oauth2/callback.json"@@ -798,7 +798,7 @@ RSpec.describe Users::OmniauthCallbacksController docontext "when user has security key enabled" dobefore { Fabricate(:user_security_key_with_random_credential, user: user) }- it "should return the right response" do+ it "requires second factor for a user with a security key" doget "/auth/google_oauth2/callback.json"expect(response.status).to eq(302)@@ -837,7 +837,7 @@ RSpec.describe Users::OmniauthCallbacksController domock_auth(user.email, nil, nil, provider_uid)end- it "should return the right response" do+ it "sets the SSO provider destination from the payload cookie" doget "/auth/google_oauth2/callback.json"expect(response.status).to eq(302)@@ -862,7 +862,7 @@ RSpec.describe Users::OmniauthCallbacksController domock_auth(another_email, nil, nil, provider_uid)end- it "should return the right response" do+ it "keeps the user awaiting activation when their email is unverified" doget "/auth/google_oauth2/callback.json"expect(response.status).to eq(302)@@ -1113,7 +1113,7 @@ RSpec.describe Users::OmniauthCallbacksController domock_auth("[email protected]", nil, nil, user1_provider_id)end- it "should not reconnect normally" do+ it "does not reconnect through the normal callback" do# Log in normallypost "/auth/google_oauth2"expect(response.status).to eq(302)@@ -1135,7 +1135,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(UserAssociatedAccount.count).to eq(2)end- it "should redirect to associate URL if parameter supplied" do+ it "redirects to the association URL when supplied" do# Log in normallypost "/auth/google_oauth2?reconnect=true"expect(response.status).to eq(302)@@ -1218,7 +1218,7 @@ RSpec.describe Users::OmniauthCallbacksController doFabricate(:user, username: "staged_user", email: "[email protected]", staged: true)end- it "should use username of the staged user if username is not present in payload" do+ it "keeps the staged user's username when the payload omits it" domock_auth(staged_user.email, nil)get "/auth/google_oauth2/callback.json"@@ -1227,7 +1227,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(data["username"]).to eq(staged_user.username)end- it "should use username of the staged user if username in payload is the same" do+ it "keeps the staged user's username when the payload matches it" do# it's important to check this, because we had regressions# when usernames were changed to the same username with "1" added at the end@@ -1239,7 +1239,7 @@ RSpec.describe Users::OmniauthCallbacksController doexpect(data["username"]).to eq(staged_user.username)end- it "should override username of the staged user if payload contains a new username" do+ it "updates the staged user's username when the payload supplies a new one" donew_username = "new_username"mock_auth(staged_user.email, new_username)diff --git a/spec/requests/permalinks_controller_spec.rb b/spec/requests/permalinks_controller_spec.rbindex de3d9b1b5fb..c1906117e7a 100644--- a/spec/requests/permalinks_controller_spec.rb+++ b/spec/requests/permalinks_controller_spec.rb@@ -15,14 +15,14 @@ RSpec.describe PermalinksController dofab!(:admin)describe "show" do- it "should redirect to a permalink's target_url with status 301" do+ it "redirects permanently to the permalink target URL" doget "/#{permalink.url}"expect(response).to redirect_to(topic.relative_url)expect(response.status).to eq(301)end- it "should work for subfolder installs too" do+ it "redirects correctly for subfolder installations" doset_subfolder "/forum"get "/#{permalink.url}"@@ -31,7 +31,7 @@ RSpec.describe PermalinksController doexpect(response.status).to eq(301)end- it "should apply normalizations" do+ it "normalizes the permalink URL" dopermalink.update!(external_url: "/topic/100", topic_id: nil)SiteSetting.permalink_normalizations = "/(.*)\\?.*/\\1"diff --git a/spec/requests/post_action_users_controller_spec.rb b/spec/requests/post_action_users_controller_spec.rbindex 3a298e4a500..5a1ea1db008 100644--- a/spec/requests/post_action_users_controller_spec.rb+++ b/spec/requests/post_action_users_controller_spec.rb@@ -116,7 +116,7 @@ RSpec.describe PostActionUsersController doexpect(response).to be_forbiddenend- it "succeeds" do+ it "returns 200 when listing users who liked the post" doget "/post_action_users.json",params: {id: post.id,@@ -126,7 +126,7 @@ RSpec.describe PostActionUsersController doexpect(response.status).to eq(200)end- it "will return an unknown attribute for muted users" do+ it "returns an unknown attribute for muted users" domuted_user = Fabricate(:user)PostActionCreator.like(muted_user, post)regular_user = Fabricate(:user)diff --git a/spec/requests/posts_controller_spec.rb b/spec/requests/posts_controller_spec.rbindex f4ab97e0f1d..8f525219736 100644--- a/spec/requests/posts_controller_spec.rb+++ b/spec/requests/posts_controller_spec.rb@@ -11,7 +11,7 @@ RSpec.shared_examples "finding and showing post" doexpect(response).to be_forbiddenend- it "succeeds" do+ it "returns 200 for an accessible post" doget urlexpect(response.status).to eq(200)end@@ -965,7 +965,7 @@ RSpec.describe PostsController doexpect(response.parsed_body["current_revision"]).to eq(2)end- it "won't update bump date if post is a whisper" do+ it "does not update the bump date for whispers" docreated_at = freeze_time 1.day.agopost = Fabricate(:post, post_type: Post.types[:whisper], user: user)@@ -1475,7 +1475,7 @@ RSpec.describe PostsController doexpect(response.status).to eq(200)end- it "will invalidate broken images cache" do+ it "invalidates the broken images cache" dosign_in(moderator)PostHotlinkedMedia.create!(url: "https://example.com/image.jpg",@@ -1761,7 +1761,7 @@ RSpec.describe PostsController doexpect(Draft.get(user, Draft::NEW_TOPIC, 0)).to eq("test")end- it "will raise an error if specified category cannot be found" do+ it "returns an error when the specified category does not exist" douser = Fabricate(:admin)master_key = Fabricate(:api_key).key@@ -1783,7 +1783,7 @@ RSpec.describe PostsController do)end- it "will raise an error if specified embed_url is invalid" do+ it "returns an error when embed_url is invalid" douser = Fabricate(:admin)master_key = Fabricate(:api_key).key@@ -2428,7 +2428,7 @@ RSpec.describe PostsController doendcontext "when adding custom fields to topic via the `topic_custom_fields` param" do- it "should return a 400 response code when no custom fields has been permitted" do+ it "returns 400 when no custom fields are permitted" dosign_in(user)post "/posts.json",@@ -2454,7 +2454,7 @@ RSpec.describe PostsController dopluginend- it "should return a 400 response when trying to add a staff ony custom field for a non-staff user" do+ it "returns 400 when a non-staff user adds a staff-only custom field" dosign_in(user)post "/posts.json",@@ -2471,7 +2471,7 @@ RSpec.describe PostsController doexpect(Topic.last.custom_fields).to eq({})end- it "should add custom fields to topic that is permitted for a non-staff user" do+ it "adds topic custom fields permitted for non-staff users" dosign_in(user)post "/posts.json",@@ -2488,7 +2488,7 @@ RSpec.describe PostsController doexpect(Topic.last.custom_fields).to eq({ "xyz" => "abc" })end- it "should add custom fields to topic that is permitted for a non-staff user via the deprecated `meta_data` param" do+ it "adds permitted topic custom fields through the deprecated meta_data parameter" dosign_in(user)post "/posts.json",@@ -2505,7 +2505,7 @@ RSpec.describe PostsController doexpect(Topic.last.custom_fields).to eq({ "xyz" => "abc" })end- it "should add custom fields to topic that is permitted for a staff user and public user" do+ it "adds topic custom fields permitted for staff and public users" dosign_in(Fabricate(:admin))post "/posts.json",@@ -2646,7 +2646,7 @@ RSpec.describe PostsController doexpect(response.status).to eq(422)end- it "it triggers flag_linked_posts_as_spam when the post creator returns spam" do+ it "triggers flag_linked_posts_as_spam when the post creator returns spam" doSiteSetting.newuser_spam_host_threshold = 1sign_in(Fabricate(:user, trust_level: TrustLevel[0]))@@ -2841,7 +2841,7 @@ RSpec.describe PostsController dodescribe "shared draft" dofab!(:destination_category, :category)- it "will raise an error for regular users" do+ it "returns an error for regular users" dopost "/posts.json",params: {raw: "this is the shared draft content",@@ -2855,7 +2855,7 @@ RSpec.describe PostsController dodescribe "as a staff user" dobefore { sign_in(moderator) }- it "will raise an error if there is no shared draft category" do+ it "returns an error when no shared draft category exists" dopost "/posts.json",params: {raw: "this is the shared draft content",@@ -2870,7 +2870,7 @@ RSpec.describe PostsController dofab!(:shared_category, :category)before { SiteSetting.shared_drafts_category = shared_category.id }- it "will work if the shared draft category is present" do+ it "creates a shared draft when the shared draft category exists" dopost "/posts.json",params: {raw: "this is the shared draft content",@@ -2912,7 +2912,7 @@ RSpec.describe PostsController docontext "as a staff user" dobefore { sign_in(admin) }- it "should be able to mark a topic as warning" do+ it "marks the topic as a warning" dopost "/posts.json",params: {raw: "this is the test content",@@ -2944,7 +2944,7 @@ RSpec.describe PostsController doexpect(Topic.last.is_official_warning?).to eq(true)end- it "should be able to mark a topic as not a warning" do+ it "removes the topic's warning status" dopost "/posts.json",params: {raw: "this is the test content",@@ -2964,7 +2964,7 @@ RSpec.describe PostsController doendcontext "as a normal user" do- it "should not be able to mark a topic as warning" do+ it "rejects marking the topic as a warning" dosign_in(user)post "/posts.json",params: {@@ -2987,7 +2987,7 @@ RSpec.describe PostsController docontext "with topic bump" doshared_examples "it works" do- it "should be able to skip topic bumping" do+ it "skips topic bumping when requested" dooriginal_bumped_at = 1.day.agotopic = Fabricate(:topic, bumped_at: original_bumped_at)@@ -3017,7 +3017,7 @@ RSpec.describe PostsController doexpect(topic.reload.bumped_at).to eq_time(original_bumped_at)end- it "should be able to post with topic bumping" do+ it "creates the post and bumps the topic" dopost "/posts.json", params: { raw: "this is the test content", topic_id: topic.id }expect(response.status).to eq(200)@@ -3049,7 +3049,7 @@ RSpec.describe PostsController dofab!(:topic)[:user].each do |user|- it "will raise an error for #{user}" do+ it "returns an error for #{user}" dosign_in(Fabricate(user))post "/posts.json",params: {@@ -3550,7 +3550,7 @@ RSpec.describe PostsController docontext "with a tagged topic" dolet(:tag) { Fabricate(:tag) }- it "works" do+ it "returns tagged topic revisions with tagging enabled or disabled" doSiteSetting.tagging_enabled = truepost_revision.post.topic.update(tags: [tag])@@ -4312,7 +4312,7 @@ RSpec.describe PostsController docontext "with private posts" dodescribe "when not logged in" do- it "should return the right response" do+ it "returns 404 and the private posts login form" doFabricate(:post)get "/private-posts.rss"@@ -4826,7 +4826,7 @@ RSpec.describe PostsController doexpect(@controller.send(:create_params)).to include(hash_arg: { key1: "val" })end- it "allows strings to be added" do+ it "allows arrays to be added" doinstance.add_permitted_post_create_param(:array_arg)request.callexpect(@controller.send(:create_params)).not_to include(array_arg: %w[1 2 3])diff --git a/spec/requests/presence_controller_spec.rb b/spec/requests/presence_controller_spec.rbindex 886671738fa..7ea6724508b 100644--- a/spec/requests/presence_controller_spec.rb+++ b/spec/requests/presence_controller_spec.rb@@ -61,7 +61,7 @@ RSpec.describe PresenceController doendend- it "works" do+ it "updates presence for the requested channels" dosign_in(user)client_id = SecureRandom.hex@@ -156,7 +156,7 @@ RSpec.describe PresenceController dolet(:user2) { Fabricate(:user) }let(:user3) { Fabricate(:user) }- it "works" do+ it "returns presence for the requested channels" doget "/presence/get", params: { channels: [ch1.name] }expect(response.status).to eq(200)expect(response.parsed_body).to eq(diff --git a/spec/requests/push_notification_controller_spec.rb b/spec/requests/push_notification_controller_spec.rbindex b0ac96662d7..403cf737d84 100644--- a/spec/requests/push_notification_controller_spec.rb+++ b/spec/requests/push_notification_controller_spec.rb@@ -4,7 +4,7 @@ RSpec.describe PushNotificationController dofab!(:user)context "when logged out" do- it "should not allow subscribe" do+ it "does not allow subscribing" dopost "/push_notifications/subscribe.json",params: {username: "test",@@ -25,7 +25,7 @@ RSpec.describe PushNotificationController docontext "when logged in" dobefore { sign_in(user) }- it "should subscribe" do+ it "subscribes the user" dopost "/push_notifications/subscribe.json",params: {username: user.username,@@ -43,7 +43,7 @@ RSpec.describe PushNotificationController doexpect(user.push_subscriptions.count).to eq(1)end- it "should fix duplicate subscriptions" do+ it "repairs duplicate subscriptions" dosubscription = { endpoint: "endpoint", keys: { p256dh: "256dh", auth: "auth" } }PushSubscription.create user: user, data: subscription.to_jsonpost "/push_notifications/subscribe.json",@@ -57,7 +57,7 @@ RSpec.describe PushNotificationController doexpect(user.push_subscriptions.count).to eq(1)end- it "should not create duplicate subscriptions" do+ it "does not create duplicate subscriptions" do2.times dopost "/push_notifications/subscribe.json",params: {@@ -77,7 +77,7 @@ RSpec.describe PushNotificationController doexpect(user.push_subscriptions.count).to eq(1)end- it "should unsubscribe with existing subscription" do+ it "unsubscribes an existing subscription" dosub = { endpoint: "endpoint", keys: { p256dh: "256dh", auth: "auth" } }PushSubscription.create!(user: user, data: sub.to_json)@@ -91,7 +91,7 @@ RSpec.describe PushNotificationController doexpect(user.push_subscriptions).to eq([])end- it "should unsubscribe without subscription" do+ it "handles unsubscribing without a subscription" dopost "/push_notifications/unsubscribe.json",params: {username: user.username,diff --git a/spec/requests/reviewables_controller_spec.rb b/spec/requests/reviewables_controller_spec.rbindex 7ed56d1d28f..91dd5fc108c 100644--- a/spec/requests/reviewables_controller_spec.rb+++ b/spec/requests/reviewables_controller_spec.rb@@ -306,7 +306,7 @@ RSpec.describe ReviewablesController doexpect(json["reviewables"]).to be_presentend- it "will use the ReviewableUser serializer for its fields" do+ it "uses the ReviewableUser serializer for its fields" doJobs.run_immediately!SiteSetting.must_approve_users = trueuser = Fabricate(:user)diff --git a/spec/requests/safe_mode_controller_spec.rb b/spec/requests/safe_mode_controller_spec.rbindex 5165885ac30..d7ad7f05350 100644--- a/spec/requests/safe_mode_controller_spec.rb+++ b/spec/requests/safe_mode_controller_spec.rb@@ -31,14 +31,14 @@ RSpec.describe SafeModeController dodescribe "enter" docontext "when no params are given" do- it "should redirect back to safe mode page" do+ it "redirects back to the safe-mode page" dopost "/safe-mode"expect(response.status).to redirect_to(safe_mode_path)endendcontext "when safe mode is not enabled" do- it "should raise an error" do+ it "returns an error" doSiteSetting.enable_safe_mode = falsepost "/safe-mode"expect(response.status).to eq(404)diff --git a/spec/requests/search_controller_spec.rb b/spec/requests/search_controller_spec.rbindex 04ec01f4fbf..601f4aaf1b2 100644--- a/spec/requests/search_controller_spec.rb+++ b/spec/requests/search_controller_spec.rb@@ -226,7 +226,7 @@ RSpec.describe SearchController doendcontext "when searching by topic id" do- it "should not be restricted by minimum search term length" do+ it "is not restricted by the minimum search-term length" doSiteSetting.min_search_term_length = 20_000get "/search/query.json",@@ -242,7 +242,7 @@ RSpec.describe SearchController doexpect(data["topics"][0]["id"]).to eq(awesome_post.topic_id)end- it "should return the right result" do+ it "returns the topic matching the requested ID" doget "/search/query.json",params: {term: user_post.topic_id,diff --git a/spec/requests/session_controller_spec.rb b/spec/requests/session_controller_spec.rbindex a5c21bb87f7..5c117d8e692 100644--- a/spec/requests/session_controller_spec.rb+++ b/spec/requests/session_controller_spec.rb@@ -10,7 +10,7 @@ RSpec.describe SessionController dolet(:admin_email_token) { Fabricate(:email_token, user: admin) }shared_examples "failed to continue local login" do- it "should return the right response" do+ it "returns a forbidden response" doexpect(response).not_to be_successfulexpect(response.status).to eq(403)end@@ -215,7 +215,7 @@ RSpec.describe SessionController doendcontext "when token has expired" do- it "should return the right response" do+ it "returns the expired-token error" doemail_token.update!(created_at: 999.years.ago)post "/session/email-login/#{email_token.token}.json"@@ -1207,7 +1207,7 @@ RSpec.describe SessionController dodescribe "when in development mode" dobefore { Rails.env.stubs(:development?).returns(true) }- it "works" do+ it "signs in as the requested user" doget "/session/#{user.username}/become"expect(response).to be_redirect@@ -1352,7 +1352,7 @@ RSpec.describe SessionController doend.not_to change { UserAuthToken.count }end- it "will never redirect back to /session/sso path" do+ it "never redirects back to the SSO path" dosso = get_sso("/session/sso?bla=1")sso.email = user.emailsso.external_id = "abc"@@ -1592,7 +1592,7 @@ RSpec.describe SessionController doexpect(response).to redirect_to("/")end- it "redirects to root if the host of the return_path is different" do+ it "redirects protocol-relative external return paths to root" dosso = get_sso("//eviltrout.com")sso.external_id = "666"sso.email = "[email protected]"@@ -1603,7 +1603,7 @@ RSpec.describe SessionController doexpect(response).to redirect_to("/")end- it "redirects to root if the host of the return_path is different" do+ it "redirects absolute external return paths to root" dosso = get_sso("http://eviltrout.com")sso.external_id = "666"sso.email = "[email protected]"@@ -2608,7 +2608,7 @@ RSpec.describe SessionController doenddescribe "invalid password" do- it "should return an error with an invalid password" do+ it "returns an error for an invalid password" dopost "/session.json", params: { login: user.username, password: "sssss" }expect(response.status).to eq(200)@@ -2617,7 +2617,7 @@ RSpec.describe SessionController do)end- it "should return an error with an invalid password if too long" do+ it "returns an error for an overlong password" doUser.any_instance.expects(:confirm_password?).neverpost "/session.json",params: {@@ -2633,7 +2633,7 @@ RSpec.describe SessionController doenddescribe "suspended user" do- it "should return an error" do+ it "returns the suspension error" douser.suspended_till = 2.days.from_nowuser.suspended_at = Time.nowuser.save!@@ -2669,7 +2669,7 @@ RSpec.describe SessionController doenddescribe "deactivated user" do- it "should return an error" do+ it "returns the activation error" douser.active = falseuser.save!@@ -2723,7 +2723,7 @@ RSpec.describe SessionController dodescribe "when user's password has been marked as expired" dobefore { RateLimiter.enable }- it "should return an error response code with the right error message" do+ it "returns the expired-password error" doUserPasswordExpirer.expire_user_password(user)post "/session.json", params: { login: user.username, password: "myawesomepassword" }@@ -2861,7 +2861,7 @@ RSpec.describe SessionController dolet!(:user_second_factor_backup) { Fabricate(:user_second_factor_backup, user: user) }describe "when second factor token is missing" do- it "should return the right response" do+ it "returns the missing-second-factor error" dopost "/session.json", params: { login: user.username, password: "myawesomepassword" }expect(response.status).to eq(200)@@ -2873,7 +2873,7 @@ RSpec.describe SessionController dodescribe "when second factor token is invalid" docontext "when using totp method" do- it "should return the right response" do+ it "returns the invalid-TOTP error" dopost "/session.json",params: {login: user.username,@@ -2890,7 +2890,7 @@ RSpec.describe SessionController doendcontext "when using backup code method" do- it "should return the right response" do+ it "returns the invalid-backup-code error" dopost "/session.json",params: {login: user.username,@@ -2909,7 +2909,7 @@ RSpec.describe SessionController dodescribe "when second factor token is valid" docontext "when using totp method" do- it "should log the user in" do+ it "logs the user in with TOTP" dopost "/session.json",params: {login: user.username,@@ -2932,7 +2932,7 @@ RSpec.describe SessionController doendcontext "when using backup code method" do- it "should log the user in" do+ it "logs the user in with a backup code" dopost "/session.json",params: {login: user.username,@@ -3397,7 +3397,7 @@ RSpec.describe SessionController doendcontext "when token is valid" do- it "should display the form for GET" do+ it "displays the one-time-password form" dotoken = SecureRandom.hexDiscourse.redis.setex "otp_#{token}", 10.minutes, user.username@@ -3413,7 +3413,7 @@ RSpec.describe SessionController doexpect(session[:current_user_id]).to eq(nil)end- it "should redirect on GET if already logged in" do+ it "redirects an already logged-in user" dosign_in(user)token = SecureRandom.hexDiscourse.redis.setex "otp_#{token}", 10.minutes, user.username@@ -3425,7 +3425,7 @@ RSpec.describe SessionController doexpect(session[:current_user_id]).to eq(user.id)end- it "should authenticate user and delete token" do+ it "authenticates the user and deletes the token" douser = Fabricate(:user)get "/session/current.json"@@ -3483,7 +3483,7 @@ RSpec.describe SessionController doexpect(response.status).to eq(400)end- it "should correctly screen ips" do+ it "screens blocked IP addresses" doScreenedIpAddress.create!(ip_address: "100.0.0.1",action_type: ScreenedIpAddress.actions[:block],@@ -3505,7 +3505,7 @@ RSpec.describe SessionController dodescribe "rate limiting" dobefore { RateLimiter.enable }- it "should correctly rate limits" do+ it "rate-limits repeated password-reset requests" douser = Fabricate(:user)3.times dodiff --git a/spec/requests/static_controller_spec.rb b/spec/requests/static_controller_spec.rbindex f4279c1b817..d88e1d8a872 100644--- a/spec/requests/static_controller_spec.rb+++ b/spec/requests/static_controller_spec.rb@@ -156,7 +156,7 @@ RSpec.describe StaticController doendcontext "with a static file that's present" do- it "should return the right response for /faq" do+ it "returns the expected response for /faq" doget "/faq"expect(response).to redirect_to("/guidelines")@@ -244,31 +244,31 @@ RSpec.describe StaticController doendcontext "with a missing file" do- it "should respond 404" do+ it "responds with 404" doget "/static/does-not-exist"expect(response.status).to eq(404)endcontext "with modal pages" do- it "should return the right response for /signup" do+ it "returns the expected response for /signup" doget "/signup"expect(response.status).to eq(200)end- it "should return the right response for /password-reset" do+ it "returns the expected response for /password-reset" doget "/password-reset"expect(response.status).to eq(200)endendend- it "should redirect to / when logged in and path is /login without redirect" do+ it "redirects a logged-in user from /login to /" dosign_in(Fabricate(:user))get "/login"expect(response).to redirect_to("/")end- it "should display the login template when login is required" do+ it "displays the login template when login is required" doSiteSetting.login_required = trueget "/login"@@ -311,7 +311,7 @@ RSpec.describe StaticController doendcontext "with crawler view" do- it "should include correct title" do+ it "includes the correct title" doget "/guidelines", headers: { "HTTP_USER_AGENT" => "Googlebot" }expect(response.status).to eq(200)expect(response.body).to include("<title>Guidelines - Discourse</title>")@@ -617,7 +617,7 @@ RSpec.describe StaticController doenddescribe "#service_worker_asset" do- it "works" do+ it "renders the requested static page" doget "/service-worker.js"expect(response.status).to eq(200)expect(response.content_type).to start_with("text/javascript")diff --git a/spec/requests/svg_sprite_controller_spec.rb b/spec/requests/svg_sprite_controller_spec.rbindex e3e0b7e0b3a..3af3668a8a2 100644--- a/spec/requests/svg_sprite_controller_spec.rb+++ b/spec/requests/svg_sprite_controller_spec.rb@@ -6,7 +6,7 @@ RSpec.describe SvgSpriteController dodescribe "#show" dobefore { SvgSprite.expire_cache }- it "should return bundle when version is current" do+ it "returns the bundle when its version is current" doget "/svg-sprite/#{Discourse.current_hostname}/svg--#{SvgSprite.version}.js"expect(response.status).to eq(200)@@ -17,7 +17,7 @@ RSpec.describe SvgSpriteController doexpect(response.status).to eq(200)end- it "should redirect to current version" do+ it "redirects to the current version" dorandom_hash = Digest::SHA1.hexdigest("somerandomstring")get "/svg-sprite/#{Discourse.current_hostname}/svg--#{random_hash}.js"@@ -34,12 +34,12 @@ RSpec.describe SvgSpriteController doenddescribe "#search" do- it "should not work for anons" do+ it "rejects anonymous requests" doget "/svg-sprite/search/bolt"expect(response.status).to eq(404)end- it "should return symbol for FA icon search" do+ it "returns the symbol for a Font Awesome icon search" dosign_in(user)get "/svg-sprite/search/bolt"@@ -47,14 +47,14 @@ RSpec.describe SvgSpriteController doexpect(response.body).to include("bolt")end- it "should return 404 when looking for non-existent FA icon" do+ it "returns 404 for a nonexistent Font Awesome icon" dosign_in(user)get "/svg-sprite/search/not-a-valid-icon"expect(response.status).to eq(404)end- it "should find a custom icon in default theme" do+ it "finds a custom icon in the default theme" dotheme = Fabricate(:theme)fname = "custom-theme-icon-sprite.svg"@@ -79,13 +79,13 @@ RSpec.describe SvgSpriteController doenddescribe "#icon_picker_search" do- it "should return 403 for anonymous users" do+ it "returns 403 for anonymous users" doget "/svg-sprite/picker-search"expect(response.status).to eq(403)end- it "should work with no filter and return one page of results" do+ it "returns one page of results without a filter" dosign_in(user)get "/svg-sprite/picker-search"@@ -96,7 +96,7 @@ RSpec.describe SvgSpriteController doexpect(data[0]["id"]).to be_in(SvgSprite.all_icons)end- it "should filter" do+ it "filters the icon results" dosign_in(user)get "/svg-sprite/picker-search", params: { filter: "500px", only_available: "false" }@@ -191,7 +191,7 @@ RSpec.describe SvgSpriteController doexpect(response.status).to eq(200)end- it "should display only available" do+ it "displays only available icons" dosign_in(user)get "/svg-sprite/picker-search", params: { only_available: "true", filter: "beer" }diff --git a/spec/requests/tag_groups_controller_spec.rb b/spec/requests/tag_groups_controller_spec.rbindex cb8895c894d..2c6eb9e7d3b 100644--- a/spec/requests/tag_groups_controller_spec.rb+++ b/spec/requests/tag_groups_controller_spec.rb@@ -7,7 +7,7 @@ RSpec.describe TagGroupsController dofab!(:tag_group)describe "for a non staff user" do- it "should not be accessible" do+ it "is not accessible" doget "/tag_groups.json"expect(response.status).to eq(404)@@ -24,7 +24,7 @@ RSpec.describe TagGroupsController dobefore { sign_in(admin) }- it "should return the right response" do+ it "returns the expected response" dotag_groupget "/tag_groups.json"@@ -186,7 +186,7 @@ RSpec.describe TagGroupsController dobefore { sign_in(admin) }- it "should create a tag group and log the creation" do+ it "creates a tag group and logs the creation" dopost "/tag_groups.json",params: {tag_group: {@@ -210,7 +210,7 @@ RSpec.describe TagGroupsController do)end- it "should create a tag group with a parent tag" do+ it "creates a tag group with a parent tag" dopost "/tag_groups.json",params: {tag_group: {@@ -274,7 +274,7 @@ RSpec.describe TagGroupsController dobefore { sign_in(admin) }- it "should delete the tag group and log the deletion" do+ it "deletes the tag group and logs the deletion" doprevious_value = TagGroupSerializer.new(tag_group).to_json(root: false)delete "/tag_groups/#{tag_group.id}.json"@@ -303,7 +303,7 @@ RSpec.describe TagGroupsController dobefore { sign_in(admin) }- it "should update the tag group and log the modification" do+ it "updates the tag group and logs the change" doprevious_value = TagGroupSerializer.new(tag_group).to_json(root: false)put "/tag_groups/#{tag_group.id}.json",@@ -329,7 +329,7 @@ RSpec.describe TagGroupsController do)end- it "should update the tag group's parent tag" do+ it "updates the tag group's parent tag" doput "/tag_groups/#{tag_group.id}.json",params: {tag_group: {diff --git a/spec/requests/tags_controller_spec.rb b/spec/requests/tags_controller_spec.rbindex 27d5e92d633..cd410881b4e 100644--- a/spec/requests/tags_controller_spec.rb+++ b/spec/requests/tags_controller_spec.rb@@ -529,7 +529,7 @@ RSpec.describe TagsController dofab!(:topic_without_tags, :topic)fab!(:topic_with_tags) { Fabricate(:topic, tags: [tag]) }- it "should return the right response" do+ it "returns the requested tag in the topic list" doget "/tag/test.json"expect(response.status).to eq(200)@@ -580,12 +580,12 @@ RSpec.describe TagsController doexpect(response.parsed_body["tag_info"]["name"]).to eq("node.js")end- it "should handle invalid tags" do+ it "handles invalid tags" doget "/tag/%2ftest%2f"expect(response.status).to eq(404)end- it "should handle synonyms" do+ it "handles tag synonyms" dosynonym = Fabricate(:tag, target_tag: tag)get "/tag/#{synonym.name}/l/top.json?period=daily"expect(response.status).to eq(301)@@ -748,7 +748,7 @@ RSpec.describe TagsController doexpect(response.body).not_to include(private_category.name)end- it "should produce the topic inside the category and not the topic outside of it" do+ it "returns the topic inside the requested category" doget "/tags/c/#{category.slug}/#{tag.name}.json"topic_ids = response.parsed_body["topic_list"]["topics"].map { |x| x["id"] }@@ -757,7 +757,7 @@ RSpec.describe TagsController doexpect(topic_ids).to_not include(topic_in_category_without_tag.id)end- it "should produce the right next topic URL" do+ it "returns the next topic URL" doget "/tags/c/#{category.slug_path.join("/")}/#{category.id}/#{tag.name}.json?per_page=1"expect(response.parsed_body["topic_list"]["more_topics_url"]).to start_with(@@ -765,13 +765,13 @@ RSpec.describe TagsController do)end- it "should 404 for invalid category path" do+ it "returns 404 for an invalid category path" doget "/tags/c/#{category.slug_path.join("/")}/#{category.id}/somerandomstring/#{tag.name}.json?per_page=1"expect(response.status).to eq(404)end- it "should 404 for secure categories" do+ it "returns 404 for restricted categories" doc = Fabricate(:private_category, group: Fabricate(:group))get "/tags/c/#{c.slug_path.join("/")}/#{c.id}/#{tag.name}.json"@@ -786,7 +786,7 @@ RSpec.describe TagsController dofab!(:topic_out_of_subcategory) { Fabricate(:topic, tags: [tag]) }- it "should produce the topic inside the subcategory and not the topic outside of it" do+ it "returns the topic inside the requested subcategory" doget "/tags/c/#{category.slug}/#{subcategory.slug}/#{tag.name}.json"topic_ids = response.parsed_body["topic_list"]["topics"].map { |x| x["id"] }@@ -796,7 +796,7 @@ RSpec.describe TagsController doendend- it "should ignore invalid tag parameter" do+ it "ignores an invalid tag parameter" doget "/tag/test.json?tags[0]=nada"expect(response.status).to eq(200)end@@ -2621,13 +2621,13 @@ RSpec.describe TagsController doFabricate(:tag_group, permissions: { "staff" => 1 }, tag_names: [staff_only_tag.name])end- it "should return 403 for an anonymous user" do+ it "returns 403 for an anonymous user" doget "/tags/list.json"expect(response.status).to eq(403)end- it "should return 404 when tagging is disabled" do+ it "returns 404 when tagging is disabled" doSiteSetting.tagging_enabled = falsesign_in(user)@@ -2637,7 +2637,7 @@ RSpec.describe TagsController doexpect(response.status).to eq(404)end- it "should only return tags that are visible to the user for non admin users" do+ it "returns only visible tags for non-admin users" dostub_const(TagsController, "LIST_LIMIT", 2) dosign_in(user)@@ -2666,7 +2666,7 @@ RSpec.describe TagsController doendend- it "should return all tags for admin users" do+ it "returns all tags for admins" dostub_const(TagsController, "LIST_LIMIT", 2) dosign_in(admin)diff --git a/spec/requests/topic_view_stats_controller_spec.rb b/spec/requests/topic_view_stats_controller_spec.rbindex a517ce588de..8ece25d6e43 100644--- a/spec/requests/topic_view_stats_controller_spec.rb+++ b/spec/requests/topic_view_stats_controller_spec.rb@@ -3,31 +3,31 @@describe TopicViewStatsController dofab!(:topic)- it "will error if accessed on require login sites" do+ it "returns an error on login-required sites" doSiteSetting.login_required = trueget "/t/#{topic.id}/view-stats.json"expect(response.status).to eq(403)end- it "will not allow access to private topics" do+ it "does not allow access to private topics" dotopic.category.update!(read_restricted: true)get "/t/#{topic.id}/view-stats.json"expect(response.status).to eq(403)end- it "will raise correct errors if any param is invalid" do+ it "returns errors for invalid parameters" doget "/t/999999999999999999999999999999990000009/view-stats.json"expect(response.status).to eq(404)end- it "will return an error if from and to are not valid dates" do+ it "returns an error for invalid date parameters" doget "/t/#{topic.id}/view-stats.json?from=abc&to=xxx"expect(response.status).to eq(422)end- it "will return view stats for public topics" do+ it "returns view statistics for public topics" dofreeze_time "2021-01-01 12:00"TopicViewStat.create!(diff --git a/spec/requests/topics_controller_spec.rb b/spec/requests/topics_controller_spec.rbindex f3abd87c736..69ad3eb20b2 100644--- a/spec/requests/topics_controller_spec.rb+++ b/spec/requests/topics_controller_spec.rb@@ -236,7 +236,7 @@ RSpec.describe TopicsController doenddescribe "when topic has been deleted" do- it "should still be able to move posts" do+ it "still allows posts to be moved" doPostDestroyer.new(admin, topic.first_post, context: "Automated testing").destroyexpect(topic.reload.deleted_at).to_not be_nil@@ -730,7 +730,7 @@ RSpec.describe TopicsController doenddescribe "when message has been deleted" do- it "should still be able to move posts" do+ it "still allows posts to be moved" doPostDestroyer.new(admin, message.first_post).destroyexpect(message.reload.deleted_at).to_not be_nil@@ -1464,7 +1464,7 @@ RSpec.describe TopicsController doFabricate(:post, user: post_author2, topic: topic, created_at: old_timestamp + 1.day)end- it "should update the timestamps of selected posts" do+ it "updates timestamps for the selected posts" do# try to see if we fail with invalid firstput "/t/1/change-timestamp.json"expect(response.status).to eq(400)@@ -1477,7 +1477,7 @@ RSpec.describe TopicsController doexpect(p2.reload.created_at).to eq_time(old_timestamp)end- it "should create a staff log entry" do+ it "creates a staff log entry" doput "/t/#{topic.id}/change-timestamp.json", params: { timestamp: new_timestamp.to_f }log = UserHistory.last@@ -1504,7 +1504,7 @@ RSpec.describe TopicsController doenddescribe "when the user can see the topic" do- it "succeeds" do+ it "clears the topic pin" doexpect do put "/t/#{topic.id}/clear-pin.json" end.to change {TopicUser.where(topic_id: topic.id, user_id: user.id).count}.by(1)@@ -1544,7 +1544,7 @@ RSpec.describe TopicsController doexpect(response.status).to eq(400)end- it "should update the status of the topic correctly" do+ it "updates the topic status" doclosed_user_topic = Fabricate(:topic, user: user, closed: true)Fabricate(:topic_timer, topic: closed_user_topic, status_type: TopicTimer.types[:open])@@ -1559,7 +1559,7 @@ RSpec.describe TopicsController doexpect(body["topic_status_update"]).to eq(nil)end- it "should update the status when `enabled` is a truthy value" do+ it "updates the status when enabled is truthy" doclosed_user_topic = Fabricate(:topic, user: user, closed: false)put "/t/#{closed_user_topic.id}/status.json", params: { status: "closed", enabled: "t" }@@ -1591,7 +1591,7 @@ RSpec.describe TopicsController doSiteSetting.enable_category_group_moderation = trueend- it "should allow a group moderator to close a topic" do+ it "allows a group moderator to close a topic" doput "/t/#{topic.id}/status.json", params: { status: "closed", enabled: "true" }expect(response.status).to eq(200)@@ -1599,7 +1599,7 @@ RSpec.describe TopicsController doexpect(topic.posts.last.action_code).to eq("closed.enabled")end- it "should allow a group moderator to open a closed topic" do+ it "allows a group moderator to reopen a topic" dotopic.update!(closed: true)expect do@@ -1611,7 +1611,7 @@ RSpec.describe TopicsController doexpect(topic.posts.last.action_code).to eq("closed.disabled")end- it "should allow a group moderator to archive a topic" do+ it "allows a group moderator to archive a topic" doexpect doput "/t/#{topic.id}/status.json", params: { status: "archived", enabled: "true" }end.to change { topic.reload.posts.count }.by(1)@@ -1621,7 +1621,7 @@ RSpec.describe TopicsController doexpect(topic.posts.last.action_code).to eq("archived.enabled")end- it "should allow a group moderator to unarchive an archived topic" do+ it "allows a group moderator to unarchive a topic" dotopic.update!(archived: true)put "/t/#{topic.id}/status.json", params: { status: "archived", enabled: "false" }@@ -1631,7 +1631,7 @@ RSpec.describe TopicsController doexpect(topic.posts.last.action_code).to eq("archived.disabled")end- it "should allow a group moderator to pin a topic" do+ it "allows a group moderator to pin a topic" doput "/t/#{topic.id}/status.json",params: {status: "pinned",@@ -1643,14 +1643,14 @@ RSpec.describe TopicsController doexpect(topic.reload.pinned_at).to_not eq(nil)end- it "should allow a group moderator to unpin a topic" do+ it "allows a group moderator to unpin a topic" doput "/t/#{topic.id}/status.json", params: { status: "pinned", enabled: "false" }expect(response.status).to eq(200)expect(topic.reload.pinned_at).to eq(nil)end- it "should allow a group moderator to unlist a topic" do+ it "allows a group moderator to unlist a topic" doput "/t/#{topic.id}/status.json", params: { status: "visible", enabled: "false" }expect(response.status).to eq(200)@@ -1661,7 +1661,7 @@ RSpec.describe TopicsController doexpect(topic.posts.last.action_code).to eq("visible.disabled")end- it "should allow a group moderator to list an unlisted topic" do+ it "allows a group moderator to relist a topic" dotopic.update!(visible: false)put "/t/#{topic.id}/status.json", params: { status: "visible", enabled: "true" }@@ -1848,7 +1848,7 @@ RSpec.describe TopicsController doendcontext "for last post only" do- it "should allow you to retain topic timing but remove last post only" do+ it "retains topic timing while removing only the last post" dofreeze_timepost1 = create_post@@ -1968,7 +1968,7 @@ RSpec.describe TopicsController doenddescribe "#recover" do- it "won't allow us to recover a topic when we're not logged in" do+ it "does not recover a topic for an anonymous user" doput "/t/1/recover.json"expect(response.status).to eq(403)end@@ -2007,7 +2007,7 @@ RSpec.describe TopicsController docontext "with permission" dobefore { sign_in(moderator) }- it "succeeds" do+ it "recovers the topic" doput "/t/#{topic.id}/recover.json"topic.reloadpost.reload@@ -2086,7 +2086,7 @@ RSpec.describe TopicsController doenddescribe "#delete" do- it "won't allow us to delete a topic when we're not logged in" do+ it "does not delete a topic for an anonymous user" dodelete "/t/1.json"expect(response.status).to eq(403)end@@ -2106,7 +2106,7 @@ RSpec.describe TopicsController dodescribe "with permission" dobefore { sign_in(moderator) }- it "succeeds" do+ it "deletes the topic" dodelete "/t/#{topic.id}.json"expect(response.status).to eq(200)topic.reload@@ -2272,7 +2272,7 @@ RSpec.describe TopicsController doenddescribe "#update" do- it "won't allow us to update a topic when we're not logged in" do+ it "does not update a topic for an anonymous user" doput "/t/1.json", params: { slug: "xyz" }expect(response.status).to eq(403)end@@ -2379,7 +2379,7 @@ RSpec.describe TopicsController dofab!(:post_hook, :post_web_hook)fab!(:topic_hook, :topic_web_hook)- it "succeeds" do+ it "updates the topic" doput "/t/#{topic.slug}/#{topic.id}.json"expect(response.status).to eq(200)@@ -2987,7 +2987,7 @@ RSpec.describe TopicsController doexpect(topic.reload.tags.map(&:name)).not_to include(tag3.name)end- it "will clean tag params" do+ it "cleans tag parameters" dorestricted_category.allowed_tags = [tag2.name]put "/t/#{topic.slug}/#{topic.id}.json",@@ -3214,7 +3214,7 @@ RSpec.describe TopicsController doenddescribe "when user does not have access to the topic" do- it "should return the right response" do+ it "returns a not-found response" dosign_in(user)get "/t/external_id/private.json"@@ -3230,7 +3230,7 @@ RSpec.describe TopicsController dofab!(:topic) { Fabricate(:post, user: post_author1).topic }describe "when topic is not allowed" do- it "should return the right response" do+ it "returns a not-found response" doSiteSetting.detailed_404 = truesign_in(user)@@ -3917,7 +3917,7 @@ RSpec.describe TopicsController doendexpected_slug_response = expected[:secure_topic] == 200 ? 301 : expected[:secure_topic]- it "will return a #{expected_slug_response} when requesting a secure topic by slug" do+ it "returns a #{expected_slug_response} for a secure topic requested by slug" doformat = request_json ? ".json" : ""get "/t/#{secure_topic.slug}#{format}"expect(response.status).to eq(expected_slug_response)@@ -4392,7 +4392,7 @@ RSpec.describe TopicsController dofab!(:quote_reply) { Fabricate(:basic_reply, user: user, topic: topic) }fab!(:post_reply) { PostReply.create(post_id: post2.id, reply_post_id: quote_reply.id) }- it "should return the right posts" do+ it "returns replies to the selected post" doget "/t/#{topic.id}.json", params: { replies_to_post_number: post2.post_number }expect(response.status).to eq(200)@@ -4434,7 +4434,7 @@ RSpec.describe TopicsController do)end- it "should return the right posts" do+ it "returns top-level replies" doget "/t/#{topic.id}.json", params: { filter_top_level_replies: true }expect(response.status).to eq(200)@@ -4469,7 +4469,7 @@ RSpec.describe TopicsController doendfab!(:post6) { Fabricate(:post, user: post_author6, topic: topic) }- it "should return the right posts" do+ it "returns posts preceding the selected post" doget "/t/#{topic.id}.json", params: { filter_upwards_post_id: post5.id }expect(response.status).to eq(200)@@ -4485,7 +4485,7 @@ RSpec.describe TopicsController doexpect(ids).to eq([post.id, post4.id, post5.id, post6.id])end- it "should respect max_reply_history site setting" do+ it "respects the max_reply_history site setting" doSiteSetting.max_reply_history = 2get "/t/#{topic.id}.json", params: { filter_upwards_post_id: post5.id }@@ -4891,7 +4891,7 @@ RSpec.describe TopicsController dofab!(:post2) { Fabricate(:post, topic: topic, user: user) }fab!(:post3) { Fabricate(:post, user: post_author3, topic: topic) }- it "should return the right posts" do+ it "returns post IDs matching the username filter" doget "/t/#{topic.id}/post_ids.json",params: {post_number: post.post_number,@@ -4910,7 +4910,7 @@ RSpec.describe TopicsController dofab!(:post2) { Fabricate(:post, user: post_author2, topic: topic, percent_rank: 0.2) }fab!(:post3) { Fabricate(:post, user: post_author3, topic: topic) }- it "should return the right posts" do+ it "returns summarized post IDs" doget "/t/#{topic.id}/post_ids.json",params: {post_number: post.post_number,@@ -4931,7 +4931,7 @@ RSpec.describe TopicsController doafter { TopicView.custom_filters.clear }- it "should return the right posts" do+ it "returns post IDs matching custom filters" doTopicView.add_custom_filter("percent") do |posts, topic_view|posts.where(percent_rank: 0.5)end@@ -5013,7 +5013,7 @@ RSpec.describe TopicsController dofab!(:post2) { Fabricate(:post, user: post_author2, topic: topic) }fab!(:post3) { Fabricate(:post, user: post_author3, topic: topic) }- it "should return the right posts" do+ it "returns posts matching the username filter" doTopicView.stubs(:chunk_size).returns(2)get "/t/#{topic.id}/posts.json",@@ -5035,7 +5035,7 @@ RSpec.describe TopicsController dofab!(:post2) { Fabricate(:post, user: post_author2, topic: topic, percent_rank: 0.2) }fab!(:post3) { Fabricate(:post, user: post_author3, topic: topic) }- it "should return the right posts" do+ it "returns summarized posts" doTopicView.stubs(:chunk_size).returns(2)get "/t/#{topic.id}/posts.json",@@ -5788,7 +5788,7 @@ RSpec.describe TopicsController doexpect(response.parsed_body["error_type"]).to eq("not_found")end- it "should remove bookmarks properly from non first post" do+ it "removes bookmarks from a non-first post" dosign_in(user)post = create_post@@ -5833,7 +5833,7 @@ RSpec.describe TopicsController doexpect(response.parsed_body["error_type"]).to eq("not_found")end- it "should create a new bookmark for the topic" do+ it "creates a topic bookmark" dopost = create_post_post2 = create_post(topic_id: post.topic_id)put "/t/#{post.topic_id}/bookmark.json"@@ -5852,7 +5852,7 @@ RSpec.describe TopicsController dodescribe "#reset_new" docontext "when a user is not signed in" do- it "fails" do+ it "requires authentication" doput "/topics/reset-new.json"expect(response.status).to eq(403)end@@ -6707,7 +6707,7 @@ RSpec.describe TopicsController doFabricate(:post, user: post_author1, topic: topic, post_type: Post.types[:whisper])end- it "should gracefully handle invalid timings sent in" do+ it "ignores invalid timing values" dosign_in(user)params = {topic_id: topic.id,@@ -6734,7 +6734,7 @@ RSpec.describe TopicsController doexpect(tu.last_read_post_number).to eq(post_1.post_number)end- it "should gracefully handle invalid timings sent in from staff" do+ it "ignores invalid timing values from staff" dosign_in(admin)post "/topics/timings.json",@@ -6776,7 +6776,7 @@ RSpec.describe TopicsController doendend- it "should record the timing" do+ it "records the topic timing" dosign_in(user)post "/topics/timings.json",@@ -6826,14 +6826,14 @@ RSpec.describe TopicsController dodescribe "#timer" docontext "when a user is not logged in" do- it "should return the right response" do+ it "requires authentication" dopost "/t/#{topic.id}/timer.json", params: { time: "24", status_type: TopicTimer.types[1] }expect(response.status).to eq(403)endendcontext "when does not have permission" do- it "should return the right response" do+ it "forbids a user without permission" dosign_in(user)post "/t/#{topic.id}/timer.json", params: { time: "24", status_type: TopicTimer.types[1] }@@ -6889,7 +6889,7 @@ RSpec.describe TopicsController dosign_in(admin)end- it "should be able to create a topic status update" do+ it "creates a topic status update" dopost "/t/#{topic.id}/timer.json", params: { time: 24, status_type: TopicTimer.types[1] }expect(response.status).to eq(200)@@ -6909,7 +6909,7 @@ RSpec.describe TopicsController doexpect(json["closed"]).to eq(topic.reload.closed)end- it "should be able to delete a topic status update" do+ it "deletes a topic status update" doFabricate(:topic_timer, topic: topic)post "/t/#{topic.id}/timer.json", params: { time: nil, status_type: TopicTimer.types[1] }@@ -6924,7 +6924,7 @@ RSpec.describe TopicsController doexpect(json["closed"]).to eq(topic.closed)end- it "should be able to create a topic status update with duration" do+ it "creates a topic status update with a duration" dopost "/t/#{topic.id}/timer.json",params: {duration_minutes: 7200,@@ -6948,7 +6948,7 @@ RSpec.describe TopicsController doexpect(json["duration_minutes"]).to eq(topic_status_update.duration_minutes)end- it "should be able to delete a topic status update for delete_replies type" do+ it "deletes a delete_replies topic status update" doFabricate(:topic_timer, topic: topic, status_type: TopicTimer.types[:delete_replies])post "/t/#{topic.id}/timer.json", params: { time: nil, status_type: TopicTimer.types[7] }@@ -6964,7 +6964,7 @@ RSpec.describe TopicsController doenddescribe "publishing topic to category in the future" do- it "should be able to create the topic status update" do+ it "creates the topic status update" dopost "/t/#{topic.id}/timer.json",params: {time: 24,@@ -6987,13 +6987,13 @@ RSpec.describe TopicsController doenddescribe "publishing topic to category without category_id" do- it "should return an error when setting a timer" do+ it "returns an error when setting a timer" dopost "/t/#{topic.id}/timer.json", params: { time: 24, status_type: "publish_to_category" }expect(response.status).to eq(404)end- it "should allow removing a timer" do+ it "allows removing a timer" dotopic.set_or_create_timer(TopicTimer.types[:publish_to_category],24,@@ -7013,7 +7013,7 @@ RSpec.describe TopicsController doenddescribe "invalid status type" do- it "should raise the right error" do+ it "returns the invalid-status error" dopost "/t/#{topic.id}/timer.json", params: { time: 10, status_type: "something" }expect(response.status).to eq(400)expect(response.body).to include("status_type")@@ -7243,7 +7243,7 @@ RSpec.describe TopicsController dodescribe "changes slow mode" dobefore { sign_in(admin) }- it "should create a staff log entry" do+ it "creates a staff log entry" doput "/t/#{topic.id}/slow_mode.json", params: { seconds: "3600" }log = UserHistory.last@@ -7263,7 +7263,7 @@ RSpec.describe TopicsController dodescribe "#invite" docontext "when not logged in" do- it "should return the right response" do+ it "requires authentication" dopost "/t/#{topic.id}/invite.json", params: { email: "[email protected]" }expect(response.status).to eq(403)@@ -7276,7 +7276,7 @@ RSpec.describe TopicsController docontext "when topic id is not PM" dofab!(:user_topic) { Fabricate(:topic, user: user) }- it "should return the right response" do+ it "rejects a non-private-message topic" douser.update!(trust_level: TrustLevel[2])post "/t/#{user_topic.id}/invite.json", params: { email: "[email protected]" }@@ -7286,7 +7286,7 @@ RSpec.describe TopicsController doendcontext "when topic id is invalid" do- it "should return the right response" do+ it "returns a not-found response" doid = topic.idtopic.destroy!post "/t/#{id}/invite.json", params: { email: user.email }@@ -7367,7 +7367,7 @@ RSpec.describe TopicsController docontext "when user does not have permission to invite to the topic" dofab!(:topic) { pm }- it "should return the right response" do+ it "forbids a user without invitation permission" dopost "/t/#{topic.id}/invite.json", params: { user: user.username }expect(response.status).to eq(403)@@ -7387,7 +7387,7 @@ RSpec.describe TopicsController dobefore { admins.update!(messageable_level: Group::ALIAS_LEVELS[:everyone]) }context "as an anon user" do- it "should be forbidden" do+ it "forbids the invitation" doinvite_group(pm, 403)endend@@ -7396,7 +7396,7 @@ RSpec.describe TopicsController dobefore { sign_in(user) }context "when user does not have permission to view the topic" do- it "should be forbidden" do+ it "forbids the invitation" doinvite_group(pm, 403)endend@@ -7404,7 +7404,7 @@ RSpec.describe TopicsController docontext "when user has permission to view the topic" dobefore { pm.allowed_users << user }- it "should allow user to invite group to topic" do+ it "allows the user to invite a group to the topic" doinvite_group(pm, 200)expect(pm.allowed_groups.first.id).to eq(admins.id)end@@ -7544,7 +7544,7 @@ RSpec.describe TopicsController docontext "as staff" dobefore { sign_in(moderator) }- it "will publish the topic" do+ it "publishes the topic" doput "/t/#{topic.id}/publish.json", params: { destination_category_id: category.id }expect(response.status).to eq(200)json = response.parsed_body["basic_topic"]@@ -7947,7 +7947,7 @@ RSpec.describe TopicsController doendend- it "should fail for non-existent topic" do+ it "returns an error for a missing topic" domax_id = Topic.maximum(:id)sign_in(admin)put "/t/#{max_id + 1}/reset-bump-date.json"@@ -7963,7 +7963,7 @@ RSpec.describe TopicsController doend%i[admin moderator trust_level_4].each do |user|- it "should reset bumped_at as #{user}" do+ it "resets bumped_at as #{user}" dosign_in(public_send(user))topic.update!(bumped_at: 1.hour.ago)timestamp = 1.day.ago@@ -8129,7 +8129,7 @@ RSpec.describe TopicsController do).topicend- it "should be able to archive a private message" do+ it "archives a private message" dosign_in(user)message =diff --git a/spec/requests/uploads_controller_spec.rb b/spec/requests/uploads_controller_spec.rbindex 362884bce08..ead49eba54f 100644--- a/spec/requests/uploads_controller_spec.rb+++ b/spec/requests/uploads_controller_spec.rb@@ -25,7 +25,7 @@ RSpec.describe UploadsController docontext "when rate limited" dobefore { RateLimiter.enable }- it "should return 429 response code when maximum number of uploads per minute has been exceeded for a user" do+ it "returns 429 after the user exceeds the upload rate limit" doSiteSetting.max_uploads_per_minute = 1post "/uploads.json",@@ -296,7 +296,7 @@ RSpec.describe UploadsController do)end- it "should accept large files if system user" do+ it "accepts large files from the system user" doSiteSetting.authorized_extensions = "*"SiteSetting.system_user_max_attachment_size_kb = 421_730@@ -304,7 +304,7 @@ RSpec.describe UploadsController doexpect(response.status).to eq(200)end- it "should fail to accept large files if system user system_user_max_attachment_size_kb setting is low" do+ it "rejects large system-user files above the system limit" doSiteSetting.authorized_extensions = "*"SiteSetting.max_attachment_size_kb = 1SiteSetting.system_user_max_attachment_size_kb = 1@@ -318,7 +318,7 @@ RSpec.describe UploadsController do)end- it "should fail to accept large files if system user system_user_max_attachment_size_kb setting is low and general setting is low" do+ it "rejects large system-user files when both limits are low" doSiteSetting.authorized_extensions = "*"SiteSetting.max_attachment_size_kb = 10SiteSetting.system_user_max_attachment_size_kb = 5@@ -332,7 +332,7 @@ RSpec.describe UploadsController do)end- it "should fail to accept large files if attachment_size settings are low" do+ it "rejects large files above the attachment limit" doSiteSetting.authorized_extensions = "*"SiteSetting.max_attachment_size_kb = 1SiteSetting.system_user_max_attachment_size_kb = 10@@ -567,7 +567,7 @@ RSpec.describe UploadsController dobefore { setup_s3 }- it "should redirect to the s3 URL" do+ it "redirects to the S3 URL" doget upload.short_pathexpect(response).to redirect_to(upload.url)@@ -652,12 +652,12 @@ RSpec.describe UploadsController doSiteSetting.secure_uploads = trueend- it "should return 404 for anonymous requests requests" do+ it "returns 404 for anonymous requests" doget secure_urlexpect(response.status).to eq(404)end- it "should return signed url for legitimate request" do+ it "returns a signed URL for an authorized request" dosign_in(user)get secure_url@@ -677,7 +677,7 @@ RSpec.describe UploadsController doexpect(response.redirect_url).to include("response-content-disposition=inline")end- it "should return secure uploads URL when looking up urls" do+ it "returns the secure-upload URL during lookup" doupload.update_column(:secure, true)sign_in(user)@@ -705,13 +705,13 @@ RSpec.describe UploadsController dobefore { upload.update(access_control_post_id: post.id) }context "when the user is anon" do- it "should return signed url for public posts" do+ it "returns a signed URL for public posts" doget secure_urlexpect(response.status).to eq(302)expect(response.redirect_url).to match("Amz-Expires")end- it "should return 403 for deleted posts" do+ it "returns 403 for deleted posts" dopost.trash!get secure_urlexpect(response.status).to eq(403)@@ -731,7 +731,7 @@ RSpec.describe UploadsController dobefore { sign_in(user) }context "when the user has access to the post via guardian" do- it "should return signed url for legitimate request" do+ it "returns a signed URL for an authorized request" doget secure_urlexpect(response.status).to eq(302)expect(response.redirect_url).to match("Amz-Expires")@@ -806,7 +806,7 @@ RSpec.describe UploadsController docontext "if the upload is secure false, meaning the ACL is probably public" dobefore { upload.update(secure: false) }- it "should redirect to the regular show route" do+ it "redirects to the regular show route" dosecure_url = upload.url.sub(SiteSetting.Upload.absolute_base_url, "/secure-uploads")sign_in(user)get secure_url@@ -819,7 +819,7 @@ RSpec.describe UploadsController docontext "if the upload is secure true, meaning the ACL is probably private" dobefore { upload.update(secure: true) }- it "should redirect to the presigned URL still otherwise we will get a 403" do+ it "redirects to the presigned URL" dosecure_url = upload.url.sub(SiteSetting.Upload.absolute_base_url, "/secure-uploads")sign_in(user)get secure_url@@ -960,7 +960,7 @@ RSpec.describe UploadsController dofab!(:upload)describe "when url is missing" do- it "should return the right response" do+ it "requires a URL" dopost "/uploads/lookup-metadata.json"expect(response.status).to eq(403)@@ -968,7 +968,7 @@ RSpec.describe UploadsController doenddescribe "when not signed in" do- it "should return the right response" do+ it "requires authentication" dopost "/uploads/lookup-metadata.json", params: { url: upload.url }expect(response.status).to eq(403)@@ -1003,14 +1003,14 @@ RSpec.describe UploadsController doenddescribe "when url is invalid" do- it "should return the right response" do+ it "rejects an invalid URL" dopost "/uploads/lookup-metadata.json", params: { url: "abc" }expect(response.status).to eq(404)endend- it "should return the right response" do+ it "returns the upload metadata" dopost "/uploads/lookup-metadata.json", params: { url: upload.url }expect(response.status).to eq(200)diff --git a/spec/requests/user_actions_controller_spec.rb b/spec/requests/user_actions_controller_spec.rbindex 08339c7cf00..90b9128703d 100644--- a/spec/requests/user_actions_controller_spec.rb+++ b/spec/requests/user_actions_controller_spec.rb@@ -7,7 +7,7 @@ RSpec.describe UserActionsController docontext "when 'username' is not specified" dolet(:params) { {} }- it "fails" do+ it "returns 400 when username is missing" douser_actionsexpect(response).to have_http_status :bad_requestend@@ -103,7 +103,7 @@ RSpec.describe UserActionsController docontext "when `allow_users_to_hide_profile` is disabled" dobefore { SiteSetting.allow_users_to_hide_profile = false }- it "succeeds" do+ it "returns user actions when profile hiding is disabled" douser_actionsexpect(response).to have_http_status :okenddiff --git a/spec/requests/user_api_key_clients_controller_spec.rb b/spec/requests/user_api_key_clients_controller_spec.rbindex 2941e7ee506..ddc08f765a6 100644--- a/spec/requests/user_api_key_clients_controller_spec.rb+++ b/spec/requests/user_api_key_clients_controller_spec.rb@@ -25,7 +25,7 @@ RSpec.describe UserApiKeyClientsController docontext "with a registered client" dobefore { Fabricate(:user_api_key_client, **args) }- it "succeeds" do+ it "returns 200 for a registered client" dohead "/user-api-key-client.json", params: { client_id: args[:client_id] }expect(response.status).to eq(200)end@@ -102,7 +102,7 @@ RSpec.describe UserApiKeyClientsController docontext "with rate limiting" dobefore { RateLimiter.enable }- it "works" do+ it "rejects client creation after the daily limit is reached" doSiteSetting.user_api_key_clients_create_per_day = 1post "/user-api-key-client.json", params: args_with_scopesexpect(response.status).to eq(200)diff --git a/spec/requests/user_badges_controller_spec.rb b/spec/requests/user_badges_controller_spec.rbindex b1c771d1c95..31c17a8e31c 100644--- a/spec/requests/user_badges_controller_spec.rb+++ b/spec/requests/user_badges_controller_spec.rb@@ -305,7 +305,7 @@ RSpec.describe UserBadgesController do)end- it "will trigger :user_badge_granted" do+ it "triggers user_badge_granted" dosign_in(Fabricate(:admin))events =@@ -431,7 +431,7 @@ RSpec.describe UserBadgesController doexpect(UserHistory.where(acting_user: admin, target_user: user).count).to eq(1)end- it "will trigger :user_badge_removed" do+ it "triggers user_badge_removed" dosign_in(Fabricate(:admin))events =diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rbindex 26fc3cb8fd9..28c2bf8455a 100644--- a/spec/requests/users_controller_spec.rb+++ b/spec/requests/users_controller_spec.rb@@ -25,7 +25,7 @@ RSpec.describe UsersController dodescribe "#full account registration flow" dolet(:server_session) { request.server_session }- it "will correctly handle honeypot and challenge" do+ it "handles the honeypot and challenge fields" doget "/session/hp.json"expect(response.status).to eq(200)@@ -128,7 +128,7 @@ RSpec.describe UsersController docontext "when user is not approved" dobefore { SiteSetting.must_approve_users = true }- it "should return the right response" do+ it "returns the pending-approval response" doput "/u/activate-account/#{email_token.token}"expect(response.status).to eq(200)@@ -152,7 +152,7 @@ RSpec.describe UsersController docontext "when cookies contains a destination URL" docontext "when the destination URL has a query" do- it "should redirect to the URL and preserve the query" do+ it "redirects to the URL and preserves its query" dodestination_url = "http://thisisasite.com/somepath?latest=1"cookies[:destination_url] = destination_url@@ -164,7 +164,7 @@ RSpec.describe UsersController doendcontext "when destination URL doesn't have a query" do- it "should redirect to the URL" do+ it "redirects to the URL" dodestination_url = "http://thisisasite.com/somepath"cookies[:destination_url] = destination_url@@ -186,7 +186,7 @@ RSpec.describe UsersController doinvite.reloadend- it "should redirect to the topic" do+ it "redirects to the topic" doput "/u/activate-account/#{email_token.token}"expect(response.status).to eq(200)@@ -862,7 +862,7 @@ RSpec.describe UsersController doendcontext "when email params is missing" do- it "should raise the right error" do+ it "returns the missing-email error" dopost "/u.json",params: {name: @user.name,@@ -1213,7 +1213,7 @@ RSpec.describe UsersController doendcontext "when creating as active" do- it "won't create the user as active" do+ it "does not create the user as active" dopost "/u.json", params: post_user_params.merge(active: true)expect(response.status).to eq(200)expect(response.parsed_body["active"]).to be_falsey@@ -1222,7 +1222,7 @@ RSpec.describe UsersController docontext "with a regular api key" dofab!(:api_key, refind: false) { Fabricate(:api_key, user: user1) }- it "won't create the user as active with a regular key" do+ it "does not activate the user with a regular API key" dopost "/u.json",params: post_user_params.merge(active: true),headers: {@@ -1261,7 +1261,7 @@ RSpec.describe UsersController doexpect(new_user.email_tokens.where(confirmed: true, email: new_user.email)).to existend- it "will create a reviewable when a user is created as active but not approved" do+ it "creates a reviewable for an active unapproved user" doJobs.run_immediately!SiteSetting.must_approve_users = true@@ -1280,7 +1280,7 @@ RSpec.describe UsersController doexpect(ReviewableUser.pending.find_by(target: new_user)).to be_presentend- it "won't create a reviewable when a user is not active" do+ it "does not create a reviewable for an inactive user" doJobs.run_immediately!SiteSetting.must_approve_users = true@@ -1295,7 +1295,7 @@ RSpec.describe UsersController doexpect(ReviewableUser.pending.find_by(target: new_user)).to be_blankend- it "won't create the developer as active" do+ it "does not create the developer as active" doUsernameCheckerService.expects(:is_developer?).returns(true)post "/u.json",@@ -1307,7 +1307,7 @@ RSpec.describe UsersController doexpect(response.parsed_body["active"]).to be_falsyend- it "won't set the new user's locale to the admin's locale" do+ it "does not copy the administrator's locale to the new user" doSiteSetting.allow_user_locale = trueadmin.update!(locale: :fr)@@ -1323,7 +1323,7 @@ RSpec.describe UsersController doexpect(new_user.locale).not_to eq("fr")end- it "will auto approve user if the user email domain matches auto_approve_email_domains setting" do+ it "automatically approves a user from a configured email domain" doJobs.run_immediately!SiteSetting.must_approve_users = trueSiteSetting.auto_approve_email_domains = "example.com"@@ -1346,7 +1346,7 @@ RSpec.describe UsersController doendcontext "when creating as staged" do- it "won't create the user as staged" do+ it "does not create the user as staged" dopost "/u.json", params: post_user_params.merge(staged: true)expect(response.status).to eq(200)new_user = User.where(username: post_user_params[:username]).first@@ -1356,7 +1356,7 @@ RSpec.describe UsersController docontext "with a regular api key" dofab!(:api_key, refind: false) { Fabricate(:api_key, user: user1) }- it "won't create the user as staged with a regular key" do+ it "does not stage the user with a regular API key" dopost "/u.json",params: post_user_params.merge(staged: true),headers: {@@ -1385,7 +1385,7 @@ RSpec.describe UsersController doexpect(new_user.staged?).to eq(true)end- it "won't create the developer as staged" do+ it "does not create the developer as staged" doUsernameCheckerService.expects(:is_developer?).returns(true)post "/u.json",params: post_user_params.merge(staged: true),@@ -1421,7 +1421,7 @@ RSpec.describe UsersController doexpect(response.parsed_body["message"]).to eq(I18n.t "login.active")end- it "should be logged in" do+ it "logs in the new user" doUser.any_instance.expects(:enqueue_welcome_message)post_userexpect(response.status).to eq(200)@@ -1471,7 +1471,7 @@ RSpec.describe UsersController doOmniAuth.config.test_mode = falseend- it "should create twitter user info if required" do+ it "creates Twitter user information when required" dopost "/u.json",params: {name: "Test Osama",@@ -1499,7 +1499,7 @@ RSpec.describe UsersController doexpect(json["message"]).to be_presentend- it "will create the user successfully if email validation is required" do+ it "creates the user when email validation is required" dopost "/u.json",params: {name: "Test Osama",@@ -1553,7 +1553,7 @@ RSpec.describe UsersController doOmniAuth.config.test_mode = falseend- it "will create the user successfully" do+ it "creates the user" doRails.application.env_config["omniauth.auth"].info.email = nilpost "/u.json",@@ -1580,7 +1580,7 @@ RSpec.describe UsersController doendshared_examples "honeypot fails" do- it "should not create a new user" do+ it "does not create a new user" doUser.any_instance.expects(:enqueue_welcome_message).neverexpect { post "/u.json", params: create_params }.to_not change { User.count }@@ -1644,12 +1644,12 @@ RSpec.describe UsersController doendshared_examples "failed signup" do- it "should not create a new User" do+ it "does not create a new user" doexpect { post "/u.json", params: create_params }.to_not change { User.count }expect(response.status).to eq(200)end- it "should report failed" do+ it "reports the failed signup" dopost "/u.json", params: create_paramsjson = response.parsed_bodyexpect(json["success"]).not_to eq(true)@@ -1726,7 +1726,7 @@ RSpec.describe UsersController docontext "with a missing username" dolet(:create_params) { { name: @user.name, email: @user.email, password: "x" * 20 } }- it "should not create a new User" do+ it "does not create a new user" doexpect { post "/u.json", params: create_params }.to_not change { User.count }expect(response.status).to eq(400)end@@ -1798,7 +1798,7 @@ RSpec.describe UsersController doendend- it "should allow single values and not just arrays" do+ it "accepts a single value as well as an array" doexpect doput update_user_url, params: { user_fields: { field_id => "Axe" } }end.to change { user1.reload.user_fields[field_id] }.from(nil).to("Axe")@@ -1808,13 +1808,13 @@ RSpec.describe UsersController doend.to change { user1.reload.user_fields[field_id] }.from("Axe").to(%w[Axe Sword])end- it "shouldn't allow unregistered field values" do+ it "rejects unregistered field values" doexpect doput update_user_url, params: { user_fields: { field_id => %w[Juice] } }end.not_to change { user1.reload.user_fields[field_id] }end- it "should filter valid values" do+ it "filters valid field values" doexpect doput update_user_url, params: { user_fields: { field_id => %w[Axe Juice Sword] } }end.to change { user1.reload.user_fields[field_id] }.from(nil).to(valid_options)@@ -1885,7 +1885,7 @@ RSpec.describe UsersController doendend- it "shouldn't allow unregistered field values" do+ it "rejects unregistered field values" doexpect doput update_user_url, params: { user_fields: { field_id => "Umbrella Corporation" } }end.not_to change { user1.reload.user_fields[field_id] }@@ -1931,7 +1931,7 @@ RSpec.describe UsersController do}end- it "should succeed without the optional field" do+ it "creates the user without the optional field" dopost "/u.json", params: create_paramsexpect(response.status).to eq(200)inserted = User.find_by_email(@user.email)@@ -1942,7 +1942,7 @@ RSpec.describe UsersController doexpect(inserted.custom_fields["user_field_#{optional_field.id}"]).to be_blankend- it "should succeed with the optional field" do+ it "creates the user with the optional field" docreate_params[:user_fields][optional_field.id.to_s] = "value3"post "/u.json", params: create_params.merge(create_params)expect(response.status).to eq(200)@@ -1979,7 +1979,7 @@ RSpec.describe UsersController do}end- it "should succeed" do+ it "creates the user without optional field values" dopost "/u.json", params: create_paramsexpect(response.status).to eq(200)inserted = User.find_by_email(@user.email)@@ -2000,7 +2000,7 @@ RSpec.describe UsersController dofab!(:staged) { Fabricate(:staged, email: "[email protected]", active: true) }- it "succeeds" do+ it "claims the staged account" dopost "/u.json",params:honeypot_magic(email: staged.email, username: "zogstrip", password: "P4ssw0rd$$")@@ -2112,7 +2112,7 @@ RSpec.describe UsersController doexpect(user.reload.username).to eq(old_username)end- it "should succeed in normal circumstances" do+ it "returns the username availability" doput "/u/#{user.username}/preferences/username.json", params: { new_username: new_username }expect(response).to be_successful@@ -2160,7 +2160,7 @@ RSpec.describe UsersController doexpect(response.parsed_body["errors"].first).to include("Username must be unique")end- it "should fail if the user is old" do+ it "rejects the change for an old account" do# Older than the change period and >1 postuser.created_at = Time.now - (SiteSetting.username_change_period + 1).daysPostCreator.new(@@ -2175,7 +2175,7 @@ RSpec.describe UsersController doexpect(user.reload.username).to eq(old_username)end- it "should create a staff action log when a staff member changes the username" do+ it "logs a staff member's username change" doacting_user = adminsign_in(acting_user)@@ -2192,13 +2192,13 @@ RSpec.describe UsersController doexpect(user.reload.username).to eq(new_username)end- it "should return a JSON response with the updated username" do+ it "returns the updated username as JSON" doput "/u/#{user.username}/preferences/username.json", params: { new_username: new_username }expect(response.parsed_body["username"]).to eq(new_username)end- it "should respond with proper error message if auth_overrides_username is enabled" do+ it "returns an error when authentication overrides usernames" doSiteSetting.discourse_connect_url = "http://someurl.com"SiteSetting.discourse_connect_secret = "x" * 10SiteSetting.enable_discourse_connect = true@@ -2244,7 +2244,7 @@ RSpec.describe UsersController doendshared_examples "when username is unavailable" do- it "should return available as false in the JSON and return a suggested username" do+ it "returns unavailable with a suggested username" doexpect(response.status).to eq(200)expect(response.parsed_body["available"]).to eq(false)expect(response.parsed_body["suggestion"]).to be_present@@ -2252,7 +2252,7 @@ RSpec.describe UsersController doendshared_examples "when username is available" do- it "should return available in the JSON" do+ it "returns the username's availability" doexpect(response.status).to eq(200)expect(response.parsed_body["available"]).to eq(true)end@@ -2303,7 +2303,7 @@ RSpec.describe UsersController doendshared_examples "checking an invalid username" do- it "should not return an available key but should return an error message" do+ it "returns an error without an availability key" doexpect(response.status).to eq(200)expect(response.parsed_body["available"]).to eq(nil)expect(response.parsed_body["errors"]).to be_present@@ -2315,7 +2315,7 @@ RSpec.describe UsersController doinclude_examples "checking an invalid username"- it "should return the invalid characters message" do+ it "returns the invalid-characters message" doexpect(response.status).to eq(200)expect(response.parsed_body["errors"]).to include(I18n.t(:"user.username.characters"))end@@ -2331,7 +2331,7 @@ RSpec.describe UsersController doinclude_examples "checking an invalid username"- it 'should return the "too long" message' do+ it 'returns the "too long" message' doexpect(response.status).to eq(200)expect(response.parsed_body["errors"]).to include(I18n.t(:"user.username.long", count: SiteSetting.max_username_length),@@ -2758,7 +2758,7 @@ RSpec.describe UsersController dofab!(:user) { Fabricate(:user, username: "test.test", name: "Test User") }- it "should be able to update a user" do+ it "updates the user" doput "/u/#{user.username}", params: { name: "test.test" }expect(response.status).to eq(200)@@ -2922,7 +2922,7 @@ RSpec.describe UsersController dofab!(:user_field) { Fabricate(:user_field, requirement: "for_all_users") }fab!(:optional_field) { Fabricate(:user_field, requirement: "optional") }- it "should update the user field" do+ it "updates the user field" doput "/u/#{user.username}.json",params: {name: "Jim Tom",@@ -2960,7 +2960,7 @@ RSpec.describe UsersController doexpect(user.user_fields[user_field.id.to_s].size).to eq(UserField.max_length)end- it "should retain existing user fields" do+ it "retains existing user fields" doput "/u/#{user.username}.json",params: {name: "Jim Tom",@@ -3174,7 +3174,7 @@ RSpec.describe UsersController doend.to_not change { user.sidebar_section_links.count }end- it "should allow user to remove all category sidebar section links" do+ it "allows removal of all category sidebar links" doFabricate(:category_sidebar_section_link, user: user)expect do@@ -3184,7 +3184,7 @@ RSpec.describe UsersController doend.to change { user.sidebar_section_links.count }.from(1).to(0)end- it "should allow user to only modify category sidebar section links for categories they have access to" do+ it "allows category sidebar links only for accessible categories" docategory = Fabricate(:category)group = Fabricate(:group)restricted_category = Fabricate(:private_category, group: group)@@ -3219,7 +3219,7 @@ RSpec.describe UsersController do)end- it "should allow user to remove all tag sidebar section links" do+ it "allows removal of all tag sidebar links" doSiteSetting.tagging_enabled = trueFabricate(:tag_sidebar_section_link, user: user)@@ -3231,7 +3231,7 @@ RSpec.describe UsersController doend.to change { user.sidebar_section_links.count }.from(1).to(0)end- it "should not allow user to add tag sidebar section links when tagging is disabled" do+ it "rejects tag sidebar links when tagging is disabled" doSiteSetting.tagging_enabled = falsetag = Fabricate(:tag)@@ -3242,7 +3242,7 @@ RSpec.describe UsersController doexpect(user.reload.sidebar_section_links.count).to eq(0)end- it "should allow user to add tag sidebar section links only for tags that the user can browse" do+ it "allows tag sidebar links only for browsable tags" doSiteSetting.tagging_enabled = truetag = Fabricate(:tag)@@ -3754,7 +3754,7 @@ RSpec.describe UsersController docontext "for an existing user" docontext "for an activated account with email confirmed" do- it "fails" do+ it "rejects an already activated account" douser = post_useremail_token = Fabricate(:email_token, user: user).tokenEmailToken.confirm(email_token)@@ -3768,7 +3768,7 @@ RSpec.describe UsersController doendcontext "for an activated account with unconfirmed email" do- it "should send an email" do+ it "sends an activation email" douser = post_useruser.update!(active: true)Fabricate(:email_token, user: user)@@ -3790,7 +3790,7 @@ RSpec.describe UsersController docontext "when approval is enabled" dobefore { SiteSetting.must_approve_users = true }- it "should raise an error" do+ it "returns the approval error" douser = post_useruser.update(active: true)user.save!@@ -3802,12 +3802,12 @@ RSpec.describe UsersController doenddescribe "when user does not have a valid session" do- it "should not be valid" do+ it "rejects a non-staff request" dopost "/u/action/send_activation_email.json", params: { username: user.username }expect(response.status).to eq(403)end- it "should allow staff regardless" do+ it "allows staff to send the activation email" dosign_in(admin)user = Fabricate(:user, active: false)post "/u/action/send_activation_email.json", params: { username: user.username }@@ -3816,7 +3816,7 @@ RSpec.describe UsersController doendcontext "with a valid email_token" do- it "should send the activation email" do+ it "sends the activation email" douser = post_userexpect_enqueued_with(job: :critical_user_email, args: { type: :signup }) do@@ -3836,13 +3836,13 @@ RSpec.describe UsersController douser.reloadend- it "should generate a new token" do+ it "generates a new activation token" doexpect {post "/u/action/send_activation_email.json", params: { username: user.username }}.to change { user.reload.email_tokens.count }.by(1)end- it "should send an email" do+ it "sends the new activation email" doexpect dopost "/u/action/send_activation_email.json", params: { username: user.username }end.to change { Jobs::CriticalUserEmail.jobs.size }.by(1)@@ -3853,7 +3853,7 @@ RSpec.describe UsersController doendcontext "when username does not exist" do- it "should not send an email" do+ it "does not send an activation email" dopost "/u/action/send_activation_email.json", params: { username: "nopenopenopenope" }expect(response.status).to eq(404)expect(Jobs::CriticalUserEmail.jobs.size).to eq(0)@@ -4408,12 +4408,12 @@ RSpec.describe UsersController docontext "when the user is logged in" dobefore { sign_in(user1) }- it "will not redirect to an invalid path" do+ it "does not redirect to an invalid path" doget "/my/wat/..password.txt"expect(response).not_to be_redirectend- it "will redirect to an valid path" do+ it "redirects to a valid path" doget "/my/preferences"expect(response).to redirect_to("/u/#{user1.username}/preferences")end@@ -5266,7 +5266,7 @@ RSpec.describe UsersController doexpect(response.headers["X-Robots-Tag"]).to eq("noindex")end- it "should 403 for anonymous user when profiles are hidden" do+ it "returns 403 to anonymous users when profiles are hidden" doSiteSetting.hide_user_profiles_from_public = trueget "/u/#{user.username}.json"expect(response.headers["X-Robots-Tag"]).to eq("noindex")@@ -5275,7 +5275,7 @@ RSpec.describe UsersController doexpect(response).to have_http_status(:forbidden)end- it "should 403 correctly for crawlers when profiles are hidden" do+ it "returns 403 to crawlers when profiles are hidden" doSiteSetting.hide_user_profiles_from_public = trueget "/u/#{user.username}", headers: { "User-Agent" => "Googlebot" }expect(response).to have_http_status(:forbidden)@@ -5284,7 +5284,7 @@ RSpec.describe UsersController doenddescribe "user profile views" do- it "should track a user profile view for an anon user" do+ it "tracks an anonymous profile view" doget "/"UserProfileView.expects(:add).with(another_user.user_profile.id, request.remote_ip, nil)get "/u/#{another_user.username}.json"@@ -5338,7 +5338,7 @@ RSpec.describe UsersController doenddescribe "user profile views" do- it "should track a user profile view for a signed in user" do+ it "tracks a signed-in user's profile view" doUserProfileView.expects(:add).with(another_user.user_profile.id,request.remote_ip,@@ -5347,7 +5347,7 @@ RSpec.describe UsersController doget "/u/#{another_user.username}.json"end- it "should not track a user profile view for a user viewing his own profile" do+ it "does not track a user viewing their own profile" doUserProfileView.expects(:add).neverget "/u/#{user1.username}.json"end@@ -5443,14 +5443,14 @@ RSpec.describe UsersController doendend- it "should be able to view a user" do+ it "returns the user" doget "/u/#{user1.username}"expect(response.status).to eq(200)expect(response.body).to include(user1.username)end- it "should not be able to view a private user profile" do+ it "does not return a private user profile" douser1.user_profile.update!(bio_raw: "Hello world!")user1.user_option.update!(hide_profile: true)@@ -5463,7 +5463,7 @@ RSpec.describe UsersController dodescribe "when username contains a period" dobefore_all { user1.update!(username: "test.test") }- it "should be able to view a user" do+ it "returns the user" doget "/u/#{user1.username}"expect(response.status).to eq(200)@@ -5559,7 +5559,7 @@ RSpec.describe UsersController doexpect(user_json["silence_reason"]).to eq("public reason")end- it "should have http status 403 for anonymous user when profiles are hidden" do+ it "returns 403 to anonymous users when profiles are hidden" doSiteSetting.hide_user_profiles_from_public = trueget "/u/#{user.username}/card.json"expect(response).to have_http_status(:forbidden)@@ -5681,7 +5681,7 @@ RSpec.describe UsersController doexpect(parsed.map { |u| u["username"] }).to contain_exactly(user.username, user2.username)end- it "should have http status 403 for anonymous user when profiles are hidden" do+ it "returns 403 to anonymous users when profiles are hidden" doSiteSetting.hide_user_profiles_from_public = trueget "/user-cards.json?user_ids=#{user.id},#{user2.id}"expect(response).to have_http_status(:forbidden)@@ -5743,7 +5743,7 @@ RSpec.describe UsersController doendcontext "when cookies contains a destination URL" do- it "should redirect to the URL" do+ it "redirects to the URL" dosign_in(user1)destination_url = "http://thisisasite.com/somepath"@@ -6146,7 +6146,7 @@ RSpec.describe UsersController doenddescribe "when not signed in" do- it "should not include mentionable/messageable groups" do+ it "omits mentionable and messageable groups" doget "/u/search/users.json",params: {include_mentionable_groups: "false",@@ -6418,14 +6418,14 @@ RSpec.describe UsersController dodescribe "when enable_local_logins_via_email is disabled" dobefore { SiteSetting.enable_local_logins_via_email = false }- it "should return the right response" do+ it "returns the disabled-login error" dopost "/u/email-login.json", params: { login: user1.email }expect(response.status).to eq(404)endenddescribe "when username or email is not valid" do- it "should not enqueue the email to login" do+ it "does not enqueue the login email" dopost "/u/email-login.json", params: { login: "@random" }expect(response.status).to eq(200)@@ -6437,7 +6437,7 @@ RSpec.describe UsersController doenddescribe "when hide_email_address_taken is true" do- it "should return the right response" do+ it "returns a generic response" doSiteSetting.hide_email_address_taken = truepost "/u/email-login.json", params: { login: user1.email }@@ -6449,7 +6449,7 @@ RSpec.describe UsersController doenddescribe "when user is already logged in" do- it "should redirect to the root path" do+ it "redirects to the root path" dosign_in(user1)post "/u/email-login.json", params: { login: user1.email }@@ -6460,7 +6460,7 @@ RSpec.describe UsersController dodescribe "#create_second_factor_totp" docontext "when not logged in" do- it "should return the right response" do+ it "requires authentication" dopost "/users/second_factors.json", params: { password: "wrongpassword" }expect(response.status).to eq(403)@@ -6482,7 +6482,7 @@ RSpec.describe UsersController doenddescribe "when local logins are disabled" do- it "should return the right response" do+ it "rejects TOTP creation when local logins are disabled" doSiteSetting.enable_local_logins = falsepost "/users/create_second_factor_totp.json"@@ -6492,7 +6492,7 @@ RSpec.describe UsersController doenddescribe "when SSO is enabled" do- it "should return the right response" do+ it "rejects TOTP creation when SSO is enabled" doSiteSetting.discourse_connect_url = "http://someurl.com"SiteSetting.discourse_connect_secret = "x" * 10SiteSetting.enable_discourse_connect = true@@ -6673,7 +6673,7 @@ RSpec.describe UsersController dofab!(:user_second_factor) { Fabricate(:user_second_factor_totp, user: user1) }context "when not logged in" do- it "should return the right response" do+ it "requires authentication" doput "/users/second_factor.json"expect(response.status).to eq(403)@@ -6700,7 +6700,7 @@ RSpec.describe UsersController docontext "when token is valid" dobefore { stub_server_session_confirmed }- it "should allow second factor for the user to be renamed" do+ it "renames the user's second factor" doput "/users/second_factor.json",params: {name: "renamed",@@ -6712,7 +6712,7 @@ RSpec.describe UsersController doexpect(user1.reload.user_second_factors.totps.first.name).to eq("renamed")end- it "should allow second factor for the user to be disabled" do+ it "disables the user's second factor" doput "/users/second_factor.json",params: {disable: "true",@@ -6746,7 +6746,7 @@ RSpec.describe UsersController do.returns("confirmed-session-#{user1.id}" => "true")end- it "should allow second factor backup for the user to be disabled" do+ it "disables the user's backup codes" doput "/users/second_factor.json",params: {second_factor_target: UserSecondFactor.methods[:backup_codes],@@ -6765,7 +6765,7 @@ RSpec.describe UsersController dofab!(:user_second_factor) { Fabricate(:user_second_factor_totp, user: user1) }context "when not logged in" do- it "should return the right response" do+ it "requires authentication" doput "/users/second_factors_backup.json",params: {second_factor_token: "wrongtoken",@@ -6791,7 +6791,7 @@ RSpec.describe UsersController doenddescribe "when local logins are disabled" do- it "should return the right response" do+ it "rejects backup-code creation when local logins are disabled" doSiteSetting.enable_local_logins = falseput "/users/second_factors_backup.json"@@ -6801,7 +6801,7 @@ RSpec.describe UsersController doenddescribe "when SSO is enabled" do- it "should return the right response" do+ it "rejects backup-code creation when SSO is enabled" doSiteSetting.discourse_connect_url = "http://someurl.com"SiteSetting.discourse_connect_secret = "x" * 10SiteSetting.enable_discourse_connect = true@@ -6965,7 +6965,7 @@ RSpec.describe UsersController doFabricate(:passkey_with_random_credential, user: user1)end- it "should disable all totp and security keys (but not passkeys)" do+ it "disables all TOTP factors and security keys but preserves passkeys" doexpect_enqueued_with(job: :critical_user_email,args: {@@ -7329,7 +7329,7 @@ RSpec.describe UsersController doexpect(response.status).to eq(200)end- it "works" do+ it "revokes the account through the external provider" doauthenticator.can_revoke = truepost "/u/#{user1.username}/preferences/revoke-account.json",diff --git a/spec/requests/webhooks_controller_spec.rb b/spec/requests/webhooks_controller_spec.rbindex eb7f5b440f1..56527a5f3bd 100644--- a/spec/requests/webhooks_controller_spec.rb+++ b/spec/requests/webhooks_controller_spec.rb@@ -539,7 +539,7 @@ RSpec.describe WebhooksController doenddescribe "#mandrill_head" do- it "works" do+ it "returns 200 for a Mandrill HEAD request" dohead "/webhooks/mandrill.json"expect(response.status).to eq(200)diff --git a/spec/serializers/admin_plugin_serializer_spec.rb b/spec/serializers/admin_plugin_serializer_spec.rbindex b6f0691d7c6..a1c913710aa 100644--- a/spec/serializers/admin_plugin_serializer_spec.rb+++ b/spec/serializers/admin_plugin_serializer_spec.rb@@ -76,14 +76,14 @@ RSpec.describe AdminPluginSerializer doenddescribe "enabled_setting" do- it "should return the right value" do+ it "returns the expected value" doinstance.enabled_site_setting("test")expect(serializer.enabled_setting).to eq("test")endenddescribe "commit_hash" do- it "should return commit_hash and commit_url" do+ it "returns commit_hash and commit_url" dogit_repo = instance.git_repogit_repo.stubs(:latest_local_commit).returns("123456")git_repo.stubs(:url).returns("http://github.com/discourse/discourse-plugin")diff --git a/spec/serializers/basic_group_serializer_spec.rb b/spec/serializers/basic_group_serializer_spec.rbindex c4d6e23d29a..112bae1a386 100644--- a/spec/serializers/basic_group_serializer_spec.rb+++ b/spec/serializers/basic_group_serializer_spec.rb@@ -11,7 +11,7 @@ RSpec.describe BasicGroupSerializer dodescribe "automatic group" dolet(:group) { Group.find(1) }- it "should include the display name" do+ it "includes the display name" doexpect(serializer.display_name).to eq(I18n.t("groups.default_names.admins"))endend@@ -19,7 +19,7 @@ RSpec.describe BasicGroupSerializer dodescribe "normal group" dofab!(:group)- it "should not include the display name" do+ it "does not include the display name" doexpect(serializer.display_name).to eq(nil)endend@@ -33,7 +33,7 @@ RSpec.describe BasicGroupSerializer dofab!(:group) { Fabricate(:group, bio_raw: "testing :slightly_smiling_face:") }describe "group owner" do- it "should include bio_raw" do+ it "includes bio_raw" doexpect(serializer.as_json[:bio_raw]).to eq("testing :slightly_smiling_face:")expect(serializer.as_json[:bio_excerpt]).to start_with("testing <img")end@@ -46,7 +46,7 @@ RSpec.describe BasicGroupSerializer dodescribe "for a staff user" dolet!(:guardian) { Guardian.new(Fabricate(:moderator)) }- it "should be present" do+ it "includes has_messages" doexpect(serializer.as_json[:has_messages]).to eq(true)endend@@ -57,7 +57,7 @@ RSpec.describe BasicGroupSerializer dobefore { group.add(user) }- it "should be present" do+ it "includes has_messages" doexpect(serializer.as_json[:has_messages]).to eq(true)endend@@ -65,7 +65,7 @@ RSpec.describe BasicGroupSerializer dodescribe "for a normal user" dolet(:guardian) { Guardian.new(Fabricate(:user)) }- it "should not be present" do+ it "omits has_messages" doexpect(serializer.as_json[:has_messages]).to eq(nil)endend@@ -80,7 +80,7 @@ RSpec.describe BasicGroupSerializer dobefore { group.add(user) }- it "should be true" do+ it "allows the member to see members" doexpect(serializer.as_json[:can_see_members]).to eq(true)endend@@ -88,7 +88,7 @@ RSpec.describe BasicGroupSerializer dodescribe "for a normal user" dolet(:guardian) { Guardian.new(Fabricate(:user)) }- it "should be false" do+ it "does not allow the user to see members" doexpect(serializer.as_json[:can_see_members]).to eq(false)endenddiff --git a/spec/serializers/basic_group_user_serializer_spec.rb b/spec/serializers/basic_group_user_serializer_spec.rbindex 2bca31763f6..ca307c74875 100644--- a/spec/serializers/basic_group_user_serializer_spec.rb+++ b/spec/serializers/basic_group_user_serializer_spec.rb@@ -8,7 +8,7 @@ RSpec.describe BasicGroupUserSerializer dodescribe "#owner" dodescribe "when scoped to the user" do- it "should be false" do+ it "returns false for a member who is not an owner" dojson = described_class.new(GroupUser.last, scope: Guardian.new(user), root: false).as_jsonexpect(json[:owner]).to eq(false)@@ -16,7 +16,7 @@ RSpec.describe BasicGroupUserSerializer doenddescribe "when not scoped to the user" do- it "should be nil" do+ it "omits owner information without a user scope" dojson = described_class.new(GroupUser.last, scope: Guardian.new, root: false).as_jsonexpect(json[:owner]).to eq(nil)diff --git a/spec/serializers/category_upload_serializer_spec.rb b/spec/serializers/category_upload_serializer_spec.rbindex 34545547b43..0679a18dc09 100644--- a/spec/serializers/category_upload_serializer_spec.rb+++ b/spec/serializers/category_upload_serializer_spec.rb@@ -5,7 +5,7 @@ RSpec.describe CategoryUploadSerializer dofab!(:upload)- it "should include width and height" do+ it "includes the upload dimensions" doexpect(serializer.width).to eq(upload.width)expect(serializer.height).to eq(upload.height)enddiff --git a/spec/serializers/current_user_serializer_spec.rb b/spec/serializers/current_user_serializer_spec.rbindex a046ff9818d..1bc1337136a 100644--- a/spec/serializers/current_user_serializer_spec.rb+++ b/spec/serializers/current_user_serializer_spec.rb@@ -7,7 +7,7 @@ RSpec.describe CurrentUserSerializer dolet(:guardian) { user.guardian }context "when SSO is not enabled" do- it "should not include the external_id field" do+ it "does not include external_id" dopayload = serializer.as_jsonexpect(payload).not_to have_key(:external_id)end@@ -20,7 +20,7 @@ RSpec.describe CurrentUserSerializer douserend- it "should include the external_id" do+ it "includes external_id" doSiteSetting.discourse_connect_url = "http://example.com/discourse_sso"SiteSetting.discourse_connect_secret = "12345678910"SiteSetting.enable_discourse_connect = true@@ -34,12 +34,12 @@ RSpec.describe CurrentUserSerializer dofab!(:category2, :category)fab!(:category3, :category)- it "should include empty top_category_ids array" do+ it "includes an empty top_category_ids array" dopayload = serializer.as_jsonexpect(payload[:top_category_ids]).to eq([])end- it "should include correct id in top_category_ids array" do+ it "includes the correct ID in top_category_ids" do_category = Category.firstCategoryUser.create!(user_id: user.id,@@ -107,7 +107,7 @@ RSpec.describe CurrentUserSerializer doenddescribe "#groups" do- it "should only show visible groups" do+ it "shows only visible groups" doFabricate(:group, visibility_level: Group.visibility_levels[:public])hidden_group = Fabricate(:group, visibility_level: Group.visibility_levels[:owners])public_group =@@ -309,11 +309,11 @@ RSpec.describe CurrentUserSerializer do)end- it "should not include associated account ids by default" do+ it "does not include associated account IDs by default" doexpect(serializer.as_json[:associated_account_ids]).to be_nilend- it "should include associated account ids when site setting enabled" do+ it "includes associated account IDs when enabled" doSiteSetting.include_associated_account_ids = trueexpect(serializer.as_json[:associated_account_ids]).to eq({ "twitter" => "1" })enddiff --git a/spec/serializers/group_show_serializer_spec.rb b/spec/serializers/group_show_serializer_spec.rbindex 8646fce580d..8dd390d85eb 100644--- a/spec/serializers/group_show_serializer_spec.rb+++ b/spec/serializers/group_show_serializer_spec.rb@@ -8,7 +8,7 @@ RSpec.describe GroupShowSerializer dofab!(:user, :admin)fab!(:group) { Fabricate(:group, users: [user]) }- it "should return the right attributes" do+ it "returns the public group attributes" dojson = GroupShowSerializer.new(group, scope: Guardian.new(user)).as_jsonexpect(json[:group_show][:is_group_owner]).to eq(nil)@@ -19,7 +19,7 @@ RSpec.describe GroupShowSerializer docontext "with a group owner" dobefore { group.add_owner(user) }- it "should return the right attributes" do+ it "returns the private group attributes" dojson = GroupShowSerializer.new(group, scope: Guardian.new(user)).as_jsonexpect(json[:group_show][:is_group_owner]).to eq(true)@@ -30,7 +30,7 @@ RSpec.describe GroupShowSerializer dodescribe "#mentionable" dofab!(:group) { Fabricate(:group, mentionable_level: Group::ALIAS_LEVELS[:everyone]) }- it "should return the right value" do+ it "returns the group flair URL" dojson = GroupShowSerializer.new(group, scope: Guardian.new).as_jsonexpect(json[:group_show][:mentionable]).to eq(nil)@@ -45,19 +45,19 @@ RSpec.describe GroupShowSerializer dofab!(:group) { Fabricate(:group, automatic_membership_email_domains: "ilovediscourse.com") }let(:admin_guardian) { Guardian.new(Fabricate(:admin)) }- it "should include email domains for admin" do+ it "includes email domains for an administrator" dosubject =described_class.new(group, scope: admin_guardian, root: false, owner_group_ids: [group.id])expect(subject.as_json[:automatic_membership_email_domains]).to eq("ilovediscourse.com")end- it "should not include email domains for other users" do+ it "omits email domains for other users" dosubject =described_class.new(group, scope: Guardian.new, root: false, owner_group_ids: [group.id])expect(subject.as_json[:automatic_membership_email_domains]).to eq(nil)end- it "should include email domains for moderator when moderators_manage_groups is enabled" do+ it "includes email domains for a moderator who can manage groups" doSiteSetting.moderators_manage_groups = truemoderator_guardian = Fabricate(:moderator).guardiansubject =diff --git a/spec/serializers/notification_serializer_spec.rb b/spec/serializers/notification_serializer_spec.rbindex 4abf94572d4..3543bddd6f7 100644--- a/spec/serializers/notification_serializer_spec.rb+++ b/spec/serializers/notification_serializer_spec.rb@@ -26,7 +26,7 @@ RSpec.describe NotificationSerializer dolet(:serializer) { NotificationSerializer.new(notification) }let(:json) { serializer.as_json }- it "should include the external_id" do+ it "includes the external ID" doSiteSetting.discourse_connect_url = "http://example.com/discourse_sso"SiteSetting.discourse_connect_secret = "12345678910"SiteSetting.enable_discourse_connect = truediff --git a/spec/serializers/post_serializer_spec.rb b/spec/serializers/post_serializer_spec.rbindex 6e1a23f6b0d..0cedca83cca 100644--- a/spec/serializers/post_serializer_spec.rb+++ b/spec/serializers/post_serializer_spec.rb@@ -117,7 +117,7 @@ RSpec.describe PostSerializer doexpect(notify_user_action).to be_blankend- it "should not allow user to flag post and notify non human user" do+ it "prevents flagging a post to notify a non-human user" dopost.update!(user: Discourse.system_user)serializer = PostSerializer.new(post, scope: Guardian.new(actor), root: false)@@ -304,12 +304,12 @@ RSpec.describe PostSerializer dorevisor.revise!(post.user, raw: "Hello, everyone!")end- it "will not leak version to users" do+ it "hides the real version from regular users" dojson = PostSerializer.new(post, scope: Guardian.new(user), root: false).as_jsonexpect(json[:version]).to eq(1)end- it "will show real version to staff" do+ it "shows the real version to staff" dojson = PostSerializer.new(post, scope: Guardian.new(Fabricate(:admin)), root: false).as_jsonexpect(json[:version]).to eq(2)enddiff --git a/spec/serializers/reviewable_serializer_spec.rb b/spec/serializers/reviewable_serializer_spec.rbindex bc24b68619f..02e98201b3d 100644--- a/spec/serializers/reviewable_serializer_spec.rb+++ b/spec/serializers/reviewable_serializer_spec.rb@@ -26,7 +26,7 @@ RSpec.describe ReviewableSerializer doexpect(json[:removed_topic_id]).to eq reviewable.topic_idend- it "will not throw an error when the payload is `nil`" do+ it "does not raise an error when the payload is nil" doreviewable.payload = niljson =ReviewableQueuedPostSerializer.new(reviewable, scope: Guardian.new(admin), root: nil).as_jsondiff --git a/spec/serializers/single_sign_on_record_serializer_spec.rb b/spec/serializers/single_sign_on_record_serializer_spec.rbindex d7e182f4096..698b53313bb 100644--- a/spec/serializers/single_sign_on_record_serializer_spec.rb+++ b/spec/serializers/single_sign_on_record_serializer_spec.rb@@ -17,7 +17,7 @@ RSpec.describe SingleSignOnRecordSerializer doSingleSignOnRecordSerializer.new(sso, scope: Guardian.new(admin), root: false)end- it "should include user sso info" do+ it "includes user SSO information" dopayload = serializer.as_jsonexpect(payload[:user_id]).to eq(user.id)expect(payload[:external_id]).to eq("12345")@@ -31,7 +31,7 @@ RSpec.describe SingleSignOnRecordSerializer doSingleSignOnRecordSerializer.new(sso, scope: Guardian.new(moderator), root: false)end- it "should not include user sso payload" do+ it "omits the user SSO payload" dopayload = serializer.as_jsonexpect(payload[:user_id]).to eq(user.id)expect(payload[:external_id]).to eq("12345")diff --git a/spec/serializers/site_serializer_spec.rb b/spec/serializers/site_serializer_spec.rbindex 9dda140a87f..3a014769752 100644--- a/spec/serializers/site_serializer_spec.rb+++ b/spec/serializers/site_serializer_spec.rb@@ -489,7 +489,7 @@ RSpec.describe SiteSerializer doFabricate(:tag_group, permissions: { "staff" => 1 }, tag_names: [hidden_tag.name])end- it "should return the site's top tags as the default tags for sidebar" do+ it "returns the site's top tags as default sidebar tags" doserialized = described_class.new(Site.new(guardian), scope: guardian, root: false).as_jsonexpect(serialized[:navigation_menu_site_top_tags]).to eq(@@ -519,7 +519,7 @@ RSpec.describe SiteSerializer do)end- it "should not be serialized if `tagging_enabled` site setting is set to false" do+ it "is not serialized when tagging is disabled" doSiteSetting.set(:tagging_enabled, false)serialized = described_class.new(Site.new(guardian), scope: guardian, root: false).as_json@@ -527,7 +527,7 @@ RSpec.describe SiteSerializer doexpect(serialized[:navigation_menu_site_top_tags]).to eq(nil)end- it "should use slug_for_url for tags with empty slugs" do+ it "uses slug_for_url for tags with empty slugs" donumeric_tag =Fabricate(:tag, name: "1").tap { |tag| Fabricate.times(10, :topic, tags: [tag]) }@@ -540,7 +540,7 @@ RSpec.describe SiteSerializer doexpect(numeric_entry[:slug]).to eq("#{numeric_tag.id}-tag")end- it "should return an empty array if site has no top tags" do+ it "returns an empty array when the site has no top tags" doTag.delete_allserialized = described_class.new(Site.new(guardian), scope: guardian, root: false).as_jsondiff --git a/spec/serializers/suggested_topic_serializer_spec.rb b/spec/serializers/suggested_topic_serializer_spec.rbindex dc07ce0b5a9..c8f70adccf1 100644--- a/spec/serializers/suggested_topic_serializer_spec.rb+++ b/spec/serializers/suggested_topic_serializer_spec.rb@@ -25,7 +25,7 @@ RSpec.describe SuggestedTopicSerializer doSiteSetting.topic_featured_link_enabled = falseend- it "should not return featured link attrs" do+ it "omits featured link attributes" doexpect(json[:featured_link]).to eq(nil)expect(json[:featured_link_root_domain]).to eq(nil)end@@ -34,7 +34,7 @@ RSpec.describe SuggestedTopicSerializer docontext "when topic featured link is enabled" dobefore { SiteSetting.topic_featured_link_enabled = true }- it "should return featured link attrs" do+ it "returns featured link attributes" doexpect(json[:featured_link]).to eq(featured_link)expect(json[:featured_link_root_domain]).to eq("discourse.org")enddiff --git a/spec/serializers/tag_serializer_spec.rb b/spec/serializers/tag_serializer_spec.rbindex 853e59360e9..7f11c5ca005 100644--- a/spec/serializers/tag_serializer_spec.rb+++ b/spec/serializers/tag_serializer_spec.rb@@ -25,13 +25,13 @@ RSpec.describe TagSerializer doenddescribe "#topic_count" do- it "should return the value of `Tag#public_topic_count` for a non-staff user" do+ it "returns the public topic count for non-staff users" doserialized = described_class.new(tag, scope: Guardian.new(user), root: false).as_jsonexpect(serialized[:topic_count]).to eq(1)end- it "should return the value of `Tag#topic_count` for a staff user" do+ it "returns the total topic count for staff" doserialized = described_class.new(tag, scope: Guardian.new(admin), root: false).as_jsonexpect(serialized[:topic_count]).to eq(2)diff --git a/spec/serializers/theme_objects_setting_metadata_serializer_spec.rb b/spec/serializers/theme_objects_setting_metadata_serializer_spec.rbindex fa8e8b6655b..1070a2bfad1 100644--- a/spec/serializers/theme_objects_setting_metadata_serializer_spec.rb+++ b/spec/serializers/theme_objects_setting_metadata_serializer_spec.rb@@ -22,7 +22,7 @@ RSpec.describe ThemeObjectsSettingMetadataSerializer dotheme.save!end- it "should return a hash of the settings property descriptions with schema.properties segments stripped" do+ it "returns property descriptions without schema.properties segments" doobjects_setting_localepayload = described_class.new(theme_setting[:objects_setting], root: false).as_json@@ -50,7 +50,7 @@ RSpec.describe ThemeObjectsSettingMetadataSerializer dofab!(:category_3) { Fabricate(:private_category, group: Fabricate(:group)) }fab!(:admin)- it "should return a hash of serialized categories" do+ it "returns serialized categories" dotheme_setting[:objects_with_categories].value = [{"category_ids" => [category_1.id, category_2.id],diff --git a/spec/serializers/theme_serializer_spec.rb b/spec/serializers/theme_serializer_spec.rbindex 6f77f322fc9..23baf5eefae 100644--- a/spec/serializers/theme_serializer_spec.rb+++ b/spec/serializers/theme_serializer_spec.rb@@ -4,7 +4,7 @@ RSpec.describe ThemeSerializer dodescribe ".settings" dofab!(:theme)- it "should add error message when settings format is invalid" do+ it "adds an error for an invalid settings format" doTheme.any_instance.stubs(:settings)@@ -15,7 +15,7 @@ RSpec.describe ThemeSerializer doexpect(serialized[:errors][0]).to eq(I18n.t("themes.settings_errors.invalid_yaml"))end- it "should add errors messages from theme fields" do+ it "adds error messages from theme fields" doerror = "error when compiling theme field"theme_field = Fabricate(:theme_field, error: error, theme: theme)serialized = ThemeSerializer.new(theme.reload).as_json[:theme]@@ -28,11 +28,11 @@ RSpec.describe ThemeSerializer dofab!(:theme) { Fabricate(:theme, color_scheme_id: 1, dark_color_scheme_id: 2) }let(:serialized) { ThemeSerializer.new(theme.reload).as_json[:theme] }- it "should include color scheme id" do+ it "includes the color scheme ID" doexpect(serialized[:color_scheme_id]).to eq(1)end- it "should include dark color scheme id" do+ it "includes the dark color scheme ID" doexpect(serialized[:dark_color_scheme_id]).to eq(2)endend@@ -41,7 +41,7 @@ RSpec.describe ThemeSerializer dofab!(:theme)let(:serialized) { ThemeSerializer.new(theme.reload).as_json[:theme] }- it "should include screenshot_light_url when there is a theme field with screenshot upload type and name 'screenshot_light'" do+ it "includes screenshot_light_url for the light screenshot field" doFabricate(:theme_field,theme: theme,@@ -52,12 +52,12 @@ RSpec.describe ThemeSerializer doexpect(serialized[:screenshot_light_url]).to be_presentend- it "should not include screenshot_light_url/screenshot_dark_url when there is no theme fields of screenshot upload type with names 'screenshot_light' or 'screenshot_dark'" do+ it "omits screenshot URLs when no screenshot fields exist" doexpect(serialized[:screenshot_light_url]).to be_nilexpect(serialized[:screenshot_dark_url]).to be_nilend- it "should handle dark/light screenshot fields and use both" do+ it "includes both dark and light screenshot URLs" dofirst_upload = Fabricate(:upload)second_upload = Fabricate(:upload)Fabricate(diff --git a/spec/serializers/theme_settings_serializer_spec.rb b/spec/serializers/theme_settings_serializer_spec.rbindex f8475ad77c9..fa38c7b1315 100644--- a/spec/serializers/theme_settings_serializer_spec.rb+++ b/spec/serializers/theme_settings_serializer_spec.rb@@ -11,7 +11,7 @@ RSpec.describe ThemeSettingsSerializer doenddescribe "#objects_schema" do- it "should include the attribute when theme setting is typed objects" do+ it "includes the attribute for an objects theme setting" dopayload = ThemeSettingsSerializer.new(theme_setting[:objects_setting]).as_jsonexpect(payload[:theme_settings][:objects_schema][:name]).to eq("section")diff --git a/spec/serializers/topic_list_item_serializer_spec.rb b/spec/serializers/topic_list_item_serializer_spec.rbindex 8ab9dffd023..66898fb573a 100644--- a/spec/serializers/topic_list_item_serializer_spec.rb+++ b/spec/serializers/topic_list_item_serializer_spec.rb@@ -32,7 +32,7 @@ RSpec.describe TopicListItemSerializer dodescribe "when topic featured link is disable" dobefore { SiteSetting.topic_featured_link_enabled = false }- it "should not include the topic's featured link" do+ it "omits the topic's featured link" dotopic.featured_link = "http://meta.discourse.org"serialized = TopicListItemSerializer.new(topic, scope: Guardian.new, root: false).as_jsondiff --git a/spec/serializers/topic_list_serializer_spec.rb b/spec/serializers/topic_list_serializer_spec.rbindex 5b382839eb4..17d20707ebd 100644--- a/spec/serializers/topic_list_serializer_spec.rb+++ b/spec/serializers/topic_list_serializer_spec.rb@@ -7,7 +7,7 @@ RSpec.describe TopicListSerializer dobefore { topic.allowed_user_ids = [topic.user_id] }- it "should return the right payload" do+ it "returns the expected payload" dotopic_list = TopicList.new(nil, user, [topic])serialized = described_class.new(topic_list, scope: Guardian.new(user)).as_jsondiff --git a/spec/serializers/topic_view_posts_serializer_spec.rb b/spec/serializers/topic_view_posts_serializer_spec.rbindex e0aa849c017..6b06f6b9f6f 100644--- a/spec/serializers/topic_view_posts_serializer_spec.rb+++ b/spec/serializers/topic_view_posts_serializer_spec.rb@@ -25,7 +25,7 @@ RSpec.describe TopicViewPostsSerializer do)end- it "should return the right attributes" do+ it "returns the expected attributes" dotopic_view = TopicView.new(topic, user, post_ids: [post.id])serializer =diff --git a/spec/serializers/topic_view_serializer_spec.rb b/spec/serializers/topic_view_serializer_spec.rbindex 5e136df3db9..2ccd19128b1 100644--- a/spec/serializers/topic_view_serializer_spec.rb+++ b/spec/serializers/topic_view_serializer_spec.rb@@ -19,7 +19,7 @@ RSpec.describe TopicViewSerializer dofab!(:featured_link) { "http://meta.discourse.org" }describe "when topic featured link is disable" do- it "should return the right attributes" do+ it "omits featured link attributes" dotopic.update!(featured_link: featured_link)SiteSetting.topic_featured_link_enabled = false@@ -31,7 +31,7 @@ RSpec.describe TopicViewSerializer doenddescribe "when topic featured link is enabled" do- it "should return the right attributes" do+ it "returns the featured link and root domain" dotopic.update!(featured_link: featured_link)json = serialize_topic(topic, user)@@ -46,7 +46,7 @@ RSpec.describe TopicViewSerializer dodescribe "when a topic has an external_id" dobefore { topic.update!(external_id: "42-asdf") }- it "should return the external_id" do+ it "returns the external_id" dojson = serialize_topic(topic, user)expect(json[:external_id]).to eq("42-asdf")end@@ -59,13 +59,13 @@ RSpec.describe TopicViewSerializer dodescribe "when a topic has an image" dobefore { topic.update!(image_upload_id: image_upload.id) }- it "should return the image url" do+ it "returns the image URL" dojson = serialize_topic(topic, user)expect(json[:image_url]).to end_with(image_upload.url)end- it "should have thumbnail jobs enqueued" do+ it "enqueues thumbnail jobs" doSiteSetting.create_thumbnails = trueDiscourse.redis.del(topic.thumbnail_job_redis_key([]))@@ -84,7 +84,7 @@ RSpec.describe TopicViewSerializer doenddescribe "when a topic does not contain an image" do- it "should return a nil image url" do+ it "returns a nil image URL" dojson = serialize_topic(topic, user)expect(json.has_key? :image_url).to eq(true)@@ -98,13 +98,13 @@ RSpec.describe TopicViewSerializer dobefore { TopicUser.update_last_read(user, topic2.id, 0, 0, 0) }- it "should include suggested topics if `TopicView#include_suggested` is set to `true`" do+ it "includes suggested topics when include_suggested is true" dojson = serialize_topic(topic, user, include_suggested: true)expect(json[:suggested_topics].first[:id]).to eq(topic2.id)end- it "should not include suggested topics if `TopicView#include_suggested` is set to `false`" do+ it "omits suggested topics when include_suggested is false" dopost = Fabricate(:post, topic:)post2 = Fabricate(:post, topic:)@@ -209,19 +209,19 @@ RSpec.describe TopicViewSerializer doSiteSetting.pm_tags_allowed_for_groups = "1|2|3|4"end- it "should not include the tag for normal users" do+ it "omits the tag for regular users" dojson = serialize_topic(pm, user)expect(json[:tags]).to eq(nil)end- it "should include the tag for staff users" do+ it "includes the tag for staff" do[moderator, admin].each do |user|json = serialize_topic(pm, user)expect(json[:tags]).to eq([{ id: tag.id, name: tag.name, slug: tag.slug }])endend- it "should include the tag for users in allowed groups" do+ it "includes the tag for users in allowed groups" doSiteSetting.pm_tags_allowed_for_groups = "1|2|3|#{group.id}"user.group_users << Fabricate(:group_user, group: group, user: user)@@ -232,7 +232,7 @@ RSpec.describe TopicViewSerializer doexpect(json[:tags]).to eq(nil)end- it "should not include the tag if pm tags disabled" do+ it "omits the tag when PM tags are disabled" doSiteSetting.pm_tags_allowed_for_groups = ""[moderator, admin].each do |user|@@ -331,7 +331,7 @@ RSpec.describe TopicViewSerializer dofab!(:flagger_1) { Fabricate(:user, refresh_auto_groups: true) }fab!(:flagger_2) { Fabricate(:user, refresh_auto_groups: true) }- it "will return reviewable counts on posts" do+ it "returns reviewable counts on posts" dor = PostActionCreator.inappropriate(flagger_1, post).reviewabler.perform(admin, :agree_and_keep)PostActionCreator.spam(flagger_2, post)@@ -546,7 +546,7 @@ RSpec.describe TopicViewSerializer dobefore { SiteSetting.enable_category_group_moderation = true }# Ensure having enable_category_group_moderation turned on doesn't break private messages- it "should return posts" do+ it "returns posts" dojson = serialize_topic(pm_topic, user)expect(json[:post_stream][:posts]).to be_presentend@@ -591,7 +591,7 @@ RSpec.describe TopicViewSerializer dofab!(:pm) { Fabricate(:private_message_post).topic }fab!(:group)- it "should return the right group name when PM is a group membership request" do+ it "returns the requested group's name for a membership request PM" dopm.custom_fields[:requested_group_id] = group.idpm.save!@@ -602,7 +602,7 @@ RSpec.describe TopicViewSerializer doexpect(json[:requested_group_name]).to eq(group.name)end- it "should not include the attribute for a non group membership request PM" do+ it "omits membership request attributes for other PMs" dojson = serialize_topic(pm, pm.first_post.user)expect(json[:requested_group_name]).to eq(nil)diff --git a/spec/serializers/upload_serializer_spec.rb b/spec/serializers/upload_serializer_spec.rbindex 145f2484535..4852060f597 100644--- a/spec/serializers/upload_serializer_spec.rb+++ b/spec/serializers/upload_serializer_spec.rb@@ -5,7 +5,7 @@ RSpec.describe UploadSerializer dofab!(:upload)- it "should render without errors" do+ it "renders the upload" dojson_data = JSON.parse(serializer.to_json)expect(json_data["id"]).to eql upload.iddiff --git a/spec/serializers/user_export_serializer_spec.rb b/spec/serializers/user_export_serializer_spec.rbindex 67baf737862..c2476fa0d1c 100644--- a/spec/serializers/user_export_serializer_spec.rb+++ b/spec/serializers/user_export_serializer_spec.rb@@ -17,7 +17,7 @@ RSpec.describe UserExportSerializer do)end- it "should render without errors" do+ it "renders the export without errors" dojson_data = JSON.parse(serializer.to_json)expect(json_data["id"]).to eql user_export.iddiff --git a/spec/serializers/web_hook_post_serializer_spec.rb b/spec/serializers/web_hook_post_serializer_spec.rbindex 618722dd0b7..c2547c95618 100644--- a/spec/serializers/web_hook_post_serializer_spec.rb+++ b/spec/serializers/web_hook_post_serializer_spec.rb@@ -8,7 +8,7 @@ RSpec.describe WebHookPostSerializer doWebHookPostSerializer.new(post, scope: Guardian.new(u), root: false).as_jsonend- it "should only include the required keys" do+ it "includes only the required keys" doexpect(serialized_for_user(admin).keys).to contain_exactly(:id,:name,@@ -63,7 +63,7 @@ RSpec.describe WebHookPostSerializer doexpect(serialized_for_user(admin)[:category_id]).to eq(post.topic.category_id)end- it "should only include deleted topic title for staffs" do+ it "includes a deleted topic title only for staff" dotopic = post.topicPostDestroyer.new(Discourse.system_user, post, context: "Automated testing").destroypost.reloaddiff --git a/spec/serializers/web_hook_topic_view_serializer_spec.rb b/spec/serializers/web_hook_topic_view_serializer_spec.rbindex b728087772f..55f1c4b54e2 100644--- a/spec/serializers/web_hook_topic_view_serializer_spec.rb+++ b/spec/serializers/web_hook_topic_view_serializer_spec.rb@@ -10,7 +10,7 @@ RSpec.describe WebHookTopicViewSerializer dobefore { SiteSetting.tagging_enabled = true }- it "should only include the keys that are sent out in the webhook" do+ it "includes only the webhook keys" doexpected_keys = %i[idtitlediff --git a/spec/serializers/web_hook_user_serializer_spec.rb b/spec/serializers/web_hook_user_serializer_spec.rbindex 4824af8b6de..d6aaa8efa0f 100644--- a/spec/serializers/web_hook_user_serializer_spec.rb+++ b/spec/serializers/web_hook_user_serializer_spec.rb@@ -14,13 +14,13 @@ RSpec.describe WebHookUserSerializer doWebHookUserSerializer.new(user, scope: Guardian.new(admin), root: false)end- it "should include relevant user info" do+ it "includes relevant user information" dopayload = serializer.as_jsonexpect(payload[:email]).to eq(user.email)expect(payload[:external_id]).to eq("12345")end- it "should only include the required keys" do+ it "includes only the required keys" doexpect(serializer.as_json.keys).to contain_exactly(:admin,:allowed_pm_usernames,diff --git a/spec/serializers/wizard_serializer_spec.rb b/spec/serializers/wizard_serializer_spec.rbindex b77c6dc2846..9e4f66c6c02 100644--- a/spec/serializers/wizard_serializer_spec.rb+++ b/spec/serializers/wizard_serializer_spec.rb@@ -17,7 +17,7 @@ RSpec.describe WizardSerializer doexpect(json["wizard"]["current_color_scheme"][0]["hex"]).to eq("222")end- it "should provide custom colors correctly" do+ it "returns the custom colors" docolors =ColorScheme.create_from_base(name: "Customized",diff --git a/spec/services/admin_dashboard_section_loader_spec.rb b/spec/services/admin_dashboard_section_loader_spec.rbindex ca5012d868e..44c2cb41716 100644--- a/spec/services/admin_dashboard_section_loader_spec.rb+++ b/spec/services/admin_dashboard_section_loader_spec.rb@@ -1,161 +1,163 @@# frozen_string_literal: truedescribe AdminDashboardSectionLoader do- fab!(:admin)-- after do- if thread_pool = described_class.instance_variable_get(:@thread_pool)- thread_pool.shutdown- thread_pool.wait_for_termination(timeout: 1)- described_class.remove_instance_variable(:@thread_pool)+ context "with transactional tests" do+ fab!(:admin)++ after do+ if thread_pool = described_class.instance_variable_get(:@thread_pool)+ thread_pool.shutdown+ thread_pool.wait_for_termination(timeout: 1)+ described_class.remove_instance_variable(:@thread_pool)+ endend- end- describe ".build" do- it "ensures the sections are built in order with current user and dates" do- AdminDashboardSiteTraffic- .expects(:build)- .with do |kwargs|- kwargs[:start_date] == "2026-05-01" && kwargs[:end_date] == "2026-05-07" &&- kwargs[:guardian].is_a?(Guardian) && kwargs[:guardian].user.id == admin.id- end- .returns({ value: "traffic" })- AdminDashboardEngagement- .expects(:build)- .with(start_date: "2026-05-01", end_date: "2026-05-07", current_user: admin)- .returns({ value: "engagement" })- AdminDashboardSearch- .expects(:build)- .with(start_date: "2026-05-01", end_date: "2026-05-07")- .returns({ value: "search" })-- expect(- described_class.build(- section_ids: %w[traffic engagement search],- current_user: admin,- start_date: "2026-05-01",- end_date: "2026-05-07",- ),- ).to eq(- [- { id: "traffic", data: { value: "traffic" } },- { id: "engagement", data: { value: "engagement" } },- { id: "search", data: { value: "search" } },- ],- )+ describe ".build" do+ it "ensures the sections are built in order with current user and dates" do+ AdminDashboardSiteTraffic+ .expects(:build)+ .with do |kwargs|+ kwargs[:start_date] == "2026-05-01" && kwargs[:end_date] == "2026-05-07" &&+ kwargs[:guardian].is_a?(Guardian) && kwargs[:guardian].user.id == admin.id+ end+ .returns({ value: "traffic" })+ AdminDashboardEngagement+ .expects(:build)+ .with(start_date: "2026-05-01", end_date: "2026-05-07", current_user: admin)+ .returns({ value: "engagement" })+ AdminDashboardSearch+ .expects(:build)+ .with(start_date: "2026-05-01", end_date: "2026-05-07")+ .returns({ value: "search" })++ expect(+ described_class.build(+ section_ids: %w[traffic engagement search],+ current_user: admin,+ start_date: "2026-05-01",+ end_date: "2026-05-07",+ ),+ ).to eq(+ [+ { id: "traffic", data: { value: "traffic" } },+ { id: "engagement", data: { value: "engagement" } },+ { id: "search", data: { value: "search" } },+ ],+ )+ end++ it "returns partial section data when a section fails to build" do+ error = StandardError.new("boom")+ AdminDashboardSiteTraffic.stubs(:build).returns({ value: "traffic" })+ AdminDashboardSearch.stubs(:build).raises(error)+ Discourse.expects(:warn_exception).with(+ error,+ message: "Failed to build admin dashboard section",+ env: {+ section_id: "search",+ },+ )++ expect(+ described_class.build(+ section_ids: %w[traffic search],+ current_user: admin,+ start_date: "2026-05-01",+ end_date: "2026-05-07",+ ),+ ).to eq(+ [{ id: "traffic", data: { value: "traffic" } }, { id: "search", data: nil, error: true }],+ )+ endend- it "returns partial section data when a section fails to build" do- error = StandardError.new("boom")- AdminDashboardSiteTraffic.stubs(:build).returns({ value: "traffic" })- AdminDashboardSearch.stubs(:build).raises(error)- Discourse.expects(:warn_exception).with(- error,- message: "Failed to build admin dashboard section",- env: {- section_id: "search",- },- )+ describe "plugin sections" do+ it "routes a registered plugin section id to its loader block" do+ loader = ->(start_date:, end_date:, current_user:) do+ { value: "support", user: current_user.id }+ end+ DiscoursePluginRegistry.stubs(:admin_dashboard_sections).returns(+ [{ id: "support", enabled: -> { true }, loader: loader }],+ )++ expect(+ described_class.build(+ section_ids: ["support"],+ current_user: admin,+ start_date: "2026-05-01",+ end_date: "2026-05-07",+ ),+ ).to eq([{ id: "support", data: { value: "support", user: admin.id } }])+ end- expect(- described_class.build(- section_ids: %w[traffic search],- current_user: admin,- start_date: "2026-05-01",- end_date: "2026-05-07",- ),- ).to eq(- [{ id: "traffic", data: { value: "traffic" } }, { id: "search", data: nil, error: true }],- )+ it "returns nil data for an unknown section id" do+ DiscoursePluginRegistry.stubs(:admin_dashboard_sections).returns([])++ expect(+ described_class.build(+ section_ids: ["frobnitz"],+ current_user: admin,+ start_date: "2026-05-01",+ end_date: "2026-05-07",+ ),+ ).to eq([{ id: "frobnitz", data: nil }])+ endend- end- describe "plugin sections" do- it "routes a registered plugin section id to its loader block" do- loader = ->(start_date:, end_date:, current_user:) do- { value: "support", user: current_user.id }+ describe ".pool_size" do+ it "caps at the DB connection pool, reserving one for the request thread" do+ ActiveRecord::Base.connection_pool.stubs(:size).returns(3)+ expect(described_class.pool_size).to eq(2)end- DiscoursePluginRegistry.stubs(:admin_dashboard_sections).returns(- [{ id: "support", enabled: -> { true }, loader: loader }],- )- expect(- described_class.build(- section_ids: ["support"],- current_user: admin,- start_date: "2026-05-01",- end_date: "2026-05-07",- ),- ).to eq([{ id: "support", data: { value: "support", user: admin.id } }])- end+ it "uses the desired count when the pool has room to spare" do+ ActiveRecord::Base.connection_pool.stubs(:size).returns(100)+ desired =+ AdminDashboardSectionConfiguration::KNOWN_SECTIONS.size ++ DiscoursePluginRegistry.admin_dashboard_sections.size+ expect(described_class.pool_size).to eq(desired)+ end- it "returns nil data for an unknown section id" do- DiscoursePluginRegistry.stubs(:admin_dashboard_sections).returns([])-- expect(- described_class.build(- section_ids: ["frobnitz"],- current_user: admin,- start_date: "2026-05-01",- end_date: "2026-05-07",- ),- ).to eq([{ id: "frobnitz", data: nil }])+ it "never drops below one" do+ ActiveRecord::Base.connection_pool.stubs(:size).returns(1)+ expect(described_class.pool_size).to eq(1)+ endendend- describe ".pool_size" do- it "caps at the DB connection pool, reserving one for the request thread" do- ActiveRecord::Base.connection_pool.stubs(:size).returns(3)- expect(described_class.pool_size).to eq(2)- end-- it "uses the desired count when the pool has room to spare" do- ActiveRecord::Base.connection_pool.stubs(:size).returns(100)- desired =- AdminDashboardSectionConfiguration::KNOWN_SECTIONS.size +- DiscoursePluginRegistry.admin_dashboard_sections.size- expect(described_class.pool_size).to eq(desired)- end+ context "without transactional tests" do+ self.use_transactional_tests = false- it "never drops below one" do- ActiveRecord::Base.connection_pool.stubs(:size).returns(1)- expect(described_class.pool_size).to eq(1)+ after do+ if thread_pool = described_class.instance_variable_get(:@thread_pool)+ thread_pool.shutdown+ thread_pool.wait_for_termination(timeout: 1)+ described_class.remove_instance_variable(:@thread_pool)+ endend- end-end-describe AdminDashboardSectionLoader do- self.use_transactional_tests = false+ it "returns database connections to the pool once a section finishes building" do+ worker_thread = nil+ loader = ->(start_date:, end_date:, current_user:) do+ worker_thread = Thread.current+ ActiveRecord::Base.connection.execute("SELECT 1")+ { value: "leaky" }+ end+ DiscoursePluginRegistry.stubs(:admin_dashboard_sections).returns(+ [{ id: "leaky", enabled: -> { true }, loader: loader }],+ )- after do- if thread_pool = described_class.instance_variable_get(:@thread_pool)- thread_pool.shutdown- thread_pool.wait_for_termination(timeout: 1)- described_class.remove_instance_variable(:@thread_pool)- end- end+ described_class.build(+ section_ids: ["leaky"],+ current_user: Discourse.system_user,+ start_date: "2026-05-01",+ end_date: "2026-05-07",+ )- it "returns database connections to the pool once a section finishes building" do- worker_thread = nil- loader = ->(start_date:, end_date:, current_user:) do- worker_thread = Thread.current- ActiveRecord::Base.connection.execute("SELECT 1")- { value: "leaky" }- end- DiscoursePluginRegistry.stubs(:admin_dashboard_sections).returns(- [{ id: "leaky", enabled: -> { true }, loader: loader }],- )-- described_class.build(- section_ids: ["leaky"],- current_user: Discourse.system_user,- start_date: "2026-05-01",- end_date: "2026-05-07",- )-- expect(worker_thread).not_to eq(Thread.current)- wait_for do- ActiveRecord::Base.connection_pool.connections.none? { |c| c.owner == worker_thread }+ expect(worker_thread).not_to eq(Thread.current)+ wait_for do+ ActiveRecord::Base.connection_pool.connections.none? { |c| c.owner == worker_thread }+ endendendenddiff --git a/spec/services/auto_silence_spec.rb b/spec/services/auto_silence_spec.rbindex 55e4246e583..517694669ca 100644--- a/spec/services/auto_silence_spec.rb+++ b/spec/services/auto_silence_spec.rb@@ -150,7 +150,7 @@ RSpec.describe SpamRule::AutoSilence dolet(:post2) { Fabricate(:post, user: user) }context "with higher trust levels or staff" do- it "should not autosilence any of them" do+ it "does not automatically silence any users" doPostActionCreator.spam(flagger, post)PostActionCreator.spam(flagger2, post)diff --git a/spec/services/badge_granter_spec.rb b/spec/services/badge_granter_spec.rbindex e274818a70e..6e18bc0329a 100644--- a/spec/services/badge_granter_spec.rb+++ b/spec/services/badge_granter_spec.rb@@ -154,7 +154,7 @@ RSpec.describe BadgeGranter dob.badge_id = Badge::FirstLikeend- it "should grant missing badges" do+ it "grants missing badges" donice_topic = Badge.find(Badge::NiceTopic)good_topic = Badge.find(Badge::GoodTopic)@@ -181,7 +181,7 @@ RSpec.describe BadgeGranter doexpect(good_topic.grant_count).to eq(1)end- it "should grant badges in the user locale" do+ it "grants badges in the user's locale" doSiteSetting.allow_user_locale = truenice_topic = Badge.find(Badge::NiceTopic)diff --git a/spec/services/categories/types/base_spec.rb b/spec/services/categories/types/base_spec.rbindex 0299f188d06..a21a915a23d 100644--- a/spec/services/categories/types/base_spec.rb+++ b/spec/services/categories/types/base_spec.rb@@ -130,7 +130,7 @@ RSpec.describe Categories::Types::Base doendend- describe ".configure_site_settings" do+ describe ".configure_site_settings with scalar defaults" doit "applies site settings from configuration_schema defaults" dotest_type =build_test_type(@@ -544,7 +544,7 @@ RSpec.describe Categories::Types::Base doendend- describe ".configure_site_settings" do+ describe ".configure_site_settings with hash defaults" doit "extracts default from hash config values" dotest_type =build_test_type(diff --git a/spec/services/email_style_updater_spec.rb b/spec/services/email_style_updater_spec.rbindex 674f7a2680f..49f62d707c4 100644--- a/spec/services/email_style_updater_spec.rb+++ b/spec/services/email_style_updater_spec.rb@@ -21,7 +21,7 @@ RSpec.describe EmailStyleUpdater doexpect(SiteSetting.email_custom_css_compiled.strip).to eq("h1{color:blue}")end- it "will not store defaults" do+ it "does not store default styles" doupdater.update(html: default_html, css: "")expect_settings_to_be_unsetenddiff --git a/spec/services/group_action_logger_spec.rb b/spec/services/group_action_logger_spec.rbindex 4a33533c250..b110bd6c53a 100644--- a/spec/services/group_action_logger_spec.rb+++ b/spec/services/group_action_logger_spec.rb@@ -10,7 +10,7 @@ RSpec.describe GroupActionLogger dobefore { group.add_owner(group_owner) }describe "#log_make_user_group_owner" do- it "should create the right record" do+ it "records making the user a group owner" dologger.log_make_user_group_owner(user)group_history = GroupHistory.last@@ -22,7 +22,7 @@ RSpec.describe GroupActionLogger doenddescribe "#log_remove_user_as_group_owner" do- it "should create the right record" do+ it "records removing the user as a group owner" dologger.log_remove_user_as_group_owner(user)group_history = GroupHistory.last@@ -35,7 +35,7 @@ RSpec.describe GroupActionLogger dodescribe "#log_add_user_to_group" docontext "as a group owner" do- it "should create the right record" do+ it "records the group owner's action" dologger.log_add_user_to_group(user)group_history = GroupHistory.last@@ -51,7 +51,7 @@ RSpec.describe GroupActionLogger dobefore { group.update!(public_admission: true) }- it "should create the right record" do+ it "records the regular user's action" dologger.log_add_user_to_group(user)group_history = GroupHistory.last@@ -65,7 +65,7 @@ RSpec.describe GroupActionLogger dodescribe "#log_remove_user_from_group" docontext "as group owner" do- it "should create the right record" do+ it "records the group owner's action" dologger.log_remove_user_from_group(user)group_history = GroupHistory.last@@ -81,7 +81,7 @@ RSpec.describe GroupActionLogger dobefore { group.update!(public_exit: true) }- it "should create the right record" do+ it "records the regular user's action" dologger.log_remove_user_from_group(user)group_history = GroupHistory.last@@ -195,7 +195,7 @@ RSpec.describe GroupActionLogger doenddescribe "#log_change_group_settings" do- it "should create the right record" do+ it "records the group settings change" dogroup.update!(public_admission: true, created_at: Time.zone.now)expect { logger.log_change_group_settings }.to change { GroupHistory.count }.by(1)diff --git a/spec/services/group_mentions_updater_spec.rb b/spec/services/group_mentions_updater_spec.rbindex deafebdac06..3ad3c578f7d 100644--- a/spec/services/group_mentions_updater_spec.rb+++ b/spec/services/group_mentions_updater_spec.rb@@ -6,7 +6,7 @@ RSpec.describe GroupMentionsUpdater dobefore { Jobs.run_immediately! }describe ".update" do- it "should update valid group mentions" do+ it "updates valid group mentions" donew_group_name = "awesome_team"old_group_name = "team"@@ -29,7 +29,7 @@ RSpec.describe GroupMentionsUpdater doendend- it "should not update invalid group mentions" do+ it "does not update invalid group mentions" dogroup = Fabricate(:group, name: "team", mentionable_level: Group::ALIAS_LEVELS[:everyone])post.update!(raw: "This is not [email protected]")@@ -41,7 +41,7 @@ RSpec.describe GroupMentionsUpdater doexpect(post.reload.raw_mentions).to eq([])end- it "should update the category description when a category description topic mentions the group" do+ it "updates a category description that mentions the group" dogroup = Fabricate(:group, name: "old_team", mentionable_level: Group::ALIAS_LEVELS[:everyone])category = Fabricate(:category_with_definition)@@ -58,7 +58,7 @@ RSpec.describe GroupMentionsUpdater doexpect(category.description).not_to include("old_team")end- it "should ignore validations" do+ it "ignores validations" doeveryone_mention_level = Group::ALIAS_LEVELS[:everyone]%w[awesome_team pro_team].each do |name|diff --git a/spec/services/group_message_spec.rb b/spec/services/group_message_spec.rbindex 37dbf27f14b..c2246ef8a5f 100644--- a/spec/services/group_message_spec.rb+++ b/spec/services/group_message_spec.rb@@ -15,7 +15,7 @@ RSpec.describe GroupMessage dodescribe "not sent recently" dobefore { GroupMessage.any_instance.stubs(:sent_recently?).returns(false) }- it "should send a private message to the given group" do+ it "sends a private message to the given group" doPostCreator.expects(:create).with do |from_user, opts|@@ -50,7 +50,7 @@ RSpec.describe GroupMessage doit { is_expected.to eq(false) }- it "should not send the same notification again" do+ it "does not send the same notification again" doPostCreator.expects(:create).nevergroup_messageenddiff --git a/spec/services/inline_uploads_multisite_spec.rb b/spec/services/inline_uploads_multisite_spec.rbindex f616cf70042..50c263d1566 100644--- a/spec/services/inline_uploads_multisite_spec.rb+++ b/spec/services/inline_uploads_multisite_spec.rb@@ -15,7 +15,7 @@ RSpec.describe InlineUploads, type: :multisite doSiteSetting.s3_cdn_url = "https://s3.cdn.com"end- it "should correct image URLs in multisite" do+ it "corrects image URLs in multisite" domd = <<~MDhttps:#{upload2.url} https:#{upload2.url}#{URI.join(SiteSetting.s3_cdn_url, URI.parse(upload2.url).path)}diff --git a/spec/services/inline_uploads_spec.rb b/spec/services/inline_uploads_spec.rbindex 9d1ee64361a..6fdf2ef828b 100644--- a/spec/services/inline_uploads_spec.rb+++ b/spec/services/inline_uploads_spec.rb@@ -8,7 +8,7 @@ RSpec.describe InlineUploads dofab!(:upload2, :upload)fab!(:upload3, :upload)- it "should not correct existing inline uploads" do+ it "does not change existing inline uploads" domd = <<~MDhaha[test]#{upload.short_url}@@ -24,19 +24,19 @@ RSpec.describe InlineUploads doexpect(InlineUploads.process(md)).to eq(md)end- it "should not escape existing content" do+ it "does not escape existing content" domd = "1 > 2"expect(InlineUploads.process(md)).to eq(md)end- it "should not escape invalid HTML tags" do+ it "does not escape invalid HTML tags" domd = "<x>.<y>"expect(InlineUploads.process(md)).to eq(md)end- it "should work with invalid img tags" do+ it "handles invalid image tags" domd = <<~MD<img src="#{upload.url}">@@ -53,7 +53,7 @@ RSpec.describe InlineUploads doexpect(InlineUploads.process(md)).to eq(md)end- it "should not correct code blocks" do+ it "does not change code blocks" domd = "`<a class=\"attachment\" href=\"#{upload2.url}\">In Code Block</a>`"expect(InlineUploads.process(md)).to eq(md)@@ -63,7 +63,7 @@ RSpec.describe InlineUploads doexpect(InlineUploads.process(md)).to eq(md)end- it "should not correct invalid links in quotes" do+ it "does not change invalid links in quotes" dopost = Fabricate(:post)user = Fabricate(:user)@@ -102,7 +102,7 @@ RSpec.describe InlineUploads doMDend- it "should correct links in quotes" do+ it "shortens upload links in quotes" dopost = Fabricate(:post)user = Fabricate(:user)@@ -127,7 +127,7 @@ RSpec.describe InlineUploads doMDend- it "should correct markdown linked images" do+ it "shortens Markdown-linked images" domd = <<~MD[](https://somelink.com)@@ -141,7 +141,7 @@ RSpec.describe InlineUploads doMDend- it "should correct markdown images with title" do+ it "shortens Markdown images with titles" domd = <<~MD@@ -153,7 +153,7 @@ RSpec.describe InlineUploads doMDend- it "should correct bbcode img URLs to the short version" do+ it "shortens BBCode image URLs" domd = <<~MD[img]http://some.external.img[/img][img]#{upload.url}[/img]@@ -177,7 +177,7 @@ RSpec.describe InlineUploads doMDend- it "should correct bbcode img URLs with non-standard dimension syntax" do+ it "shortens BBCode image URLs with nonstandard dimensions" domd = <<~MD[img=100x200]#{upload.url}[/img][IMG=640x480]#{upload2.url}[/IMG]@@ -193,7 +193,7 @@ RSpec.describe InlineUploads doMDend- it "should correct markdown references" do+ it "shortens Markdown references" domd = <<~MD[link3][3]@@ -221,7 +221,7 @@ RSpec.describe InlineUploads doMDend- it "should correct html and markdown uppercase references" do+ it "shortens uppercase HTML and Markdown references" domd = <<~MD[IMG]#{upload.url}[/IMG]<IMG src="#{upload2.url}" />@@ -235,7 +235,7 @@ RSpec.describe InlineUploads doMDend- it "should correct image URLs with v parameters" do+ it "shortens image URLs with version parameters" domd = <<~MD<img src="#{upload.url}?v=1">@@ -264,7 +264,7 @@ RSpec.describe InlineUploads docontext "with subfolder" dobefore { set_subfolder "/community" }- it "should correct subfolder images" do+ it "shortens image URLs in subfolder installations" domd = <<~MD<img src="/community#{upload.url}">@@ -279,7 +279,7 @@ RSpec.describe InlineUploads doendend- it "should correct raw image URLs to the short url and paths" do+ it "shortens raw image URLs and paths" domd = <<~MD#{Discourse.base_url}#{upload.url}@@ -301,7 +301,7 @@ RSpec.describe InlineUploads doMDend- it "should correct non image URLs to the short url" do+ it "shortens non-image upload URLs" doSiteSetting.authorized_extensions = "mp4"upload = Fabricate(:video_upload)upload2 = Fabricate(:video_upload)@@ -323,7 +323,7 @@ RSpec.describe InlineUploads doMDend- it "should correct img tags with uppercase upload extension" do+ it "shortens image tags with uppercase upload extensions" domd = <<~MDtest<img src="#{upload.url.sub(".png", ".PNG")}">MD@@ -333,7 +333,7 @@ RSpec.describe InlineUploads doMDend- it "should correct image URLs that follows an image md" do+ it "shortens image URLs following Markdown images" domd = <<~MD#{Discourse.base_url}#{upload2.url}@@ -347,7 +347,7 @@ RSpec.describe InlineUploads doMDend- it "should correct image URLs to the short version" do+ it "shortens image URLs" domd = <<~MD@@ -399,7 +399,7 @@ RSpec.describe InlineUploads doMDend- it "should not replace identical markdown in code blocks", skip: "Known issue" do+ it "does not replace identical Markdown in code blocks", skip: "Known issue" domd = <<~MD``@@ -411,7 +411,7 @@ RSpec.describe InlineUploads doMDend- it "should not be affected by an emoji" do+ it "preserves adjacent emoji" doCustomEmoji.create!(name: "test", upload: upload3)Emoji.clear_cache@@ -428,7 +428,7 @@ RSpec.describe InlineUploads doMDend- it "should correctly update images sources within anchor tags with indentation" do+ it "updates indented image sources inside anchor tags" domd = <<~MD<h1></h1><a href="http://somelink.com">@@ -459,7 +459,7 @@ RSpec.describe InlineUploads do)end- it "should correctly update image sources within anchor or paragraph tags" do+ it "updates image sources inside anchor and paragraph tags" domd = <<~MD<a href="http://somelink.com"><img src="#{upload.url}" alt="test" width="500" height="500">@@ -513,7 +513,7 @@ RSpec.describe InlineUploads doMDend- it "should not be affected by fake HTML tags" do+ it "ignores fake HTML tags" domd = <<~MD```This is some <img src=" and <a href="@@ -543,7 +543,7 @@ RSpec.describe InlineUploads doMDend- it "should not be affected by an external or invalid links" do+ it "ignores external and invalid links" domd = <<~MD<a id="test">invalid</a>@@ -565,7 +565,7 @@ RSpec.describe InlineUploads doMDend- it "should correct attachment URLS to the short version when raw contains inline image" do+ it "shortens attachment URLs alongside inline images" domd = <<~MD @@ -583,7 +583,7 @@ RSpec.describe InlineUploads doMDend- it "should correct attachment URLs to the short version" do+ it "shortens attachment URLs" domd = <<~MD<a class="attachment" href="#{upload.url}">this@@ -627,7 +627,7 @@ RSpec.describe InlineUploads doMDend- it "should correct full upload url to the shorter version" do+ it "shortens full upload URLs" domd = <<~MDSome random text@@ -694,7 +694,7 @@ RSpec.describe InlineUploads doSiteSetting.s3_cdn_url = "https://s3.cdn.com"end- it "should correct image URLs to the short version" do+ it "shortens image URLs" domd = <<~MD#{upload.url}<img src="#{upload.url}" alt="some image">@@ -710,7 +710,7 @@ RSpec.describe InlineUploads doMDend- it "should correct markdown references" do+ it "shortens Markdown references" domd = <<~MDThis is a [some reference] somethingdiff --git a/spec/services/post_action_notifier_spec.rb b/spec/services/post_action_notifier_spec.rbindex d0ea7ad99a4..c9c5859ddf0 100644--- a/spec/services/post_action_notifier_spec.rb+++ b/spec/services/post_action_notifier_spec.rb@@ -210,7 +210,7 @@ RSpec.describe PostActionNotifier doFabricate(:post, topic: private_message, user: user, raw: "Hello @eviltrout")end- it "won't notify someone who can't see the post" do+ it "does not notify users who cannot see the post" doexpect { PostAlerter.post_created(mention_post) }.not_to change(evil_trout.notifications,:count,@@ -232,7 +232,7 @@ RSpec.describe PostActionNotifier dofab!(:first_post) { Fabricate(:post, user: user, raw: "A useless post for you.") }let(:topic) { first_post.topic }- it "should not notify anyone" do+ it "does not notify anyone" doexpect {Fabricate(:post,diff --git a/spec/services/post_alerter_spec.rb b/spec/services/post_alerter_spec.rbindex 3ddbd0b94af..fe8712e3ef7 100644--- a/spec/services/post_alerter_spec.rb+++ b/spec/services/post_alerter_spec.rb@@ -585,7 +585,7 @@ RSpec.describe PostAlerter do}.to change(evil_trout.notifications, :count).by(2)end- it "won't notify the user a second time on revision" do+ it "does not notify the user again on revision" dop1 = create_post_with_alerts(raw: '[quote="Evil Trout, post:1"]whatup[/quote]')expect {p1.revise(p1.user, raw: '[quote="Evil Trout, post:1"]whatup now?[/quote]')@@ -677,7 +677,7 @@ RSpec.describe PostAlerter dobefore { Jobs.run_immediately! }- it "will notify correctly on linking" do+ it "notifies the linked user" dolinking_postexpect(user.notifications.count).to eq(1)@@ -873,7 +873,7 @@ RSpec.describe PostAlerter doexpect { mention_post }.to change(evil_trout.notifications, :count).by(1)end- it "won't notify the user a second time on revision" do+ it "does not notify the user again on revision" domention_postexpect {mention_post.revise(@@ -1876,7 +1876,7 @@ RSpec.describe PostAlerter do).to eq(true)end- it "it doesn't notify about small action posts when the topic author is watching the topic " do+ it "does not notify the watching topic author about small action posts" doJobs.run_immediately!u1 = Fabricate(:admin)@@ -2743,7 +2743,7 @@ RSpec.describe PostAlerter do)end- it "should use the first post of the topic" do+ it "uses the first post of the topic" dotopic_linkexpect(PostAlerter.new.extract_linked_users(post.reload)).to eq([post2.user])enddiff --git a/spec/services/post_owner_changer_spec.rb b/spec/services/post_owner_changer_spec.rbindex 95f26251100..3b4d014ae24 100644--- a/spec/services/post_owner_changer_spec.rb+++ b/spec/services/post_owner_changer_spec.rb@@ -308,7 +308,7 @@ RSpec.describe PostOwnerChanger dolet(:pm) { create_post(archetype: "private_message", target_usernames: [p2user.username]) }let(:pm_poster) { pm.user }- it "should update users' counts" do+ it "updates the users' counts" doPostActionCreator.like(p2user, pm)expect {diff --git a/spec/services/problem_check/maxmind_db_configuration_spec.rb b/spec/services/problem_check/maxmind_db_configuration_spec.rbindex f5981993139..c103b032d3f 100644--- a/spec/services/problem_check/maxmind_db_configuration_spec.rb+++ b/spec/services/problem_check/maxmind_db_configuration_spec.rb@@ -4,19 +4,19 @@ RSpec.describe ProblemCheck::MaxmindDbConfiguration dosubject(:check) { described_class.new }context "when `maxmind_license_key` and `maxmind_account_id` global settings are not set" do- it "should not raise any warning message" do+ it "reports no problem" doexpect(check).to be_chill_about_itendendcontext "when `maxmind_license_key` and `maxmind_account_id` global settings are set" do- it "should not raise any warning message" do+ it "reports no problem" doexpect(check).to be_chill_about_itendendcontext "when `maxmind_license_key` global setting is set but not `maxmind_account_id`" do- it "should raise the right warning" do+ it "reports a low-priority MaxMind configuration warning" doglobal_setting :maxmind_license_key, "license_key"expect(check).to have_a_problem.with_priority("low").with_message(diff --git a/spec/services/search_indexer_spec.rb b/spec/services/search_indexer_spec.rbindex 2fc31d5ce4d..4bd65ce77f5 100644--- a/spec/services/search_indexer_spec.rb+++ b/spec/services/search_indexer_spec.rb@@ -162,7 +162,7 @@ RSpec.describe SearchIndexer dolet(:topic) { Fabricate(:topic, title: "this is a title that I am testing") }let(:post) { Fabricate(:post, topic: topic) }- it "should index posts correctly" do+ it "indexes post content" doexpect { post }.to change { PostSearchData.count }.by(1)expect { post.update!(raw: "this is new content") }.to change {@@ -174,7 +174,7 @@ RSpec.describe SearchIndexer do}end- it "should work with edge case domain names" do+ it "indexes edge-case domain names" do# 00E5A4 stems to 00e5 and a4, which is odd, but by-design# this may cause internal indexing to fail due to indexes not aligning# when stuffing terms for domains@@ -192,7 +192,7 @@ RSpec.describe SearchIndexer do)end- it "should work with invalid HTML" do+ it "handles invalid HTML" dopost.update!(cooked: "<FD>" * Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH)SearchIndexer.update_posts_index(@@ -205,14 +205,14 @@ RSpec.describe SearchIndexer do)end- it "should not index posts with empty raw" do+ it "does not index posts with empty raw content" doexpect dopost = Fabricate.build(:post, raw: "", post_type: Post.types[:small_action])post.save!(validate: false)end.to_not change { PostSearchData.count }end- it "should not tokenize urls and duplicate title and href in <a>" do+ it "does not duplicate anchor titles and URLs as tokens" dopost.update!(raw: <<~RAW)https://meta.discourse.org/some.pngRAW@@ -227,7 +227,7 @@ RSpec.describe SearchIndexer do)end- it "should not tokenize versions" do+ it "does not tokenize version numbers" dopost.update!(raw: "123.223")expect(post.post_search_data.search_data).to eq(@@ -242,7 +242,7 @@ RSpec.describe SearchIndexer do)end- it "should tokenize host of a URL and removes query string" do+ it "tokenizes URL hosts without query strings" docategory = Fabricate(:category, name: "awesome category")topic = Fabricate(:topic, category: category, title: "this is a test topic")@@ -269,7 +269,7 @@ RSpec.describe SearchIndexer do)end- it "should not include lightbox in search" do+ it "excludes lightbox markup from search" doJobs.run_immediately!SiteSetting.max_image_width = 1@@ -292,7 +292,7 @@ RSpec.describe SearchIndexer do)end- it "should strips audio and videos URLs from raw data" do+ it "strips audio and video URLs from raw content" doSiteSetting.authorized_extensions = "mp4"Fabricate(:video_upload)@@ -315,7 +315,7 @@ RSpec.describe SearchIndexer do)end- it "should unaccent indexed content" do+ it "removes accents from indexed content" doSiteSetting.search_ignore_accents = truepost.update!(raw: "Cette oeuvre d'art n'est pas une œuvre")post.post_search_data.reload@@ -379,7 +379,7 @@ RSpec.describe SearchIndexer dolet(:post) { Fabricate(:post) }let(:topic) { post.topic }- it "should reset the version of search data for all posts in the topic" do+ it "resets search-data versions for every post in the topic" dopost2 = Fabricate(:post)SearchIndexer.queue_post_reindex(topic.id)@@ -394,7 +394,7 @@ RSpec.describe SearchIndexer dolet!(:user) { Fabricate(:user) }let!(:user2) { Fabricate(:user) }- it "should reset the version of search data for all users" do+ it "resets search-data versions for every user" doSearchIndexer.index(user, force: true)SearchIndexer.index(user2, force: true)SearchIndexer.queue_users_reindex([user.id])diff --git a/spec/services/site_settings_spec.rb b/spec/services/site_settings_spec.rbindex 2e24061f6cc..86fcd356061 100644--- a/spec/services/site_settings_spec.rb+++ b/spec/services/site_settings_spec.rb@@ -41,14 +41,14 @@ RSpec.describe SiteSettingsTask doexpect(SiteSetting.default_theme_id).to eq(999_999_999)end- it "won't update a setting that doesn't exist" do+ it "does not update a missing setting" doyml = "fake_setting: foo"log, counts = SiteSettingsTask.import(yml)expect(log[0]).to eq "NOT FOUND: existing site setting not found for fake_setting"expect(counts[:not_found]).to eq 1end- it "will log that an error has occurred" do+ it "logs the missing-setting error" doyml = "min_password_length: 0"log, counts = SiteSettingsTask.import(yml)expect(log[0]).to eq "ERROR: min_password_length: Value must be between 8 and 500."diff --git a/spec/services/themes/theme_site_setting_manager_spec.rb b/spec/services/themes/theme_site_setting_manager_spec.rbindex adbaa53d86e..f2ab21da9fd 100644--- a/spec/services/themes/theme_site_setting_manager_spec.rb+++ b/spec/services/themes/theme_site_setting_manager_spec.rb@@ -72,7 +72,7 @@ RSpec.describe Themes::ThemeSiteSettingManager do).to(false)end- it "should publish changes to clients for client site settings" do+ it "publishes client site-setting changes" domessage = MessageBus.track_publish("/client_settings") { result }.firstexpect(message.data).to eq({ name: :enable_welcome_banner, scoped_to: { theme_id: theme.id }, value: false },@@ -121,7 +121,7 @@ RSpec.describe Themes::ThemeSiteSettingManager do).to(false)end- it "should publish changes to clients for client site settings" do+ it "publishes client site-setting changes" domessage = MessageBus.track_publish("/client_settings") { result }.firstexpect(message.data).to eq({ name: :enable_welcome_banner, scoped_to: { theme_id: theme.id }, value: false },@@ -173,7 +173,7 @@ RSpec.describe Themes::ThemeSiteSettingManager do).to(true)end- it "should publish changes to clients for client site settings" do+ it "publishes client site-setting changes" domessage = MessageBus.track_publish("/client_settings") { result }.firstexpect(message.data).to eq({ name: :enable_welcome_banner, scoped_to: { theme_id: theme.id }, value: true },diff --git a/spec/services/topic_timestamp_changer_spec.rb b/spec/services/topic_timestamp_changer_spec.rbindex dbde22d5ff8..1fce728244a 100644--- a/spec/services/topic_timestamp_changer_spec.rb+++ b/spec/services/topic_timestamp_changer_spec.rb@@ -10,7 +10,7 @@ RSpec.describe TopicTimestampChanger docontext "when new timestamp is in the future" dolet(:new_timestamp) { old_timestamp + 2.days }- it "should raise the right error" do+ it "raises the expected error" doexpect {TopicTimestampChanger.new(topic: topic, timestamp: new_timestamp.to_f).change!}.to raise_error(TopicTimestampChanger::InvalidTimestampError)@@ -42,7 +42,7 @@ RSpec.describe TopicTimestampChanger doendcontext "when posts have timestamps in the future" do- it "should set the new timestamp as the default timestamp" do+ it "sets the new timestamp as the default" donew_timestamp = freeze_timep3 = Fabricate(:post, topic: topic, created_at: new_timestamp + 3.days)diff --git a/spec/services/user_authenticator_spec.rb b/spec/services/user_authenticator_spec.rbindex c96db48880f..604f1a67c9d 100644--- a/spec/services/user_authenticator_spec.rb+++ b/spec/services/user_authenticator_spec.rb@@ -21,7 +21,7 @@ RSpec.describe UserAuthenticator dodescribe "#start" dodescribe "without authentication session" do- it "should apply the right user attributes" do+ it "requires a password without an authentication session" douser = User.newUserAuthenticator.new(user, {}).startdiff --git a/spec/services/user_destroyer_spec.rb b/spec/services/user_destroyer_spec.rbindex b0e23620040..027def05f30 100644--- a/spec/services/user_destroyer_spec.rb+++ b/spec/services/user_destroyer_spec.rb@@ -32,22 +32,22 @@ RSpec.describe UserDestroyer doendshared_examples "successfully destroy a user" do- it "should delete the user" do+ it "deletes the user" doexpect { destroy }.to change { User.count }.by(-1)end- it "should return the deleted user record" do+ it "returns the deleted user record" doreturn_value = destroyexpect(return_value).to eq(user)expect(return_value).to be_destroyedend- it "should log the action" do+ it "logs the action" doStaffActionLogger.any_instance.expects(:log_user_deletion).with(user, anything).oncedestroyend- it "should not log the action if quiet is true" do+ it "does not log the action when quiet is true" doexpect {UserDestroyer.new(admin).destroy(user, destroy_opts.merge(quiet: true))}.to_not change { UserHistory.where(action: UserHistory.actions[:delete_user]).count }@@ -239,7 +239,7 @@ RSpec.describe UserDestroyer douser.stubs(:first_post_created_at).returns(Time.zone.now)end- it "should raise the right error" do+ it "raises the expected error" doStaffActionLogger.any_instance.expects(:log_user_deletion).neverexpect { destroy }.to raise_error(UserDestroyer::PostsExistError)expect(user.reload.id).to be_present@@ -376,7 +376,7 @@ RSpec.describe UserDestroyer doendcontext "when user was invited" do- it "should delete the invite of user" do+ it "deletes the user's invite" doinvite = Fabricate(:invite)topic_invite = invite.topic_invites.create!(topic: Fabricate(:topic))invited_group = invite.invited_groups.create!(group: Fabricate(:group))@@ -390,7 +390,7 @@ RSpec.describe UserDestroyer doexpect(TopicInvite.exists?(topic_invite.id)).to eq(false)end- it "should delete invites matching associated account emails" do+ it "deletes invites matching associated-account emails" douser = Fabricate(:user)invite = Fabricate(:invite, email: "[email protected]")UserAssociatedAccount.create!(@@ -441,7 +441,7 @@ RSpec.describe UserDestroyer docontext "when user has deleted posts" dolet!(:deleted_post) { Fabricate(:post, user: user, deleted_at: 1.hour.ago) }- it "should mark the user's deleted posts as belonging to a nuked user" do+ it "marks deleted posts as belonging to a nuked user" doexpect { UserDestroyer.new(admin).destroy(user) }.to change { User.count }.by(-1)expect(deleted_post.reload.user_id).to eq(nil)end@@ -460,7 +460,7 @@ RSpec.describe UserDestroyer docontext "when destroy fails" dosubject(:destroy) { UserDestroyer.new(admin).destroy(user) }- it "should not log the action" do+ it "does not log the action" douser.stubs(:destroy).returns(false)StaffActionLogger.any_instance.expects(:log_user_deletion).neverdestroy@@ -582,7 +582,7 @@ RSpec.describe UserDestroyer doPostActionCreator.like(user, @post)end- it "should destroy the like" do+ it "destroys the like" doexpect { UserDestroyer.new(admin).destroy(user, delete_posts: true) }.to change {PostAction.count}.by(-1)@@ -634,7 +634,7 @@ RSpec.describe UserDestroyer do)end- it "should keep the staff action log and add the username" do+ it "keeps the staff action log and adds the username" dousername = user.usernameids =UserHistory.staff_action_records(Discourse.system_user, acting_user: username).map(&:id)diff --git a/spec/services/user_password_expirer_spec.rb b/spec/services/user_password_expirer_spec.rbindex f5c7d7695b7..479d0c77be1 100644--- a/spec/services/user_password_expirer_spec.rb+++ b/spec/services/user_password_expirer_spec.rb@@ -5,7 +5,7 @@ RSpec.describe UserPasswordExpirer dofab!(:user) { Fabricate(:user, password:) }describe ".expire_user_password" do- it "should update `UserPassword#password_expired_at` if the user already has an existing UserPassword record with the same password hash, salt and algorithm" do+ it "updates password_expired_at on an existing matching password record" dofreeze_time(1.hour.ago) dodescribed_class.expire_user_password(user)diff --git a/spec/services/user_stat_count_updater_spec.rb b/spec/services/user_stat_count_updater_spec.rbindex ce8f4d68160..6c0ef1e1506 100644--- a/spec/services/user_stat_count_updater_spec.rb+++ b/spec/services/user_stat_count_updater_spec.rb@@ -15,7 +15,7 @@ RSpec.describe UserStatCountUpdater doafter { Rails.logger.stop_broadcasting_to(fake_logger) }- it "should log the exception when a negative count is inserted" do+ it "logs the exception when a negative count is inserted" doUserStatCountUpdater.decrement!(post, user_stat: user_stat)expect(fake_logger.warnings.last).to match("topic_count")@@ -27,7 +27,7 @@ RSpec.describe UserStatCountUpdater doexpect(fake_logger.warnings.last).to match(post_2.id.to_s)end- it "should log the exception when a negative count will be inserted but 0 is used instead" do+ it "logs the exception when zero replaces a negative count" doUserStatCountUpdater.set!(user_stat: user_stat, count: -10, count_column: :post_count)expect(fake_logger.warnings.last).to match("post_count")diff --git a/spec/services/username_changer_spec.rb b/spec/services/username_changer_spec.rbindex 9c9f3dfa20b..0062a212be2 100644--- a/spec/services/username_changer_spec.rb+++ b/spec/services/username_changer_spec.rb@@ -9,7 +9,7 @@ RSpec.describe UsernameChanger docontext "when everything goes well" dolet!(:old_username) { user.username }- it "should change the username" do+ it "changes the username" donew_username = "#{user.username}1234"events =@@ -49,7 +49,7 @@ RSpec.describe UsernameChanger dolet(:username_before_change) { user.username }let(:username_lower_before_change) { user.username_lower }- it "should not change the username" do+ it "does not change the username" do@result = UsernameChanger.change(user, wrong_username)expect(@result).to eq(false)@@ -62,7 +62,7 @@ RSpec.describe UsernameChanger docontext "when changing the case of my username" dolet!(:myself) { Fabricate(:user, username: "hansolo") }- it "should change the username" do+ it "changes the username" doexpect doexpect(UsernameChanger.change(myself, "HanSolo", myself)).to eq(true)end.to change { UserHistory.count }.by(1)@@ -87,17 +87,17 @@ RSpec.describe UsernameChanger doSiteSetting.min_username_length = @custom_minend- it "should allow a shorter username than default" do+ it "allows a username shorter than the default minimum" doresult = UsernameChanger.change(user, "a" * @custom_min)expect(result).not_to eq(false)end- it "should not allow a shorter username than limit" do+ it "rejects a username shorter than the configured minimum" doresult = UsernameChanger.change(user, "a" * (@custom_min - 1))expect(result).to eq(false)end- it "should not allow a longer username than limit" do+ it "rejects a username longer than the maximum" doresult = UsernameChanger.change(user, "a" * (User.username_length.end + 1))expect(result).to eq(false)end@@ -380,7 +380,7 @@ RSpec.describe UsernameChanger dolet(:user) { Fabricate(:user, username: "թռչուն") }- it "it correctly updates mentions" do+ it "updates mentions" dopost = create_post_and_change_username(raw: "Hello @թռչուն", target_username: "птица")expect(post.raw).to eq("Hello @птица")diff --git a/spec/system/admin_customize_form_templates_spec.rb b/spec/system/admin_customize_form_templates_spec.rbindex 5fb30abdd52..5b38e8d028a 100644--- a/spec/system/admin_customize_form_templates_spec.rb+++ b/spec/system/admin_customize_form_templates_spec.rb@@ -16,28 +16,28 @@ describe "Admin Customize Form Templates" dodescribe "when visiting the page to customize form templates" dobefore { category.update!(form_template_ids: [form_template.id]) }- it "should show the existing form templates in a table" do+ it "shows existing form templates in a table" doform_template_page.visitexpect(form_template_page).to have_form_template_tableexpect(form_template_page).to have_form_template(form_template.name)end- it "should show the categories the form template is used in" do+ it "shows the categories using each form template" doform_template_page.visitexpect(form_template_page).to have_form_template_tableexpect(form_template_page).to have_category_in_template_row(category.name)end- it "should show the form template structure in a modal" do+ it "shows the form-template structure in a modal" doform_template_page.visitform_template_page.click_view_form_templateexpect(form_template_page).to have_template_structure("- type: input")end- it "should show a preview of the template in a modal when toggling the preview" do+ it "shows a template preview when the preview is toggled" doform_template_page.visitform_template_page.click_view_form_template@@ -46,14 +46,14 @@ describe "Admin Customize Form Templates" doendcontext "when using the view template modal" do- it "should navigate to the edit page when clicking the edit button" do+ it "opens the edit page from the edit button" doform_template_page.visitform_template_page.click_view_form_templateform_template_page.find(".d-modal__footer .btn-primary").clickexpect(page).to have_current_path("/admin/customize/form-templates/#{form_template.id}")end- it "should delete the form template when clicking the delete button" do+ it "deletes the form template from the delete button" doform_template_page.visitoriginal_template_name = form_template.nameform_template_page.click_view_form_template@@ -66,7 +66,7 @@ describe "Admin Customize Form Templates" doenddescribe "when visiting the page to edit a form template" do- it "should prefill form data" do+ it "prefills the form data" dovisit("/admin/customize/form-templates/#{form_template.id}")expect(form_template_page).to have_name_value(form_template.name)expect(ace_editor).to have_content(form_template.template)@@ -81,7 +81,7 @@ describe "Admin Customize Form Templates" doenddescribe "when visiting the page to create a new form template" do- it "should allow admin to create a new form template" do+ it "allows an administrator to create a form template" doform_template_page.visit_newsample_name = "My First Template"@@ -93,7 +93,7 @@ describe "Admin Customize Form Templates" doexpect(form_template_page).to have_form_template(sample_name)end- it "should disable the save button until form is filled out" do+ it "disables saving until the form is complete" doform_template_page.visit_newexpect(form_template_page).to have_save_button_with_state(disabled: true)form_template_page.type_in_template_name("New Template")@@ -102,7 +102,7 @@ describe "Admin Customize Form Templates" doexpect(form_template_page).to have_save_button_with_state(disabled: false)end- it "should disable the preview button until form is filled out" do+ it "disables previewing until the form is complete" doform_template_page.visit_newexpect(form_template_page).to have_preview_button_with_state(disabled: true)form_template_page.type_in_template_name("New Template")@@ -111,7 +111,7 @@ describe "Admin Customize Form Templates" doexpect(form_template_page).to have_preview_button_with_state(disabled: false)end- it "should show validation options in a modal when clicking the validations button" do+ it "shows validation options from the validations button" doform_template_page.visit_newform_template_page.click_validations_buttonexpect(form_template_page).to have_validations_modal@@ -136,7 +136,7 @@ describe "Admin Customize Form Templates" doexpect(form_template_page).to have_form_template(sample_name)end- it "should show a preview of the template in a modal when clicking the preview button" do+ it "shows the template preview from the preview button" doform_template_page.visit_newform_template_page.type_in_template_name("New Template")ace_editor.type_input("- type: input\n id: name")@@ -146,7 +146,7 @@ describe "Admin Customize Form Templates" doexpect(form_template_page).to have_input_field("input")end- it "should render all the input field types in the preview" do+ it "renders every input type in the preview" dotag1 = Fabricate(:tag)tag2 = Fabricate(:tag)tag3 = Fabricate(:tag)@@ -183,7 +183,7 @@ describe "Admin Customize Form Templates" dotag_group.tags.each { |tag| expect(form_template_page).to have_tag_chooser_tag(tag) }end- it "should allow quick insertion of checkbox field" do+ it "quickly inserts a checkbox field" doquick_insertion_test("checkbox",'- type: checkbox@@ -195,7 +195,7 @@ describe "Admin Customize Form Templates" do)end- it "should allow quick insertion of short answer field" do+ it "quickly inserts a short-answer field" doquick_insertion_test("input",'- type: input@@ -208,7 +208,7 @@ describe "Admin Customize Form Templates" do)end- it "should allow quick insertion of long answer field" do+ it "quickly inserts a long-answer field" doquick_insertion_test("textarea",'- type: textarea@@ -221,7 +221,7 @@ describe "Admin Customize Form Templates" do)end- it "should allow quick insertion of dropdown field" do+ it "quickly inserts a dropdown field" doquick_insertion_test("dropdown",'- type: dropdown@@ -238,7 +238,7 @@ describe "Admin Customize Form Templates" do)end- it "should allow quick insertion of upload field" do+ it "quickly inserts an upload field" doquick_insertion_test("upload",'- type: upload@@ -252,7 +252,7 @@ describe "Admin Customize Form Templates" do)end- it "should allow quick insertion of multiple choice field" do+ it "quickly inserts a multiple-choice field" doquick_insertion_test("multiselect",'- type: multi-selectdiff --git a/spec/system/admin_customize_themes_spec.rb b/spec/system/admin_customize_themes_spec.rbindex 0bfe8f1a534..0ab5e5161dd 100644--- a/spec/system/admin_customize_themes_spec.rb+++ b/spec/system/admin_customize_themes_spec.rb@@ -15,12 +15,12 @@ describe "Admin Customize Themes" dobefore { sign_in(admin) }describe "when visiting the page to customize a single theme" do- it "should keep sidebar navigation link active" do+ it "keeps the sidebar navigation link active" dotheme_page.visit(theme)expect(sidebar).to have_active_link("admin_themes_and_components")end- it "should allow admin to update the light color scheme of the theme" do+ it "allows admins to update the theme's light color scheme" dotheme_page.visit(theme)color_scheme_settings = find(".theme-settings__light-color-scheme")@@ -42,7 +42,7 @@ describe "Admin Customize Themes" do)end- it "should allow admin to update the dark color scheme of the theme" do+ it "allows admins to update the theme's dark color scheme" dotheme_page.visit(theme)color_scheme_settings = find(".theme-settings__dark-color-scheme")@@ -182,7 +182,7 @@ describe "Admin Customize Themes" doenddescribe "when editing theme translations" do- it "should allow admin to edit and save the theme translations" do+ it "allows admins to edit and save theme translations" dotheme.set_field(target: :translations,name: "en",@@ -204,7 +204,7 @@ describe "Admin Customize Themes" doexpect(theme_translations_settings_editor.get_input_value).to have_content("Hello World")end- it "should allow admin to edit and save the theme translations from other languages" do+ it "allows admins to edit and save theme translations in other languages" dotheme.set_field(target: :translations,name: "en",@@ -234,7 +234,7 @@ describe "Admin Customize Themes" dotheme_translations_settings_editor.saveend- it "should match the current user locale translation" do+ it "uses translations matching the current user's locale" doSiteSetting.allow_user_locale = trueSiteSetting.set_locale_from_accept_language_header = trueSiteSetting.default_locale = "fr"diff --git a/spec/system/admin_editing_objects_typed_theme_setting_spec.rb b/spec/system/admin_editing_objects_typed_theme_setting_spec.rbindex f53faa71178..03c5b362d45 100644--- a/spec/system/admin_editing_objects_typed_theme_setting_spec.rb+++ b/spec/system/admin_editing_objects_typed_theme_setting_spec.rb@@ -25,7 +25,7 @@ RSpec.describe "Admin editing objects type" dobefore { objects_setting }- it "should display the right label and description for each property if the label and description has been configured in a locale file" do+ it "displays property labels and descriptions from the locale file" dotheme.set_field(target: :translations,name: "en",@@ -61,7 +61,7 @@ RSpec.describe "Admin editing objects type" doexpect(admin_objects_setting_editor_page).to have_setting_field_label("url", "URL")end- it "should allow admin to edit the theme setting of objects type" do+ it "allows admins to edit an objects theme setting" dovisit("/admin/customize/themes/#{theme.id}")expect(admin_customize_themes_page).to have_no_overriden_setting("objects_setting")diff --git a/spec/system/admin_reports_spec.rb b/spec/system/admin_reports_spec.rbindex a46beae049b..bf52f5facd6 100644--- a/spec/system/admin_reports_spec.rb+++ b/spec/system/admin_reports_spec.rb@@ -19,7 +19,7 @@ describe "Admin Reports" docontext "when use_legacy_pageviews is false" dobefore { SiteSetting.use_legacy_pageviews = false }- it "won't redirects from site_traffic to consolidated_page_views" do+ it "does not redirect site_traffic to consolidated_page_views" dovisit "/admin/reports/site_traffic"expect(page).to have_current_path("/admin/reports/site_traffic")enddiff --git a/spec/system/capabilities_service_spec.rb b/spec/system/capabilities_service_spec.rbindex 4f65ff54184..6c2c8aeaf4a 100644--- a/spec/system/capabilities_service_spec.rb+++ b/spec/system/capabilities_service_spec.rb@@ -2,7 +2,7 @@describe "capabilities service" dodescribe "viewport helpers" do- it "works" do+ it "updates viewport matches when the window is resized" dodef matches(name)page.evaluate_script("Discourse.lookup('service:capabilities').viewport[#{name.to_json}]")enddiff --git a/spec/system/category_localizations_spec.rb b/spec/system/category_localizations_spec.rbindex 0191f2a98cd..d204a505626 100644--- a/spec/system/category_localizations_spec.rb+++ b/spec/system/category_localizations_spec.rb@@ -36,7 +36,7 @@ describe "Category Localizations" docontext "when content localization setting is disabled" dobefore { SiteSetting.content_localization_enabled = false }- it "should not show the localization tab" do+ it "hides the localization tab" dosign_in(admin)category_page.visit_settings(category)@@ -68,7 +68,7 @@ describe "Category Localizations" dodescribe "Category Settings" dobefore { sign_in(admin) }- it "should show the localization tab" do+ it "shows the localization tab" docategory_page.visit_settings(category)expect(category_page).to have_setting_tab("localizations")end@@ -99,12 +99,12 @@ describe "Category Localizations" dodescribe "when editing a category with no category localizations" dofab!(:mono_category, :category)- it "should show info hint to add new localizations" do+ it "shows a hint to add new localizations" docategory_page.visit_edit_localizations(mono_category)expect(form).to have_an_alert(I18n.t("js.category.localization.hint"))end- it "should allow you to add new localizations" do+ it "allows adding new localizations" docategory_page.visit_edit_localizations(mono_category)category_page.find(".edit-category-tab-localizations .add-localization").clickform.field("localizations.0.locale").select("es")diff --git a/spec/system/composer/default_to_subcategory_spec.rb b/spec/system/composer/default_to_subcategory_spec.rbindex 12f4365d946..10dd1a09935 100644--- a/spec/system/composer/default_to_subcategory_spec.rb+++ b/spec/system/composer/default_to_subcategory_spec.rb@@ -33,7 +33,7 @@ describe "Default to Subcategory when parent Category doesn't allow posting" dodescribe "Can't post on parent category" dodescribe "Category has subcategory" do- it "should have 'New Topic' button enabled and default Subcategory set in the composer" do+ it "enables New Topic and selects the default subcategory" docategory_page.visit(category)expect(category_page).to have_button("New Topic", disabled: false)category_page.new_topic_button.click@@ -44,7 +44,7 @@ describe "Default to Subcategory when parent Category doesn't allow posting" doenddescribe "Category does not have subcategory" do- it "should have the 'New Topic' button enabled and no category set in the composer" do+ it "enables New Topic without selecting a category" docategory_page.visit(category_with_no_subcategory)expect(category_page).to have_button("New Topic", disabled: false)@@ -58,7 +58,7 @@ describe "Default to Subcategory when parent Category doesn't allow posting" doenddescribe "Can post on home page" do- it "should have the default category set in the composer" do+ it "selects the default category in the composer" dopage.visit("latest")expect(page).to have_button("New Topic", disabled: false)page.find("#create-topic").clickdiff --git a/spec/system/discovery_list_spec.rb b/spec/system/discovery_list_spec.rbindex 33574dd290a..4b066c04897 100644--- a/spec/system/discovery_list_spec.rb+++ b/spec/system/discovery_list_spec.rb@@ -45,7 +45,7 @@ describe "Discovery list" dofab!(:post1) { create_post(user: user, topic: topic) }fab!(:post2) { create_post(topic: topic) }- it "should correctly show/hide the bulk select toggle for regular users" do+ it "shows and hides the bulk-select toggle for regular users" dosign_in(user)visit("/unread")diff --git a/spec/system/edit_category_form_templates_spec.rb b/spec/system/edit_category_form_templates_spec.rbindex 1a928c7a6a6..4a94b5153a7 100644--- a/spec/system/edit_category_form_templates_spec.rb+++ b/spec/system/edit_category_form_templates_spec.rb@@ -19,13 +19,13 @@ describe "Edit Category Form Templates" dodescribe "when editing a category with no form templates set" dobefore { category.update(form_template_ids: []) }- it "should have form templates disabled and topic template enabled" do+ it "disables form templates and enables the topic template" docategory_page.visit_edit_template(category)expect(category_page).not_to have_form_template_enabledexpect(category_page).to have_d_editorend- it "should allow you to select and save a form template" do+ it "allows selecting and saving one form template" docategory_page.visit_edit_template(category)category_page.toggle_form_templatesexpect(category_page).to have_no_d_editor@@ -36,7 +36,7 @@ describe "Edit Category Form Templates" doexpect(Category.find_by_id(category.id).form_template_ids).to eq([form_template.id])end- it "should allow you to select and save multiple form templates" do+ it "allows selecting and saving multiple form templates" docategory_page.visit_edit_template(category)category_page.toggle_form_templatescategory_page.select_form_template(form_template.name)@@ -52,7 +52,7 @@ describe "Edit Category Form Templates" dodescribe "when editing a category with form templates set" dobefore { category.update(form_template_ids: [form_template.id, form_template_2.id]) }- it "should have form templates enabled and showing the selected templates" do+ it "enables form templates and shows the selected templates" docategory_page.visit_edit_template(category)expect(category_page).to have_form_template_enabledexpect(category_page).to have_no_d_editordiff --git a/spec/system/editing_sidebar_community_section_spec.rb b/spec/system/editing_sidebar_community_section_spec.rbindex d7fac8366d8..27f4735017f 100644--- a/spec/system/editing_sidebar_community_section_spec.rb+++ b/spec/system/editing_sidebar_community_section_spec.rb@@ -7,7 +7,7 @@ RSpec.describe "Editing Sidebar Community Section" dolet(:sidebar) { PageObjects::Components::NavigationMenu::Sidebar.new }let(:sidebar_header_dropdown) { PageObjects::Components::NavigationMenu::HeaderDropdown.new }- it "should not display the edit section button to non admins" do+ it "hides the edit-section button from non-administrators" dosign_in(user)visit("/latest")@@ -102,7 +102,7 @@ RSpec.describe "Editing Sidebar Community Section" doexpect(modal).to be_visibleend- it "should allow admins to open modal to edit the section when `navigation_menu` site setting is `header dropdown`" do+ it "lets administrators edit the section from the header dropdown" doSiteSetting.navigation_menu = "header dropdown"sign_in(admin)diff --git a/spec/system/emojis/emoji_deny_list_spec.rb b/spec/system/emojis/emoji_deny_list_spec.rbindex e001652dce4..9e5ac4c5683 100644--- a/spec/system/emojis/emoji_deny_list_spec.rb+++ b/spec/system/emojis/emoji_deny_list_spec.rb@@ -31,7 +31,7 @@ describe "Emoji deny list" dofab!(:topic) { Fabricate(:topic, title: "Time for :monkey: business") }fab!(:post) { Fabricate(:post, topic: topic, raw: "We have no time to :monkey: around!") }- it "should remove denied emojis from page title, heading and body" do+ it "removes denied emojis from the page title, heading, and body" dotopic_page.visit_topic(topic)expect(page.title).to eq("Time for business - Discourse")expect(topic_page).to have_topic_title("Time for business")@@ -59,7 +59,7 @@ describe "Emoji deny list" doexpect(emoji_picker).to have_no_emoji(":poop:")end- it "should not show denied emojis and aliases in emoji autocomplete" do+ it "hides denied emojis and aliases from emoji autocomplete" dotopic_page.visit_topic_and_open_composer(topic)composer.type_content(":poop") # shows no results@@ -72,7 +72,7 @@ describe "Emoji deny list" doexpect(composer).to have_no_emoji_suggestion("fu")end- it "should not show denied emoji in preview" do+ it "hides denied emojis from the preview" dotopic_page.visit_topic_and_open_composer(topic)composer.fill_content(":wave:")@@ -96,7 +96,7 @@ describe "Emoji deny list" doendfab!(:post) { Fabricate(:post, topic: topic, raw: "Can we use the :monkey: emoji here?") }- it "should remove denied emojis from message title and body" do+ it "removes denied emojis from the message title and body" dotopic_page.visit_topic(topic)expect(topic_page).to have_topic_title("Want to catch up for today?")expect(post).not_to have_css(".emoji[title=':monkey:']")diff --git a/spec/system/filtering_topics_spec.rb b/spec/system/filtering_topics_spec.rbindex a0c479cce5b..1427a31eb8f 100644--- a/spec/system/filtering_topics_spec.rb+++ b/spec/system/filtering_topics_spec.rb@@ -47,7 +47,7 @@ describe "Filtering topics" dotopicend- it "should display the right topics when the status filter is used in the query string" do+ it "displays matching topics for a status query-string filter" dosign_in(user)visit("/filter")@@ -82,7 +82,7 @@ describe "Filtering topics" dofab!(:topic_with_tag2) { Fabricate(:topic, tags: [tag2]) }fab!(:topic_with_tag_and_tag2) { Fabricate(:topic, tags: [tag, tag2]) }- it "should display the right topics when tags filter is used in the query string" do+ it "displays matching topics for a tag query-string filter" dosign_in(user)visit("/filter")diff --git a/spec/system/forgot_password_spec.rb b/spec/system/forgot_password_spec.rbindex b252d28eaa7..6a8d58273f2 100644--- a/spec/system/forgot_password_spec.rb+++ b/spec/system/forgot_password_spec.rb@@ -21,7 +21,7 @@ shared_examples "forgot password scenarios" doendcontext "when user does not have any multi-factor authentication configured" do- it "should allow a user to reset their password" do+ it "allows the user to reset their password" dovisit_reset_password_linkuser_reset_password_page.fill_in_new_password("newsuperpassword").submit_new_password@@ -34,7 +34,7 @@ shared_examples "forgot password scenarios" docontext "when user only has TOTP configured" dofab!(:user_second_factor_totp) { Fabricate(:user_second_factor_totp, user:) }- it "should allow a user to reset password with TOTP" do+ it "allows resetting the password with TOTP" dovisit_reset_password_linkexpect(user_reset_password_page).to have_no_toggle_button_to_second_factor_form@@ -50,7 +50,7 @@ shared_examples "forgot password scenarios" doendcontext "when user only has security key configured" do- it "should allow a user to reset password with a security key" do+ it "allows resetting the password with a security key" dowith_security_key(user) dovisit_reset_password_link@@ -69,7 +69,7 @@ shared_examples "forgot password scenarios" dofab!(:user_second_factor_backup) { Fabricate(:user_second_factor_backup, user:) }fab!(:user_second_factor_totp) { Fabricate(:user_second_factor_totp, user:) }- it "should allow a user to reset password with backup code" do+ it "allows resetting the password with a backup code" dovisit_reset_password_linkuser_reset_password_page@@ -86,7 +86,7 @@ shared_examples "forgot password scenarios" docontext "when user has security key and backup codes configured" dofab!(:user_second_factor_backup) { Fabricate(:user_second_factor_backup, user:) }- it "should allow a user to reset password with backup code instead of security key" do+ it "allows using a backup code instead of a security key to reset the password" dowith_security_key(user) dovisit_reset_password_link@@ -109,7 +109,7 @@ shared_examples "forgot password scenarios" dofab!(:user_second_factor_totp) { Fabricate(:user_second_factor_totp, user:) }fab!(:user_second_factor_backup) { Fabricate(:user_second_factor_backup, user:) }- it "should allow a user to toggle from security key to TOTP and between TOTP and backup codes" do+ it "allows switching between security keys, TOTP, and backup codes" dowith_security_key(user) dovisit_reset_password_link@@ -131,7 +131,7 @@ shared_examples "forgot password scenarios" docontext "when user has TOTP and security key configured but no backup codes" dofab!(:user_second_factor_totp) { Fabricate(:user_second_factor_totp, user:) }- it "should allow a user to reset password with TOTP instead of security key" do+ it "allows using TOTP instead of a security key to reset the password" dowith_security_key(user) dovisit_reset_password_linkdiff --git a/spec/system/groups/group_members_spec.rb b/spec/system/groups/group_members_spec.rbindex 0235afdfb2a..5e877703073 100644--- a/spec/system/groups/group_members_spec.rb+++ b/spec/system/groups/group_members_spec.rb@@ -9,7 +9,7 @@ describe "Group members" dobefore { sign_in(admin) }describe "adds a user to the group" do- it "should show that the user is already in the group" do+ it "shows that the user is already in the group" dogroup_page.visit(group).add_users.select_user_and_add(admin)expect(diff --git a/spec/system/new_category_spec.rb b/spec/system/new_category_spec.rbindex 73b3324cd50..b06fc717987 100644--- a/spec/system/new_category_spec.rb+++ b/spec/system/new_category_spec.rb@@ -6,7 +6,7 @@ describe "New Category" dobefore { sign_in(admin) }- it "should create category with 0 in minimum_required_tags column when not defined" do+ it "defaults minimum_required_tags to zero when creating a category" docategory_page.visit_new_categorycategory_page.find(".edit-category-tab-general input.category-name").fill_in(diff --git a/spec/system/post_translation_spec.rb b/spec/system/post_translation_spec.rbindex c903477acab..16eae014a42 100644--- a/spec/system/post_translation_spec.rb+++ b/spec/system/post_translation_spec.rb@@ -30,7 +30,7 @@ describe "Post translations" doendcontext "when a post does not have translations" do- it "should only show the languages listed in the site setting" do+ it "shows only languages configured in the site setting" dopost.update!(locale: "en")topic_page.visit_topic(topic)@@ -218,7 +218,7 @@ describe "Post translations" doendcontext "when creating a new post in a different locale" do- it "should only show the languages listed in the site setting and default locale and a none value" do+ it "shows configured languages, the default locale, and no locale" dovisit("/latest")page.find("#create-topic").clickpost_language_selector.expand@@ -231,7 +231,7 @@ describe "Post translations" do)end- it "should allow a user to create a post in a different locale" do+ it "allows a user to create a post in another locale" dovisit("/latest")page.find("#create-topic").clickpost_language_selector.expand@@ -244,7 +244,7 @@ describe "Post translations" doexpect(updated_post.locale).to eq("fr")end- it "should not have a locale set by default" do+ it "does not select a locale by default" dovisit("/latest")page.find("#create-topic").clickexpect(diff --git a/spec/system/private_message_spec.rb b/spec/system/private_message_spec.rbindex 73604c42a78..e4dfce848ec 100644--- a/spec/system/private_message_spec.rb+++ b/spec/system/private_message_spec.rb@@ -25,7 +25,7 @@ describe "Private Message" docontext "for 'new personal message' action option in composer" dobefore { sign_in(sender) }- it "should be available in new topic" do+ it "offers the personal message action in a new topic" dovisit "/new-topic"expect(composer).to be_opened@@ -35,7 +35,7 @@ describe "Private Message" doexpect(composer.button_label).to have_text(I18n.t("js.composer.create_pm"))end- it "should not be available in private conversation reply" do+ it "omits the personal message action when replying to a private conversation" dovisit(pm_post.full_url)pm_post_obj.replydiff --git a/spec/system/reviewables_spec.rb b/spec/system/reviewables_spec.rbindex facf54107b5..739f5d15bfa 100644--- a/spec/system/reviewables_spec.rb+++ b/spec/system/reviewables_spec.rb@@ -61,7 +61,7 @@ describe "Reviewables" doexpect(post.reload.raw).to eq("This post has been edited by a moderator.")end- it "should open a modal when suspending a user" do+ it "opens a modal when suspending a user" dovisit("/review")select_kit =@@ -76,7 +76,7 @@ describe "Reviewables" do)end- it "should show a toast when disagreeing with a flag flag" do+ it "shows a toast when disagreeing with a flag" dovisit("/review")select_kit = PageObjects::Components::SelectKit.new(".dropdown-select-box.post-disagree")diff --git a/spec/system/table_builder_spec.rb b/spec/system/table_builder_spec.rbindex 9a8bb10774e..47c7ef2458e 100644--- a/spec/system/table_builder_spec.rb+++ b/spec/system/table_builder_spec.rb@@ -29,7 +29,7 @@ describe "Table Builder" doendcontext "when creating a new table" do- it "should add table items created in spreadsheet to composer input" do+ it "adds spreadsheet table items to the composer" dovisit("/latest")page.find("#create-topic").clickfind(".toolbar-menu__options-trigger").click@@ -55,7 +55,7 @@ describe "Table Builder" doendcontext "when cancelling table creation" do- it "should close the modal if there are no changes made" do+ it "closes the modal when nothing changed" dovisit("/latest")page.find("#create-topic").clickfind(".toolbar-menu__options-trigger").click@@ -64,7 +64,7 @@ describe "Table Builder" doexpect(page).to have_no_css(".insert-table-modal")end- it "should show a warning popup if there are unsaved changes" do+ it "warns about unsaved changes" dovisit("/latest")page.find("#create-topic").clickfind(".toolbar-menu__options-trigger").click@@ -77,7 +77,7 @@ describe "Table Builder" doendcontext "when editing a table" do- it "should prefill the spreadsheet with the markdown table items from the post" do+ it "prefills the spreadsheet from the post's Markdown table" dotopic_page.visit_topic(topic)topic_page.find(".btn-edit-table", visible: :all).clickexpect(page).to have_selector(".insert-table-modal")@@ -95,7 +95,7 @@ describe "Table Builder" doendend- it "should update the post with the new table content" do+ it "updates the post with the new table content" dotopic_page.visit_topic(topic)topic_page.find(".btn-edit-table", visible: :all).clickexpect(page).to have_selector(".insert-table-modal")@@ -113,7 +113,7 @@ describe "Table Builder" doexpect(normalize_value(post1.reload.raw)).to eq(normalize_value(updated_post))end- it "should respect the original empty header" do+ it "preserves an empty table header" dotopic_page.visit_topic(topic2)topic_page.find(".btn-edit-table", visible: :all).clickexpect(page).to have_selector(".insert-table-modal")@@ -131,7 +131,7 @@ describe "Table Builder" doendcontext "when adding an edit reason" do- it "should add the edit reason to the edit history" do+ it "adds the edit reason to the revision history" doedit_reason = "Updated Nissan model"topic_page.visit_topic(topic)@@ -147,7 +147,7 @@ describe "Table Builder" doendcontext "when cancelling table creation" do- it "should close the modal if there are no changes made" do+ it "closes the modal when nothing changed" dotopic_page.visit_topic(topic)topic_page.find(".btn-edit-table", visible: :all).clickexpect(page).to have_selector(".insert-table-modal")@@ -163,7 +163,7 @@ describe "Table Builder" doexpect(page).to have_no_css(".insert-table-modal")end- it "should show a warning popup if there are unsaved changes" do+ it "warns about unsaved changes" dotopic_page.visit_topic(topic)topic_page.find(".btn-edit-table", visible: :all).clickexpect(page).to have_selector(".insert-table-modal")@@ -173,7 +173,7 @@ describe "Table Builder" doendend- it "should not accept default Discourse keyboard shortcuts" do+ it "ignores default Discourse keyboard shortcuts" dotopic_page.visit_topic(topic)topic_page.find(".btn-edit-table", visible: :all).clickinsert_table_modal.find_cell(0, 0)diff --git a/spec/system/tag_notification_level_spec.rb b/spec/system/tag_notification_level_spec.rbindex f734253b165..2a91181675b 100644--- a/spec/system/tag_notification_level_spec.rb+++ b/spec/system/tag_notification_level_spec.rb@@ -12,7 +12,7 @@ describe "Tag notification level" dobefore { sign_in(current_user) }describe "when changing a tag's notification level" do- it "should change instantly" do+ it "changes the notification level immediately" dotags_page.visit_tag(tag_1)expect(notifications_tracking).to have_selected_level_name("regular")diff --git a/spec/system/user_page/staff_info_spec.rb b/spec/system/user_page/staff_info_spec.rbindex ec3db2812cb..eea1dccf7e9 100644--- a/spec/system/user_page/staff_info_spec.rb+++ b/spec/system/user_page/staff_info_spec.rb@@ -11,7 +11,7 @@ describe "Viewing user staff info as an admin" dofab!(:topic) { Fabricate(:private_message_topic, user: admin, recipient: user) }fab!(:user_warning) { UserWarning.create!(user: user, created_by: admin, topic: topic) }- it "should display the right link to user's warnings with the right count in text" do+ it "shows the user's warning link and count" douser_page.visit(user).click_staff_info_warnings_link(user, warnings_count: 1)expect(user_page).to have_warning_messages_path(user)@@ -22,7 +22,7 @@ describe "Viewing user staff info as an admin" dofab!(:silencing) doFabricate(:user_history, action: UserHistory.actions[:silence_user], target_user: user)end- it "should display the right link to user's silencings with the right count in text" do+ it "shows the user's silencing link and count" douser_page.visit(user)silencings_counters = page.find(".staff-counters .silencings")expect(silencings_counters).to have_text("1")diff --git a/spec/system/user_page/user_preferences_navigation_spec.rb b/spec/system/user_page/user_preferences_navigation_spec.rbindex e7888d694d7..c9a77e21602 100644--- a/spec/system/user_page/user_preferences_navigation_spec.rb+++ b/spec/system/user_page/user_preferences_navigation_spec.rb@@ -6,7 +6,7 @@ describe "User preferences | Navigation menu" dolet(:user_preferences_page) { PageObjects::Pages::UserPreferences.new }describe "when visiting the user's preferences page" do- it "should allow the user to scroll the horizontal navigation menu when window width is narrow" do+ it "allows horizontal navigation scrolling in a narrow window" doresize_window(width: 650) do # narrow enough to hide some links, but higher than 640px so we don't trigger mobile stylingsign_in(user)diff --git a/spec/system/viewing_navigation_menu_preferences_spec.rb b/spec/system/viewing_navigation_menu_preferences_spec.rbindex 5355b0c2deb..65fcd420e9e 100644--- a/spec/system/viewing_navigation_menu_preferences_spec.rb+++ b/spec/system/viewing_navigation_menu_preferences_spec.rb@@ -13,7 +13,7 @@ describe "Viewing sidebar preferences" dobefore { sign_in(admin) }- it "should be able to view navigation menu preferences of another user" do+ it "shows another user's navigation-menu preferences" douser.user_option.update!(sidebar_link_to_filtered_list: true,sidebar_show_count_of_new_items: true,diff --git a/spec/system/viewing_sidebar_as_anonymous_user_spec.rb b/spec/system/viewing_sidebar_as_anonymous_user_spec.rbindex 7b3c744625d..df008a39e27 100644--- a/spec/system/viewing_sidebar_as_anonymous_user_spec.rb+++ b/spec/system/viewing_sidebar_as_anonymous_user_spec.rb@@ -32,7 +32,7 @@ describe "Viewing sidebar as anonymous user" doFabricate(:tag, name: "tag 6").tap { |tag| Fabricate.times(1, :topic, tags: [tag]) }end- it "should not display the tags section when tagging has been disabled" do+ it "hides the tags section when tagging is disabled" doSiteSetting.tagging_enabled = falsevisit("/latest")@@ -40,7 +40,7 @@ describe "Viewing sidebar as anonymous user" doexpect(sidebar).to have_no_tags_sectionend- it "should not display the tags section when site has no top tags and `default_navigation_menu_tags` site setting has not been set" do+ it "hides the tags section when there are no top or configured tags" doTag.delete_allvisit("/latest")@@ -48,7 +48,7 @@ describe "Viewing sidebar as anonymous user" doexpect(sidebar).to have_no_tags_sectionend- it "should display the site's top tags when `default_navigation_menu_tags` site setting has not been set" do+ it "shows the site's top tags when no navigation tags are configured" dovisit("/latest")expect(sidebar).to have_tags_section@@ -56,7 +56,7 @@ describe "Viewing sidebar as anonymous user" doexpect(sidebar).to have_tag_section_links([tag3, tag2, tag4, tag5, tag1])end- it "should display the site's top tags when `default_navigation_menu_tags` site setting has been set but the tags configured are hidden to the user" do+ it "shows the site's top tags when configured navigation tags are hidden" doSiteSetting.default_navigation_menu_tags = "#{tag5.name}"Fabricate(:tag_group, permissions: { "staff" => 1 }, tag_names: [tag5.name])@@ -67,7 +67,7 @@ describe "Viewing sidebar as anonymous user" doexpect(sidebar).to have_tag_section_links([tag3, tag2, tag4, tag1, tag6])end- it "should display the tags configured in `default_navigation_menu_tags` site setting when it has been set" do+ it "shows the configured navigation tags" doSiteSetting.default_navigation_menu_tags = "#{tag3.name}|#{tag4.name}"visit("/latest")diff --git a/spec/system/viewing_sidebar_spec.rb b/spec/system/viewing_sidebar_spec.rbindex ae291788f7f..faefd81b9eb 100644--- a/spec/system/viewing_sidebar_spec.rb+++ b/spec/system/viewing_sidebar_spec.rb@@ -13,7 +13,7 @@ describe "Viewing sidebar" dodescribe "when using the header dropdown navigation menu" dobefore { SiteSetting.navigation_menu = "header dropdown" }- it "should display the sidebar when `navigation_menu` query param is 'sidebar' and maintain header dropdown" do+ it "shows the sidebar while preserving the header dropdown" dovisit("/latest?navigation_menu=sidebar")expect(sidebar).to be_visible@@ -24,7 +24,7 @@ describe "Viewing sidebar" dodescribe "when using the sidebar navigation menu" dobefore { SiteSetting.navigation_menu = "sidebar" }- it "should display the sidebar dropdown menu when `navigation_menu` query param is 'header_dropdown'" do+ it "shows the header dropdown selected by the query parameter" dovisit("/latest?navigation_menu=header_dropdown")expect(sidebar).to be_not_visible@@ -122,7 +122,7 @@ describe "Viewing sidebar" doFabricate(:tag, name: "tag 6").tap { |tag| Fabricate.times(1, :topic, tags: [tag]) }end- it "should not display the tags section when tagging is disabled" do+ it "hides the tags section when tagging is disabled" doSiteSetting.tagging_enabled = falsevisit("/latest")@@ -131,7 +131,7 @@ describe "Viewing sidebar" doexpect(sidebar).to have_no_tags_sectionend- it "should not display the tags section when there are no tags that a user can see" do+ it "hides the tags section when no tags are visible" doTag.delete_allvisit("/latest")@@ -140,7 +140,7 @@ describe "Viewing sidebar" doexpect(sidebar).to have_no_tags_sectionend- it "should display the site's top tags in the tags section when user has not configured any tags" do+ it "shows top tags when the user has not configured tags" dovisit("/latest")expect(sidebar).to be_visible@@ -149,7 +149,7 @@ describe "Viewing sidebar" doexpect(sidebar).to have_all_tags_section_linkend- it "should display the tags configured by the user in alphabetical order" do+ it "shows the user's tags in alphabetical order" doFabricate(:sidebar_section_link, linkable: tag3, user: user)Fabricate(:sidebar_section_link, linkable: tag1, user: user)Fabricate(:sidebar_section_link, linkable: tag2, user: user)@@ -164,13 +164,13 @@ describe "Viewing sidebar" doenddescribe "when My messages sidebar link" do- it "should show for user with `can_send_private_messages` permission" do+ it "shows for a user who can send private messages" dosign_in(admin)visit("/")expect(sidebar).to have_my_messages_linkend- it "shouldn't show for user without `can_send_private_messages` permission" do+ it "hides from a user who cannot send private messages" doSiteSetting.personal_message_enabled_groups = Group::AUTO_GROUPS[:admins]sign_in(user)visit("/")@@ -199,20 +199,20 @@ describe "Viewing sidebar" doendlet(:user_private_messages_page) { PageObjects::Pages::UserPrivateMessages.new }- it "should show new messages indicator" do+ it "shows the new-messages indicator" dosign_in(admin)visit("/")expect(sidebar).to have_my_messages_link_with_unread_iconend- it "should show a count of the new items" do+ it "shows the new-item count" doadmin.user_option.update!(sidebar_show_count_of_new_items: true)sign_in(admin)visit("/")expect(sidebar).to have_my_messages_link_with_unread_countend- it "should remove unread icon after all messages are read" do+ it "removes the unread icon after every message is read" dosign_in(admin)user_private_messages_page.visit(admin)user_private_messages_page.click_unseen_private_message(private_message.id)@@ -225,7 +225,7 @@ describe "Viewing sidebar" doendend- it "shouldn't display the panel header for the main sidebar" do+ it "hides the panel header in the main sidebar" dovisit("/latest")expect(sidebar).to be_visibleexpect(sidebar).to have_no_panel_header@@ -234,7 +234,7 @@ describe "Viewing sidebar" docontext "as anonymous user" dodescribe "My messages sidebar link" do- it "shouldn't show for anonymous user" do+ it "hides from anonymous users" dovisit("/")expect(sidebar).to have_no_my_messages_linkenddiff --git a/spec/system/viewing_user_menu_spec.rb b/spec/system/viewing_user_menu_spec.rbindex b8d2e517cd3..96611817a2c 100644--- a/spec/system/viewing_user_menu_spec.rb+++ b/spec/system/viewing_user_menu_spec.rb@@ -65,7 +65,7 @@ RSpec.describe "Viewing User Menu" dodescribe "when viewing replies notifications tab" dofab!(:topic)- it "should display group mentioned notifications in the tab" do+ it "shows group-mention notifications in the tab" doJobs.run_immediately!mentionable_group = Fabricate(:group, mentionable_level: Group::ALIAS_LEVELS[:everyone])@@ -90,7 +90,7 @@ RSpec.describe "Viewing User Menu" docontext "with SiteSetting.prioritize_full_name_in_ux=true" dobefore { SiteSetting.prioritize_full_name_in_ux = true }- it "should display user full name in mention notifications" do+ it "shows the user's full name in mention notifications" doJobs.run_immediately!user = Fabricate(:user)@@ -110,7 +110,7 @@ RSpec.describe "Viewing User Menu" doexpect(user_menu).to have_user_full_name_mentioned_notification(topic, user)end- it "should display user full name in message notification" do+ it "shows the user's full name in message notifications" doJobs.run_immediately!user = Fabricate(:moderator)@@ -132,7 +132,7 @@ RSpec.describe "Viewing User Menu" doexpect(user_menu).to have_user_full_name_messaged_notification(post, user)end- it "should display user full name in bookmark notification" do+ it "shows the user's full name in bookmark notifications" doJobs.run_immediately!user = Fabricate(:moderator)@@ -158,7 +158,7 @@ RSpec.describe "Viewing User Menu" docontext "with SiteSetting.prioritize_full_name_in_ux=false" dobefore { SiteSetting.prioritize_full_name_in_ux = false }- it "should display only username in mention notifications" do+ it "shows only the username in mention notifications" doJobs.run_immediately!SiteSetting.prioritize_username_in_ux = truediff --git a/spec/system/welcome_banner_spec.rb b/spec/system/welcome_banner_spec.rbindex bd67fae4fd4..b0cc0f15f1e 100644--- a/spec/system/welcome_banner_spec.rb+++ b/spec/system/welcome_banner_spec.rb@@ -221,7 +221,7 @@ describe "Welcome banner" dobefore { SiteSetting.welcome_banner_page_visibility = "all_pages" }- it "should show on" do+ it "shows on the homepage, preferences, and messages pages" dosign_in(current_user)visit "/"@@ -234,7 +234,7 @@ describe "Welcome banner" doexpect(banner).to be_visibleend- it "should NOT show on" do+ it "hides on authentication and admin pages" dovisit "/login"expect(banner).to be_hidden@@ -262,7 +262,7 @@ describe "Welcome banner" doendend- it "should show on discovery routes only" do+ it "shows only on discovery routes" dosign_in(current_user)SiteSetting.welcome_banner_page_visibility = "discovery"@@ -273,7 +273,7 @@ describe "Welcome banner" doexpect(banner).to be_hiddenend- it "should show on top menu pages only" do+ it "shows only on top menu pages" dosign_in(current_user)SiteSetting.welcome_banner_page_visibility = "top_menu_pages"SiteSetting@@ -288,7 +288,7 @@ describe "Welcome banner" doexpect(banner).to be_hiddenend- it "should show on homepage only" do+ it "shows only on the homepage" doSiteSetting.welcome_banner_page_visibility = "homepage"visit "/"diff --git a/spec/tasks/posts_spec.rb b/spec/tasks/posts_spec.rbindex d5bd2745a1a..eb643416aab 100644--- a/spec/tasks/posts_spec.rb+++ b/spec/tasks/posts_spec.rb@@ -10,7 +10,7 @@ RSpec.describe "Post rake tasks" dobefore { STDOUT.stubs(:write) }describe "remap" do- it "should remap posts" do+ it "remaps posts" doHighLine::Simulate.with("y") { invoke_rake_task("posts:remap", "brown", "red") }post.reload@@ -54,7 +54,7 @@ RSpec.describe "Post rake tasks" doendlet(:upload) { Fabricate(:upload, url: url) }- it "should create post custom field for missing upload" do+ it "creates a post custom field for a missing upload" dopost = Fabricate(:post, raw: "A sample post <img src='#{url}'>")upload.destroy!@@ -64,7 +64,7 @@ RSpec.describe "Post rake tasks" doexpect(post.custom_fields[Post::MISSING_UPLOADS]).to eq([url])end- it 'should skip all the posts with "ignored" custom field' do+ it 'skips posts with the "ignored" custom field' dopost = Fabricate(:post, raw: "A sample post <img src='#{url}'>")post.custom_fields[Post::MISSING_UPLOADS_IGNORED] = truepost.save_custom_fieldsdiff --git a/spec/tasks/redis_spec.rb b/spec/tasks/redis_spec.rbindex 6db66509ecc..d9332a32a94 100644--- a/spec/tasks/redis_spec.rb+++ b/spec/tasks/redis_spec.rb@@ -4,7 +4,7 @@ RSpec.describe "Redis rake tasks", type: :multisite dolet(:redis) { Discourse.redis.without_namespace }describe "clean up" do- it "should clean up orphan Redis keys" do+ it "cleans up orphan Redis keys" doactive_keys = %w[__mb_backlog_id_n_/users/someusername$|$defaultdefault:user-last-seen:607diff --git a/spec/tasks/themes_spec.rb b/spec/tasks/themes_spec.rbindex 281f6205e9e..3fe94de04f9 100644--- a/spec/tasks/themes_spec.rb+++ b/spec/tasks/themes_spec.rb@@ -229,7 +229,7 @@ RSpec.describe "tasks/themes" doafter { `rm -fr #{initial_repo}` }- it "should retain a theme's settings and not update the theme when a theme's setting fails to save" do+ it "preserves the theme and its settings when a setting fails to save" dotheme.update_setting(:some_setting, "some setting value")migration_content = <<~JS@@ -280,7 +280,7 @@ RSpec.describe "tasks/themes" doexpect(theme.settings[:string_setting].value).to eq("default value")end- it "should not update the theme if a theme setting migration fails during the update" do+ it "preserves the theme when a setting migration fails during the update" domigration_content = <<~JSexport default function migrate(settings) {throw "error";diff --git a/spec/tasks/topics_spec.rb b/spec/tasks/topics_spec.rbindex a2273a231b9..4d570234fb6 100644--- a/spec/tasks/topics_spec.rb+++ b/spec/tasks/topics_spec.rb@@ -8,7 +8,7 @@ RSpec.describe "Post rake tasks" dobefore { STDOUT.stubs(:write) }describe "topics:apply_autoclose" do- it "should close topics silently" do+ it "closes topics silently" docategory.auto_close_hours = 1category.save!diff --git a/spec/tasks/users_spec.rb b/spec/tasks/users_spec.rbindex 7beec249323..868a8ffe24a 100644--- a/spec/tasks/users_spec.rb+++ b/spec/tasks/users_spec.rb@@ -4,7 +4,7 @@ RSpec.describe "tasks/users" dodescribe "users:disable_2fa" dolet(:user) { Fabricate(:user) }- it "should remove all 2fa methods for user with given username" do+ it "removes all second factor methods for the given username" doFabricate(:user_second_factor_totp, user: user, name: "TOTP", enabled: true)Fabricate(:user_second_factor_totp, user: user, name: "TOTP2", enabled: true)Fabricate(diff --git a/themes/horizon/spec/system/horizon_high_level_spec.rb b/themes/horizon/spec/system/horizon_high_level_spec.rbindex a1cd9200d3d..f6f7eeb8339 100644--- a/themes/horizon/spec/system/horizon_high_level_spec.rb+++ b/themes/horizon/spec/system/horizon_high_level_spec.rb@@ -79,7 +79,7 @@ describe "Horizon theme | High level" docontext "for signed in users" dobefore { sign_in(current_user) }- it "works" do+ it "passes the high-level checks for a signed-in user" dovisit "/"run_all_high_level_testsend