A platform for community discussion. Free, open, simple.
DEV: Bump `rubocop-discourse` to 3.19.0 (#43358)
Alan Guo Xiang Tand82756af9db1
diff --git a/Gemfile.lock b/Gemfile.lockindex b5963238012..12a3195f972 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.18.0)+ rubocop-discourse (3.19.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.18.0) sha256=bdb31f13cbb1ed82443b5a53b36efbce3b52a77b7a0f3ee7b421ce81d937ce0b+ rubocop-discourse (3.19.0) sha256=8c441eae02dceb1962e2860b92eec1213f4ab8f3defeda2b89b1f2efaf121a31rubocop-discourse-base (1.0.0) sha256=a4121f0f2a8e32c3259fee22106af9fd35372cbeac14b0c69673bdee79b472b7rubocop-factory_bot (2.28.0) sha256=4b17fc02124444173317e131759d195b0d762844a71a29fe8139c1105d92f0cbrubocop-rails (2.37.0) sha256=6e1645add5060e0328f8ddda0d820f55697c591394398bf14bb9dccb62f14b7ediff --git a/migrations/converters/spec/lib/migrations/converters_spec.rb b/migrations/converters/spec/lib/migrations/converters_spec.rbindex 6593145ab73..a6a904a0040 100644--- a/migrations/converters/spec/lib/migrations/converters_spec.rb+++ b/migrations/converters/spec/lib/migrations/converters_spec.rb@@ -10,6 +10,7 @@ RSpec.describe Migrations::Converters doallow(described_class).to receive(:private_converters_path).and_return(private_path)reset_memoization(described_class, :@all_converters)end+after doFileUtils.remove_dir(root_path, force: true)reset_memoization(described_class, :@all_converters)diff --git a/plugins/automation/spec/scripts/auto_tag_topic_spec.rb b/plugins/automation/spec/scripts/auto_tag_topic_spec.rbindex f1433edfdd2..d1330db26cd 100644--- a/plugins/automation/spec/scripts/auto_tag_topic_spec.rb+++ b/plugins/automation/spec/scripts/auto_tag_topic_spec.rb@@ -94,6 +94,7 @@ describe "AutoTagTopic" dotarget: "script",)end+it "works" doautomation.trigger!("topic" => topic, "status" => :automatically)@@ -106,6 +107,7 @@ describe "AutoTagTopic" doexpect(topic.reload.tags.pluck(:name)).to be_emptyendend+context "when closed_manually is set" dobefore doautomation.upsert_field!("tags", "tags", { value: %w[tag1 tag2] })diff --git a/plugins/automation/spec/scripts/topic_spec.rb b/plugins/automation/spec/scripts/topic_spec.rbindex fe3f1d65726..ad24c4ba284 100644--- a/plugins/automation/spec/scripts/topic_spec.rb+++ b/plugins/automation/spec/scripts/topic_spec.rb@@ -3,6 +3,7 @@describe "Topic" dolet!(:raw) { "this is me testing a new topic by automation" }let!(:title) { "This is a new topic created by automation" }+fab!(:category)fab!(:tag1, :tag)fab!(:tag2, :tag)diff --git a/plugins/automation/spec/scripts/user_group_membership_through_badge_spec.rb b/plugins/automation/spec/scripts/user_group_membership_through_badge_spec.rbindex b79cb8ef04c..102c106d0c6 100644--- a/plugins/automation/spec/scripts/user_group_membership_through_badge_spec.rb+++ b/plugins/automation/spec/scripts/user_group_membership_through_badge_spec.rb@@ -14,6 +14,7 @@ describe "UserGroupMembershipThroughBadge" doendbefore { BadgeGranter.enable_queue }+after doBadgeGranter.disable_queueBadgeGranter.clear_queue!diff --git a/plugins/automation/spec/triggers/category_created_edited_spec.rb b/plugins/automation/spec/triggers/category_created_edited_spec.rbindex 9e621acd9ec..3c83758f6e2 100644--- a/plugins/automation/spec/triggers/category_created_edited_spec.rb+++ b/plugins/automation/spec/triggers/category_created_edited_spec.rb@@ -20,6 +20,7 @@ describe "CategoryCreatedEdited" docontext "when category is restricted" dolet(:parent_category_id) { Category.first.id }+before doautomation.upsert_field!("restricted_category",diff --git a/plugins/automation/spec/triggers/user_promoted_spec.rb b/plugins/automation/spec/triggers/user_promoted_spec.rbindex c8741d6e641..ee42df2fea3 100644--- a/plugins/automation/spec/triggers/user_promoted_spec.rb+++ b/plugins/automation/spec/triggers/user_promoted_spec.rb@@ -28,6 +28,7 @@ describe "UserPromoted" docontext "when there is a group restriction" dolet!(:group) { Fabricate(:group) }+before doautomation.upsert_field!("restricted_group",diff --git a/plugins/chat/spec/jobs/regular/chat/notify_watching_spec.rb b/plugins/chat/spec/jobs/regular/chat/notify_watching_spec.rbindex 1a10d7d5565..c1ffc445b7a 100644--- a/plugins/chat/spec/jobs/regular/chat/notify_watching_spec.rb+++ b/plugins/chat/spec/jobs/regular/chat/notify_watching_spec.rb@@ -185,6 +185,7 @@ RSpec.describe Jobs::Chat::NotifyWatching doargsendend+it "Allows for changes to the translation args" doplugin_instance = Plugin::Instance.newplugin_instance.register_modifier(:chat_notification_translation_args, &modifier_block)diff --git a/plugins/chat/spec/jobs/regular/chat/process_message_spec.rb b/plugins/chat/spec/jobs/regular/chat/process_message_spec.rbindex 7f4607dcae9..376e8f58357 100644--- a/plugins/chat/spec/jobs/regular/chat/process_message_spec.rb+++ b/plugins/chat/spec/jobs/regular/chat/process_message_spec.rb@@ -72,6 +72,7 @@ describe Jobs::Chat::ProcessMessage dodescribe "pull hotlinked images" dolet(:image_url) { "https://example.com/img.png" }+fab!(:hotlinked_message) doFabricate(:chat_message, message: "")enddiff --git a/plugins/chat/spec/lib/chat/duplicate_message_validator_spec.rb b/plugins/chat/spec/lib/chat/duplicate_message_validator_spec.rbindex 55385363530..2801a209667 100644--- a/plugins/chat/spec/lib/chat/duplicate_message_validator_spec.rb+++ b/plugins/chat/spec/lib/chat/duplicate_message_validator_spec.rb@@ -2,6 +2,7 @@describe Chat::DuplicateMessageValidator dolet(:message) { "goal!" }+fab!(:category_channel, :chat_channel)fab!(:dm_channel, :direct_message_channel)fab!(:user)diff --git a/plugins/chat/spec/models/chat/category_channel_spec.rb b/plugins/chat/spec/models/chat/category_channel_spec.rbindex 19184248c38..f3ae70a7a8d 100644--- a/plugins/chat/spec/models/chat/category_channel_spec.rb+++ b/plugins/chat/spec/models/chat/category_channel_spec.rb@@ -126,6 +126,7 @@ RSpec.describe Chat::CategoryChannel doSiteSetting.slug_generation_method = "encoded"channel.slug = "测试"end+after { SiteSetting.slug_generation_method = "ascii" }it "creates a slug with the correct escaping" dodiff --git a/plugins/chat/spec/models/chat/direct_message_channel_spec.rb b/plugins/chat/spec/models/chat/direct_message_channel_spec.rbindex b309c51bc53..a1a6dc0da3f 100644--- a/plugins/chat/spec/models/chat/direct_message_channel_spec.rb+++ b/plugins/chat/spec/models/chat/direct_message_channel_spec.rb@@ -115,6 +115,7 @@ RSpec.describe Chat::DirectMessageChannel dochannel.chatable.update!(group: false)expect(channel).not_to be_direct_message_groupend+it "returns true if the DirectMessage chatable is for a group DM" dochannel.chatable.update!(group: true)expect(channel).to be_direct_message_groupdiff --git a/plugins/chat/spec/models/chat/message_spec.rb b/plugins/chat/spec/models/chat/message_spec.rbindex ba0b2a65c73..c7474d1f902 100644--- a/plugins/chat/spec/models/chat/message_spec.rb+++ b/plugins/chat/spec/models/chat/message_spec.rb@@ -814,6 +814,7 @@ describe Chat::Message dodescribe "blocking duplicate messages" dolet(:message) { "this is duplicate" }+fab!(:chat_channel)fab!(:user)diff --git a/plugins/chat/spec/models/user_option_spec.rb b/plugins/chat/spec/models/user_option_spec.rbindex 75532527cb2..2502d457760 100644--- a/plugins/chat/spec/models/user_option_spec.rb+++ b/plugins/chat/spec/models/user_option_spec.rb@@ -6,21 +6,25 @@ RSpec.describe UserOption doexpect(described_class.new.chat_separate_sidebar_mode).to eq("default")endend+describe "#show_thread_title_prompts" doit "is present" doexpect(described_class.new.show_thread_title_prompts).to eq(true)endend+describe "#chat_announce_new_messages" doit "defaults to true" doexpect(described_class.new.chat_announce_new_messages).to eq(true)endend+describe "#chat_new_message_sound" doit "defaults to false" doexpect(described_class.new.chat_new_message_sound).to eq(false)endend+describe "#chat_quick_reaction_type" doit "is present with frequent as default" doexpect(described_class.new.chat_quick_reaction_type).to eq("frequent")diff --git a/plugins/chat/spec/plugin_spec.rb b/plugins/chat/spec/plugin_spec.rbindex 1fa70ddd888..6ef38463b0d 100644--- a/plugins/chat/spec/plugin_spec.rb+++ b/plugins/chat/spec/plugin_spec.rb@@ -87,6 +87,7 @@ describe Chat dolet!(:user) { Fabricate(:user) }let!(:guardian) { Guardian.new(user) }let(:serializer) { UserCardSerializer.new(target_user, scope: guardian) }+fab!(:group)context "when chat enabled" dodiff --git a/plugins/chat/spec/queries/chat/messages_query_spec.rb b/plugins/chat/spec/queries/chat/messages_query_spec.rbindex 97494059bf5..c3e32dfb598 100644--- a/plugins/chat/spec/queries/chat/messages_query_spec.rb+++ b/plugins/chat/spec/queries/chat/messages_query_spec.rb@@ -134,6 +134,7 @@ RSpec.describe Chat::MessagesQuery docontext "when thread_id is provided" dolet(:thread_id) { thread.id }+it "does include messages which are part of a thread" domessage_3.update!(thread: thread,diff --git a/plugins/chat/spec/queries/chat/tracking_state_report_query_spec.rb b/plugins/chat/spec/queries/chat/tracking_state_report_query_spec.rbindex 6f3e30866bf..3c3bd58384a 100644--- a/plugins/chat/spec/queries/chat/tracking_state_report_query_spec.rb+++ b/plugins/chat/spec/queries/chat/tracking_state_report_query_spec.rb@@ -22,6 +22,7 @@ RSpec.describe Chat::TrackingStateReportQuery dolet(:include_threads) { false }let(:include_read) { true }let(:include_last_reply_details) { false }+context "when channel_ids empty" doit "returns empty object for channel_tracking" doexpect(query.channel_tracking).to eq({})@@ -80,6 +81,7 @@ RSpec.describe Chat::TrackingStateReportQuery docontext "when include_threads is true" dolet(:include_threads) { true }+fab!(:thread_1) { Fabricate(:chat_thread, channel: channel_1) }fab!(:thread_2) { Fabricate(:chat_thread, channel: channel_2) }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 2e994025bfc..f3245f0aaa4 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@@ -316,6 +316,7 @@ RSpec.describe Chat::Api::ChannelThreadsController dodescribe "update" dolet(:title) { "New title" }let(:params) { { title: title } }+fab!(:thread) doFabricate(:chat_thread, channel: public_channel, original_message_user: current_user)enddiff --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 873906ba481..cf15d9659e9 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@@ -23,6 +23,7 @@ describe Chat::Api::ChannelsCurrentUserMembershipController docontext "when channel is not found" dobefore { channel_1.destroy! }+it "returns a 404" dodelete "/chat/api/channels/-999/memberships/me/follows"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 69d72194512..a72622d9afd 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@@ -53,6 +53,7 @@ RSpec.describe Chat::Api::ChannelsMessagesFlagsController doexpect(response.status).to eq(404)endend+context "when channel is not found" doit "returns a 404" dopost "/chat/api/channels/-999/messages/#{message_1.id}/flags", params: paramsdiff --git a/plugins/chat/spec/services/chat/add_users_to_channel_spec.rb b/plugins/chat/spec/services/chat/add_users_to_channel_spec.rbindex 0b13e6cfeba..862e2a2493f 100644--- a/plugins/chat/spec/services/chat/add_users_to_channel_spec.rb+++ b/plugins/chat/spec/services/chat/add_users_to_channel_spec.rb@@ -8,6 +8,7 @@ RSpec.describe Chat::AddUsersToChannel dolet(:groups) { "group1" }it { is_expected.to validate_presence_of :channel_id }+it dois_expected.to validate_length_of(:usernames).is_at_most(SiteSetting.chat_max_direct_message_users)diff --git a/plugins/chat/spec/services/chat/auto_leave_channels_spec.rb b/plugins/chat/spec/services/chat/auto_leave_channels_spec.rbindex 7a16bb77862..d0dfa7164e2 100644--- a/plugins/chat/spec/services/chat/auto_leave_channels_spec.rb+++ b/plugins/chat/spec/services/chat/auto_leave_channels_spec.rb@@ -111,6 +111,7 @@ RSpec.describe Chat::AutoLeaveChannels docontext "with another category/channel/user" dolet(:params) { { event: :generic_event } }+fab!(:user_2) { Fabricate(:user, trust_level: 1) }fab!(:category_2) { Fabricate(:private_category, group:) }fab!(:chat_channel_2) { Fabricate(:chat_channel, chatable: category_2) }diff --git a/plugins/chat/spec/services/chat/list_channel_messages_spec.rb b/plugins/chat/spec/services/chat/list_channel_messages_spec.rbindex 37febd4d4b0..aed8c21ed5a 100644--- a/plugins/chat/spec/services/chat/list_channel_messages_spec.rb+++ b/plugins/chat/spec/services/chat/list_channel_messages_spec.rb@@ -9,6 +9,7 @@ RSpec.describe Chat::ListChannelMessages doit { is_expected.to validate_presence_of(:channel_id) }it { is_expected.to allow_values(1, options.max_page_size, nil).for(:page_size) }it { is_expected.not_to allow_values(0).for(:page_size) }+it dois_expected.to validate_inclusion_of(:direction).in_array(Chat::MessagesQuery::VALID_DIRECTIONS,diff --git a/plugins/chat/spec/services/chat/list_channel_thread_messages_spec.rb b/plugins/chat/spec/services/chat/list_channel_thread_messages_spec.rbindex 162dde8ac3d..dec2beae6ef 100644--- a/plugins/chat/spec/services/chat/list_channel_thread_messages_spec.rb+++ b/plugins/chat/spec/services/chat/list_channel_thread_messages_spec.rb@@ -10,6 +10,7 @@ RSpec.describe Chat::ListChannelThreadMessages doit { is_expected.to validate_presence_of(:channel_id) }it { is_expected.to allow_values(1, options.max_page_size, nil).for(:page_size) }it { is_expected.not_to allow_values(0).for(:page_size) }+it dois_expected.to validate_inclusion_of(:direction).in_array(Chat::MessagesQuery::VALID_DIRECTIONS,diff --git a/plugins/chat/spec/services/chat/lookup_channel_threads_spec.rb b/plugins/chat/spec/services/chat/lookup_channel_threads_spec.rbindex 042e1f6b5bf..c0066846c34 100644--- a/plugins/chat/spec/services/chat/lookup_channel_threads_spec.rb+++ b/plugins/chat/spec/services/chat/lookup_channel_threads_spec.rb@@ -3,6 +3,7 @@RSpec.describe ::Chat::LookupChannelThreads::Contract, type: :model doit { is_expected.to validate_presence_of(:channel_id) }it { is_expected.to allow_values(1, 0, nil, "a").for(:limit) }+it dois_expected.not_to allow_values(::Chat::LookupChannelThreads::THREADS_LIMIT + 1).for(:limit)enddiff --git a/plugins/chat/spec/services/chat/restore_message_spec.rb b/plugins/chat/spec/services/chat/restore_message_spec.rbindex 96f3644e620..eaf3f72fec6 100644--- a/plugins/chat/spec/services/chat/restore_message_spec.rb+++ b/plugins/chat/spec/services/chat/restore_message_spec.rb@@ -3,6 +3,7 @@RSpec.describe Chat::RestoreMessage dofab!(:current_user, :user)let!(:guardian) { Guardian.new(current_user) }+fab!(:message) { Fabricate(:chat_message, user: current_user) }before dodiff --git a/plugins/chat/spec/services/chat/update_channel_status_spec.rb b/plugins/chat/spec/services/chat/update_channel_status_spec.rbindex 6cf1e6e1eef..2b4db569cf7 100644--- a/plugins/chat/spec/services/chat/update_channel_status_spec.rb+++ b/plugins/chat/spec/services/chat/update_channel_status_spec.rb@@ -3,6 +3,7 @@RSpec.describe(Chat::UpdateChannelStatus) dodescribe described_class::Contract, type: :model doit { is_expected.to validate_presence_of(:channel_id) }+it dois_expected.to validate_inclusion_of(:status).in_array(Chat::Channel.editable_statuses.keys)enddiff --git a/plugins/chat/spec/services/chat/update_message_spec.rb b/plugins/chat/spec/services/chat/update_message_spec.rbindex f8fa872b2f4..8473a6fb501 100644--- a/plugins/chat/spec/services/chat/update_message_spec.rb+++ b/plugins/chat/spec/services/chat/update_message_spec.rb@@ -21,6 +21,7 @@ RSpec.describe Chat::UpdateMessage dodescribe "with validation" dolet(:guardian) { Guardian.new(user1) }+fab!(:admin1, :admin)fab!(:admin2, :admin)fab!(:user1) { Fabricate(:user, refresh_auto_groups: true) }diff --git a/plugins/chat/spec/services/chat/workflows/approval/resume_interaction_spec.rb b/plugins/chat/spec/services/chat/workflows/approval/resume_interaction_spec.rbindex a16cb0d86c9..3b6a3202568 100644--- a/plugins/chat/spec/services/chat/workflows/approval/resume_interaction_spec.rb+++ b/plugins/chat/spec/services/chat/workflows/approval/resume_interaction_spec.rb@@ -222,6 +222,7 @@ RSpec.describe Chat::Workflows::Approval::ResumeInteraction do"channel_id" => channel.id.to_s,}end+it { is_expected.to fail_to_find_a_model(:resolved_interaction) }enddiff --git a/plugins/chat/spec/support/examples/chat_channel_model.rb b/plugins/chat/spec/support/examples/chat_channel_model.rbindex d8745a57596..f9bf7b91bf6 100644--- a/plugins/chat/spec/support/examples/chat_channel_model.rb+++ b/plugins/chat/spec/support/examples/chat_channel_model.rb@@ -15,6 +15,7 @@ RSpec.shared_examples "a chat channel model" doit { is_expected.to have_many(:user_chat_channel_memberships) }it { is_expected.to have_one(:chat_channel_archive) }it { is_expected.to delegate_method(:empty?).to(:chat_messages).with_prefix }+it dois_expected.to define_enum_for(:status).with_values(open: 0,@@ -26,6 +27,7 @@ RSpec.shared_examples "a chat channel model" dodescribe "Validations" doit { is_expected.to validate_presence_of(:name).allow_nil }+it dois_expected.to validate_length_of(:name).is_at_most(SiteSetting.max_topic_title_length,diff --git a/plugins/chat/spec/system/admin/csv_exports_spec.rb b/plugins/chat/spec/system/admin/csv_exports_spec.rbindex 73289fccc02..94e09c37fcd 100644--- a/plugins/chat/spec/system/admin/csv_exports_spec.rb+++ b/plugins/chat/spec/system/admin/csv_exports_spec.rb@@ -3,6 +3,7 @@RSpec.describe "Admin Chat CSV exports" dolet(:dialog) { PageObjects::Components::Dialog.new }let(:csv_export_pm_page) { PageObjects::Pages::CSVExportPM.new }+fab!(:current_user, :admin)before dodiff --git a/plugins/chat/spec/system/bookmark_message_spec.rb b/plugins/chat/spec/system/bookmark_message_spec.rbindex e7fc75d3ee4..4aff2fe08c4 100644--- a/plugins/chat/spec/system/bookmark_message_spec.rb+++ b/plugins/chat/spec/system/bookmark_message_spec.rb@@ -28,6 +28,7 @@ RSpec.describe "Bookmark message" doexpect(channel_page).to have_bookmarked_message(message_1)end+context "when in a long thread" doit "supports linking to a bookmark in a long thread" docategory_channel_1.update!(threading_enabled: true)diff --git a/plugins/checklist/spec/services/checklist/toggle_checkbox_spec.rb b/plugins/checklist/spec/services/checklist/toggle_checkbox_spec.rbindex 92980ba38a1..2eadf3dc110 100644--- a/plugins/checklist/spec/services/checklist/toggle_checkbox_spec.rb+++ b/plugins/checklist/spec/services/checklist/toggle_checkbox_spec.rb@@ -4,6 +4,7 @@ RSpec.describe Checklist::ToggleCheckbox dodescribe described_class::Contract, type: :model doit { is_expected.to validate_presence_of(:post_id) }it { is_expected.to validate_presence_of(:toggles) }+it "limits the batch size" dotoggles =Array.new(Checklist::ToggleCheckbox::MAX_BATCH_SIZE + 1) do |index|@@ -21,6 +22,7 @@ RSpec.describe Checklist::ToggleCheckbox doexpect(contract).not_to be_validexpect(contract.errors[:toggles]).to be_presentend+it { is_expected.to validate_presence_of(:expected_raw) }it { is_expected.to validate_length_of(:expected_raw).is_at_most(SiteSetting.max_post_length) }it { is_expected.to validate_presence_of(:expected_updated_at) }diff --git a/plugins/discourse-ai/spec/configuration/llm_validator_spec.rb b/plugins/discourse-ai/spec/configuration/llm_validator_spec.rbindex 572a45528bb..bf95b760e7c 100644--- a/plugins/discourse-ai/spec/configuration/llm_validator_spec.rb+++ b/plugins/discourse-ai/spec/configuration/llm_validator_spec.rb@@ -5,6 +5,7 @@ RSpec.describe DiscourseAi::Configuration::LlmValidator dodescribe "#valid_value?" dolet(:validator) { described_class.new(name: :ai_default_llm_model) }+fab!(:llm_model)before do@@ -44,6 +45,7 @@ RSpec.describe DiscourseAi::Configuration::LlmValidator dodescribe "#run_test" dolet(:validator) { described_class.new }+fab!(:llm_model)it "exercises both non-streaming and streaming completions" dodiff --git a/plugins/discourse-ai/spec/evals/runners/inference_spec.rb b/plugins/discourse-ai/spec/evals/runners/inference_spec.rbindex 5b5cd8d8ad8..c54db47a5fa 100644--- a/plugins/discourse-ai/spec/evals/runners/inference_spec.rb+++ b/plugins/discourse-ai/spec/evals/runners/inference_spec.rb@@ -13,6 +13,7 @@ RSpec.describe DiscourseAi::Evals::Runners::Inference doread_buffered_property: %w[concept_a concept_b],)end+before dostub_runner_bot(agent: DiscourseAi::Agents::ConceptFinder.new) do |blk|blk.call(structured_output, nil, :structured_output)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 005cef5191a..aab495124be 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@@ -99,6 +99,7 @@ describe Jobs::DigestRagUpload doexpect(parsed).to eq(parsed_document_with_metadata.read.delete_suffix("\n"))endend+context "when processing an upload for the first time" dobefore { File.expects(:open).returns(document_file) }diff --git a/plugins/discourse-ai/spec/jobs/regular/stream_composer_helper_spec.rb b/plugins/discourse-ai/spec/jobs/regular/stream_composer_helper_spec.rbindex 2a63c2f0495..dae20597e0a 100644--- a/plugins/discourse-ai/spec/jobs/regular/stream_composer_helper_spec.rb+++ b/plugins/discourse-ai/spec/jobs/regular/stream_composer_helper_spec.rb@@ -10,6 +10,7 @@ RSpec.describe Jobs::StreamComposerHelper dodescribe "#execute" dolet!(:input) { "I liek to eet pie fur brakefast becuz it is delishus." }+fab!(:user, :leader)before dodiff --git a/plugins/discourse-ai/spec/lib/agents/tool_runner/discourse_spec.rb b/plugins/discourse-ai/spec/lib/agents/tool_runner/discourse_spec.rbindex 87d6c1d3015..bcf8462dbc0 100644--- a/plugins/discourse-ai/spec/lib/agents/tool_runner/discourse_spec.rb+++ b/plugins/discourse-ai/spec/lib/agents/tool_runner/discourse_spec.rb@@ -5,6 +5,7 @@ require "rails_helper"RSpec.describe DiscourseAi::Agents::ToolRunner dofab!(:llm_model) { Fabricate(:llm_model, name: "claude-2") }let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }+fab!(:user) { Fabricate(:user, refresh_auto_groups: true) }fab!(:bot_user) { Fabricate(:user, admin: true, refresh_auto_groups: true) }fab!(:topic)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 c178bef24ec..ef33e5196c3 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@@ -5,6 +5,7 @@ require "rails_helper"RSpec.describe DiscourseAi::Agents::ToolRunner dofab!(:llm_model) { Fabricate(:llm_model, name: "claude-2") }let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }+fab!(:bot_user) { Discourse.system_user }def create_tool(script:)diff --git a/plugins/discourse-ai/spec/lib/agents/tool_runner/index_spec.rb b/plugins/discourse-ai/spec/lib/agents/tool_runner/index_spec.rbindex 485bdaa00e4..940fb7a25c9 100644--- a/plugins/discourse-ai/spec/lib/agents/tool_runner/index_spec.rb+++ b/plugins/discourse-ai/spec/lib/agents/tool_runner/index_spec.rb@@ -5,6 +5,7 @@ require "rails_helper"RSpec.describe DiscourseAi::Agents::ToolRunner dofab!(:llm_model) { Fabricate(:llm_model, name: "claude-2") }let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }+fab!(:bot_user) { Discourse.system_user }fab!(:user) { Fabricate(:user, refresh_auto_groups: true) }fab!(:tool) dodiff --git a/plugins/discourse-ai/spec/lib/agents/tool_runner/llm_spec.rb b/plugins/discourse-ai/spec/lib/agents/tool_runner/llm_spec.rbindex 5389b852cc6..ce88c125222 100644--- a/plugins/discourse-ai/spec/lib/agents/tool_runner/llm_spec.rb+++ b/plugins/discourse-ai/spec/lib/agents/tool_runner/llm_spec.rb@@ -5,6 +5,7 @@ require "rails_helper"RSpec.describe DiscourseAi::Agents::ToolRunner dofab!(:llm_model) { Fabricate(:llm_model, name: "claude-2") }let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }+fab!(:bot_user) { Discourse.system_user }def create_tool(script:)diff --git a/plugins/discourse-ai/spec/lib/agents/tools/add_reviewable_note_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/add_reviewable_note_spec.rbindex 2d453ad52f9..1f004a0eca1 100644--- a/plugins/discourse-ai/spec/lib/agents/tools/add_reviewable_note_spec.rb+++ b/plugins/discourse-ai/spec/lib/agents/tools/add_reviewable_note_spec.rb@@ -4,6 +4,7 @@ RSpec.describe DiscourseAi::Agents::Tools::AddReviewableNote dofab!(:llm_model)let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }+fab!(:admin)before dodiff --git a/plugins/discourse-ai/spec/lib/agents/tools/create_artifact_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/create_artifact_spec.rbindex 3b4e265a3e1..2ec0d3b2c3f 100644--- a/plugins/discourse-ai/spec/lib/agents/tools/create_artifact_spec.rb+++ b/plugins/discourse-ai/spec/lib/agents/tools/create_artifact_spec.rb@@ -3,6 +3,7 @@RSpec.describe DiscourseAi::Agents::Tools::CreateArtifact dofab!(:llm_model)let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }+fab!(:post)before dodiff --git a/plugins/discourse-ai/spec/lib/agents/tools/list_reviewables_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/list_reviewables_spec.rbindex d6b2e3ab0cf..783b81ab054 100644--- a/plugins/discourse-ai/spec/lib/agents/tools/list_reviewables_spec.rb+++ b/plugins/discourse-ai/spec/lib/agents/tools/list_reviewables_spec.rb@@ -4,6 +4,7 @@ RSpec.describe DiscourseAi::Agents::Tools::ListReviewables dofab!(:llm_model)let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }+fab!(:admin)before dodiff --git a/plugins/discourse-ai/spec/lib/agents/tools/perform_reviewable_action_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/perform_reviewable_action_spec.rbindex 1727fea3e28..0697d2053bd 100644--- a/plugins/discourse-ai/spec/lib/agents/tools/perform_reviewable_action_spec.rb+++ b/plugins/discourse-ai/spec/lib/agents/tools/perform_reviewable_action_spec.rb@@ -4,6 +4,7 @@ RSpec.describe DiscourseAi::Agents::Tools::PerformReviewableAction dofab!(:llm_model)let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }+fab!(:admin)before dodiff --git a/plugins/discourse-ai/spec/lib/agents/tools/read_artifact_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/read_artifact_spec.rbindex eaef70ddde2..a59d513aa63 100644--- a/plugins/discourse-ai/spec/lib/agents/tools/read_artifact_spec.rb+++ b/plugins/discourse-ai/spec/lib/agents/tools/read_artifact_spec.rb@@ -3,6 +3,7 @@RSpec.describe DiscourseAi::Agents::Tools::ReadArtifact dofab!(:llm_model)let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }+fab!(:post)fab!(:post2) { Fabricate(:post, user: post.user) }fab!(:artifact) dodiff --git a/plugins/discourse-ai/spec/lib/agents/tools/read_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/read_spec.rbindex a0e9cda5fba..070ae6b0ce1 100644--- a/plugins/discourse-ai/spec/lib/agents/tools/read_spec.rb+++ b/plugins/discourse-ai/spec/lib/agents/tools/read_spec.rb@@ -88,6 +88,7 @@ RSpec.describe DiscourseAi::Agents::Tools::Read doexpect(results[:content]).to include("hello there")expect(results[:content]).not_to include("mister sam")end+it "can read a topic" dotopic_id = topic_with_tags.idresults = tool.invokediff --git a/plugins/discourse-ai/spec/lib/agents/tools/update_artifact_spec.rb b/plugins/discourse-ai/spec/lib/agents/tools/update_artifact_spec.rbindex 651fab9198f..e51a779b6af 100644--- a/plugins/discourse-ai/spec/lib/agents/tools/update_artifact_spec.rb+++ b/plugins/discourse-ai/spec/lib/agents/tools/update_artifact_spec.rb@@ -3,6 +3,7 @@RSpec.describe DiscourseAi::Agents::Tools::UpdateArtifact dofab!(:llm_model)let(:bot_user) { DiscourseAi::AiBot::EntryPoint.find_user_from_model(llm_model.name) }+fab!(:post)fab!(:artifact) doAiArtifact.create!(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 bdb24d5084c..f57fa611108 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@@ -95,6 +95,7 @@ RSpec.describe DiscourseAi::Completions::Dialects::ChatGpt doexpect(translated.last[:role]).to eq("user")expect(translated.last[:content].length).to be < (8000 * 4)end+it "renders converted document uploads as text content parts" dollm_model.update!(allowed_attachment_types: ["docx"])converted_text = "Uploaded document: sample.docx (13 Bytes)\n\nConverted text"diff --git a/plugins/discourse-ai/spec/lib/completions/endpoints/aws_bedrock_converse_spec.rb b/plugins/discourse-ai/spec/lib/completions/endpoints/aws_bedrock_converse_spec.rbindex 000a3f996a1..4e14c48628d 100644--- a/plugins/discourse-ai/spec/lib/completions/endpoints/aws_bedrock_converse_spec.rb+++ b/plugins/discourse-ai/spec/lib/completions/endpoints/aws_bedrock_converse_spec.rb@@ -401,6 +401,7 @@ RSpec.describe DiscourseAi::Completions::Endpoints::AwsBedrockConverse do)expect(AiApiAuditLog.last.response_status).to be_nilend+it "records SDK error response status when available" doclient = instance_double(Aws::BedrockRuntime::Client)context = Seahorse::Client::RequestContext.newdiff --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 9318e1f5613..61b8b04f210 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@@ -825,6 +825,7 @@ describe DiscourseAi::Completions::PromptMessagesBuilder do*[{ type: :user, id: user.username, content: third_post.raw }],)end+it "starts from the last compressed checkpoint" dobuilder.push(type: :user, content: "Old request")builder.push(type: :model, content: "Old response")@@ -1109,6 +1110,7 @@ describe DiscourseAi::Completions::PromptMessagesBuilder do],)end+it "normalizes saved thinking provider info" docustom_prompt = [[diff --git a/plugins/discourse-ai/spec/lib/discourse_automation/automation_spec.rb b/plugins/discourse-ai/spec/lib/discourse_automation/automation_spec.rbindex be0c21a663f..603074679a4 100644--- a/plugins/discourse-ai/spec/lib/discourse_automation/automation_spec.rb+++ b/plugins/discourse-ai/spec/lib/discourse_automation/automation_spec.rb@@ -32,6 +32,7 @@ RSpec.describe DiscourseAi::Automation dodescribe "manually configured model" dolet!(:llm_model) { Fabricate(:llm_model) }+it "returns a list of available models for automation" domodels = DiscourseAi::Automation.available_modelsexpect(models).to be_an(Array)diff --git a/plugins/discourse-ai/spec/lib/guardian_extensions_spec.rb b/plugins/discourse-ai/spec/lib/guardian_extensions_spec.rbindex ac274eae7eb..4eec860ffed 100644--- a/plugins/discourse-ai/spec/lib/guardian_extensions_spec.rb+++ b/plugins/discourse-ai/spec/lib/guardian_extensions_spec.rb@@ -53,6 +53,7 @@ describe DiscourseAi::GuardianExtensions docontext "when the topic is a PM" dobefore { assign_agent_to(:ai_summarization_agent, [group.id]) }+let(:pm) { Fabricate(:private_message_topic) }it "returns false" do@@ -95,6 +96,7 @@ describe DiscourseAi::GuardianExtensions dodescribe "#can_see_gists?" dobefore { assign_agent_to(:ai_summary_gists_agent, [group.id]) }+let(:guardian) { Guardian.new(user) }context "when access is restricted to the user's group" dodiff --git a/plugins/discourse-ai/spec/lib/modules/ai_moderation/spam_scanner_spec.rb b/plugins/discourse-ai/spec/lib/modules/ai_moderation/spam_scanner_spec.rbindex bc283fd99be..ada0be2195b 100644--- a/plugins/discourse-ai/spec/lib/modules/ai_moderation/spam_scanner_spec.rb+++ b/plugins/discourse-ai/spec/lib/modules/ai_moderation/spam_scanner_spec.rb@@ -332,6 +332,7 @@ RSpec.describe DiscourseAi::AiModeration::SpamScanner dodescribe "integration test" dofab!(:llm_model)let(:api_audit_log) { Fabricate(:api_audit_log) }+fab!(:post_with_uploaded_image)before { Jobs.run_immediately! }diff --git a/plugins/discourse-ai/spec/lib/modules/sentiment/emotion_filter_order_spec.rb b/plugins/discourse-ai/spec/lib/modules/sentiment/emotion_filter_order_spec.rbindex efb31e14a8f..ae9295347db 100644--- a/plugins/discourse-ai/spec/lib/modules/sentiment/emotion_filter_order_spec.rb+++ b/plugins/discourse-ai/spec/lib/modules/sentiment/emotion_filter_order_spec.rb@@ -216,6 +216,7 @@ RSpec.describe DiscourseAi::Sentiment::EmotionFilterOrder doTopicsFilter.new(guardian:).filter_from_query_string("order:emotion_love-asc").pluck(:id),).to contain_exactly(post_2.topic.id, post_1.topic.id)end+it "sorts emotion in default descending order" doexpect(TopicsFilter.new(guardian:).filter_from_query_string("order:emotion_love").pluck(:id),diff --git a/plugins/discourse-ai/spec/lib/modules/summarization/entry_point_spec.rb b/plugins/discourse-ai/spec/lib/modules/summarization/entry_point_spec.rbindex 7f6be186597..ba03422e17c 100644--- a/plugins/discourse-ai/spec/lib/modules/summarization/entry_point_spec.rb+++ b/plugins/discourse-ai/spec/lib/modules/summarization/entry_point_spec.rb@@ -49,6 +49,7 @@ RSpec.describe DiscourseAi::Summarization::EntryPoint dodescribe "topic_list_item serializer's ai_summary" docontext "when hot topic summarization is disabled" dobefore { SiteSetting.ai_summary_gists_enabled = false }+it "doesn't include summaries" dogist_topic = topic_query.list_hot.topics.find { |t| t.id == topic_ai_gist.target_id }diff --git a/plugins/discourse-ai/spec/lib/translation/base_translator_spec.rb b/plugins/discourse-ai/spec/lib/translation/base_translator_spec.rbindex 4e4fb21e098..517596e51e1 100644--- a/plugins/discourse-ai/spec/lib/translation/base_translator_spec.rb+++ b/plugins/discourse-ai/spec/lib/translation/base_translator_spec.rb@@ -16,6 +16,7 @@ describe DiscourseAi::Translation::BaseTranslator dolet(:target_locale) { "de" }let(:content_description) { "A tag about cats" }let(:llm_response) { "hur dur hur dur!" }+fab!(:post)fab!(:topic) { post.topic }diff --git a/plugins/discourse-ai/spec/lib/translation/post_locale_detector_spec.rb b/plugins/discourse-ai/spec/lib/translation/post_locale_detector_spec.rbindex 48120685f14..bb15c2025b0 100644--- a/plugins/discourse-ai/spec/lib/translation/post_locale_detector_spec.rb+++ b/plugins/discourse-ai/spec/lib/translation/post_locale_detector_spec.rb@@ -2,6 +2,7 @@describe DiscourseAi::Translation::PostLocaleDetector dobefore { enable_current_plugin }+describe ".detect_locale" dofab!(:post) { Fabricate(:post, cooked: "Hello world", locale: nil) }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 de400a98ab7..5739459a13e 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@@ -183,6 +183,7 @@ RSpec.describe DiscourseAi::Utils::DiffUtils::HunkDiff docontext "without markers" dolet(:original_text) { "hello" }let(:diff) { "world" }+it "will append to the end" doexpect(apply_hunk).to eq("hello\nworld")enddiff --git a/plugins/discourse-ai/spec/lib/utils/diff_utils/safety_checker_spec.rb b/plugins/discourse-ai/spec/lib/utils/diff_utils/safety_checker_spec.rbindex 12750fc15f9..425ca2b2227 100644--- a/plugins/discourse-ai/spec/lib/utils/diff_utils/safety_checker_spec.rb+++ b/plugins/discourse-ai/spec/lib/utils/diff_utils/safety_checker_spec.rb@@ -13,21 +13,25 @@ RSpec.describe DiscourseAi::Utils::DiffUtils::SafetyChecker docontext "with normal HTML tags" dolet(:text) { "Here is <strong>bold</strong> and <em>italic</em> text." }+it { is_expected.to eq(true) }endcontext "with balanced markdown and no partial emoji" dolet(:text) { "This is **bold**, *italic*, and a smiley :smile:!" }+it { is_expected.to eq(true) }endcontext "with balanced quote blocks" dolet(:text) { "[quote]Quoted text[/quote]" }+it { is_expected.to eq(true) }endcontext "with complete image markdown" dolet(:text) { "" }+it { is_expected.to eq(true) }endend@@ -35,46 +39,55 @@ RSpec.describe DiscourseAi::Utils::DiffUtils::SafetyChecker docontext "with unsafe text" docontext "with unclosed markdown link" dolet(:text) { "This is a [link(https://example.com)" }+it { is_expected.to eq(false) }endcontext "with unclosed raw HTML tag" dolet(:text) { "Text with <div unclosed tag" }+it { is_expected.to eq(false) }endcontext "with trailing incomplete URL" dolet(:text) { "Check this out https://example.com/something" } # no closing punctuation+it { is_expected.to eq(false) }endcontext "with unclosed backticks" dolet(:text) { "Here is some `inline code without closing" }+it { is_expected.to eq(false) }endcontext "with unbalanced bold or italic markdown" dolet(:text) { "This is *italic without closing" }+it { is_expected.to eq(false) }endcontext "with incomplete image markdown" dolet(:text) { "Image +it { is_expected.to eq(false) }endcontext "with unbalanced quote blocks" dolet(:text) { "[quote]Unclosed quote block" }+it { is_expected.to eq(false) }endcontext "with unclosed triple backticks" dolet(:text) { "```code block without closing" }+it { is_expected.to eq(false) }endcontext "with partial emoji" dolet(:text) { "A partial emoji :smile" }+it { is_expected.to eq(false) }endenddiff --git a/plugins/discourse-ai/spec/lib/utils/search_spec.rb b/plugins/discourse-ai/spec/lib/utils/search_spec.rbindex 3cfccaa0d98..0503ca12914 100644--- a/plugins/discourse-ai/spec/lib/utils/search_spec.rb+++ b/plugins/discourse-ai/spec/lib/utils/search_spec.rb@@ -161,6 +161,7 @@ RSpec.describe DiscourseAi::Utils::Search docontext "when using semantic search" dolet(:query) { "this is an expanded search" }+after doif defined?(DiscourseAi::Embeddings::SemanticSearch)DiscourseAi::Embeddings::SemanticSearch.clear_cache_for(query)diff --git a/plugins/discourse-ai/spec/models/ai_tool_spec.rb b/plugins/discourse-ai/spec/models/ai_tool_spec.rbindex ea229377496..fad5cf30e33 100644--- a/plugins/discourse-ai/spec/models/ai_tool_spec.rb+++ b/plugins/discourse-ai/spec/models/ai_tool_spec.rb@@ -3,6 +3,7 @@RSpec.describe AiTool dofab!(:llm_model) { Fabricate(:llm_model, name: "claude-2") }let(:llm) { DiscourseAi::Completions::Llm.proxy(llm_model) }+fab!(:bot_user) { Discourse.system_user }def create_tool(diff --git a/plugins/discourse-ai/spec/models/reviewable_ai_post_spec.rb b/plugins/discourse-ai/spec/models/reviewable_ai_post_spec.rbindex fe2559ccc83..c8f31290a0f 100644--- a/plugins/discourse-ai/spec/models/reviewable_ai_post_spec.rb+++ b/plugins/discourse-ai/spec/models/reviewable_ai_post_spec.rb@@ -125,6 +125,7 @@ describe ReviewableAiPost dolet(:reviewable) dodescribed_class.needs_review!(target: target, created_by: Discourse.system_user)end+fab!(:admin)before dodiff --git a/plugins/discourse-ai/spec/requests/admin/ai_features_controller_spec.rb b/plugins/discourse-ai/spec/requests/admin/ai_features_controller_spec.rbindex 53143eeb58a..10f9fbeae95 100644--- a/plugins/discourse-ai/spec/requests/admin/ai_features_controller_spec.rb+++ b/plugins/discourse-ai/spec/requests/admin/ai_features_controller_spec.rb@@ -2,6 +2,7 @@RSpec.describe DiscourseAi::Admin::AiFeaturesController dolet(:controller) { described_class.new }+fab!(:admin)fab!(:group)fab!(:llm_model)diff --git a/plugins/discourse-ai/spec/requests/ai_helper/assistant_controller_spec.rb b/plugins/discourse-ai/spec/requests/ai_helper/assistant_controller_spec.rbindex 21c54f42400..8d6931b3a32 100644--- a/plugins/discourse-ai/spec/requests/ai_helper/assistant_controller_spec.rb+++ b/plugins/discourse-ai/spec/requests/ai_helper/assistant_controller_spec.rb@@ -638,6 +638,7 @@ RSpec.describe DiscourseAi::AiHelper::AssistantController do"I love apples",]end+it "returns title suggestions based on the input text" doDiscourseAi::Completions::Llm.with_prepared_responses([title_suggestions]) dopost "/discourse-ai/ai-helper/suggest_title", params: { text: post_1.raw }diff --git a/plugins/discourse-ai/spec/requests/discover/discoveries_controller_spec.rb b/plugins/discourse-ai/spec/requests/discover/discoveries_controller_spec.rbindex 1530001080c..2aa68e6ed60 100644--- a/plugins/discourse-ai/spec/requests/discover/discoveries_controller_spec.rb+++ b/plugins/discourse-ai/spec/requests/discover/discoveries_controller_spec.rb@@ -148,6 +148,7 @@ describe DiscourseAi::Discover::DiscoveriesController dolet(:query) { "What is Discourse?" }let(:context) { "Discourse is an open-source discussion platform." }let(:request_id) { SecureRandom.uuid }+fab!(:source_post, :post)context "when the user is allowed to discover" dodiff --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 879fbc3b3eb..d03da1fa78d 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@@ -105,6 +105,7 @@ RSpec.describe "AI Composer helper" docontext "when not a member of custom prompt group" dolet(:mode) { DiscourseAi::AiHelper::Assistant::CUSTOM_PROMPT }+before { custom_prompts_agent.update!(allowed_group_ids: [non_member_group.id]) }it "does not show custom prompt option" do@@ -542,6 +543,7 @@ RSpec.describe "AI Composer helper" docontext "when the suggestions feature is disabled" dolet(:mode) { DiscourseAi::AiHelper::Assistant::GENERATE_TITLES }+before { SiteSetting.ai_helper_enabled_features = "context_menu" }it "does not offer title suggestions in the AI helper menu" dodiff --git a/plugins/discourse-ai/spec/system/ai_helper/ai_split_topic_suggestion_spec.rb b/plugins/discourse-ai/spec/system/ai_helper/ai_split_topic_suggestion_spec.rbindex ea9d2ced6c0..d5b44452909 100644--- a/plugins/discourse-ai/spec/system/ai_helper/ai_split_topic_suggestion_spec.rb+++ b/plugins/discourse-ai/spec/system/ai_helper/ai_split_topic_suggestion_spec.rb@@ -30,6 +30,7 @@ RSpec.describe "AI Post helper" doendlet(:topic_page) { PageObjects::Pages::Topic.new }let(:suggestion_menu) { PageObjects::Components::AiSplitTopicSuggester.new }+fab!(:video, :tag)fab!(:music, :tag)fab!(:cloud, :tag)diff --git a/plugins/discourse-ai/spec/system/ai_moderation/ai_spam_spec.rb b/plugins/discourse-ai/spec/system/ai_moderation/ai_spam_spec.rbindex 948eac6247b..ae80851c46d 100644--- a/plugins/discourse-ai/spec/system/ai_moderation/ai_spam_spec.rb+++ b/plugins/discourse-ai/spec/system/ai_moderation/ai_spam_spec.rb@@ -24,6 +24,7 @@ RSpec.describe "AI Spam Configuration" doexpect(toggle.unchecked?).to eq(true)endend+context "when LLMs are configured" dofab!(:llm_model)it "can properly configure spam settings" dodiff --git a/plugins/discourse-ai/spec/system/ai_user_preferences_spec.rb b/plugins/discourse-ai/spec/system/ai_user_preferences_spec.rbindex 4efce9e917f..2ba72706db9 100644--- a/plugins/discourse-ai/spec/system/ai_user_preferences_spec.rb+++ b/plugins/discourse-ai/spec/system/ai_user_preferences_spec.rb@@ -4,6 +4,7 @@ describe "User AI preferences" dofab!(:user) { Fabricate(:admin, refresh_auto_groups: true) }fab!(:llm_model)let(:user_preferences_ai_page) { PageObjects::Pages::UserPreferencesAi.new }+fab!(:discovery_agent) { Fabricate(:ai_agent, allowed_group_ids: [Group::AUTO_GROUPS[:admins]]) }before dodiff --git a/plugins/discourse-ai/spec/system/llms/ai_llm_spec.rb b/plugins/discourse-ai/spec/system/llms/ai_llm_spec.rbindex 322d89e30a1..89287a23070 100644--- a/plugins/discourse-ai/spec/system/llms/ai_llm_spec.rb+++ b/plugins/discourse-ai/spec/system/llms/ai_llm_spec.rb@@ -141,6 +141,7 @@ RSpec.describe "Managing LLM configurations" doreasoning = form.field("provider_params.enable_reasoning")expect(reasoning).to be_checkedend+it "correctly changes the provider params" dovisit "/admin/plugins/discourse-ai/ai-llms"find("[data-llm-id='none'] button").click()diff --git a/plugins/discourse-assign/spec/integration/assign_spec.rb b/plugins/discourse-assign/spec/integration/assign_spec.rbindex 498ea547940..6181166a33d 100644--- a/plugins/discourse-assign/spec/integration/assign_spec.rb+++ b/plugins/discourse-assign/spec/integration/assign_spec.rb@@ -19,6 +19,7 @@ describe "integration tests" dolet(:user) { pm.allowed_users.first }let(:user2) { pm.allowed_users.last }let(:channel) { "/private-messages/assigned" }+fab!(:group) { Fabricate(:group, assignable_level: Group::ALIAS_LEVELS[:everyone]) }include_context "with group that is allowed to assign"@@ -143,6 +144,7 @@ describe "integration tests" dofab!(:post)fab!(:post_2) { Fabricate(:post, topic: post.topic) }let(:topic) { post.topic }+fab!(:user)include_context "with group that is allowed to assign"diff --git a/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/assign_topic/v1_spec.rb b/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/assign_topic/v1_spec.rbindex bbea14cdc76..7e683d71dad 100644--- a/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/assign_topic/v1_spec.rb+++ b/plugins/discourse-assign/spec/lib/discourse_workflows/nodes/assign_topic/v1_spec.rb@@ -8,6 +8,7 @@ RSpec.describe DiscourseWorkflows::Nodes::AssignTopic::V1 dolet(:assign_allowed_group) { Group.find_by(name: "staff") }let(:sandbox) { DiscourseWorkflows::JsSandbox.new({ "$json" => {} }) }+after { sandbox.dispose }before dodiff --git a/plugins/discourse-assign/spec/serializers/user_bookmark_base_serializer_spec.rb b/plugins/discourse-assign/spec/serializers/user_bookmark_base_serializer_spec.rbindex 5636ed51ae9..aade43cf3a0 100644--- a/plugins/discourse-assign/spec/serializers/user_bookmark_base_serializer_spec.rb+++ b/plugins/discourse-assign/spec/serializers/user_bookmark_base_serializer_spec.rb@@ -15,6 +15,7 @@ describe UserBookmarkBaseSerializer docontext "for Topic bookmarkable" dolet!(:bookmark) { Fabricate(:bookmark, user: user, bookmarkable: post.topic) }+it "includes assigned user in serializer" doAssigner.new(topic, user).assign(user)serializer = UserTopicBookmarkSerializer.new(bookmark, scope: guardian)@@ -36,6 +37,7 @@ describe UserBookmarkBaseSerializer docontext "for Post bookmarkable" dolet!(:bookmark) { Fabricate(:bookmark, user: user, bookmarkable: post) }+it "includes assigned user in serializer" doAssigner.new(post, user).assign(user)serializer = UserPostBookmarkSerializer.new(bookmark, scope: guardian)diff --git a/plugins/discourse-assign/spec/system/assign_post_spec.rb b/plugins/discourse-assign/spec/system/assign_post_spec.rbindex 1abdf74249d..42b26435a4a 100644--- a/plugins/discourse-assign/spec/system/assign_post_spec.rb+++ b/plugins/discourse-assign/spec/system/assign_post_spec.rb@@ -3,6 +3,7 @@describe "Assign | Assigning posts" dolet(:topic_page) { PageObjects::Pages::Topic.new }let(:assign_modal) { PageObjects::Modals::Assign.new }+fab!(:staff_user) { Fabricate(:user, groups: [Group[:staff]]) }fab!(:admin)fab!(:topic)diff --git a/plugins/discourse-assign/spec/system/assign_topic_spec.rb b/plugins/discourse-assign/spec/system/assign_topic_spec.rbindex 43682eb9935..c73ee16ac02 100644--- a/plugins/discourse-assign/spec/system/assign_topic_spec.rb+++ b/plugins/discourse-assign/spec/system/assign_topic_spec.rb@@ -3,6 +3,7 @@describe "Assign | Assigning topics" dolet(:topic_page) { PageObjects::Pages::Topic.new }let(:assign_modal) { PageObjects::Modals::Assign.new }+fab!(:admin1, :admin)fab!(:admin2, :admin)fab!(:topic)diff --git a/plugins/discourse-assign/spec/system/bulk_assign_spec.rb b/plugins/discourse-assign/spec/system/bulk_assign_spec.rbindex 46c6fe602af..361693be1d6 100644--- a/plugins/discourse-assign/spec/system/bulk_assign_spec.rb+++ b/plugins/discourse-assign/spec/system/bulk_assign_spec.rb@@ -5,6 +5,7 @@ describe "Assign | Bulk Assign" dolet(:assign_modal) { PageObjects::Modals::Assign.new }let(:topic_list_header) { PageObjects::Components::TopicListHeader.new }let(:topic_list) { PageObjects::Components::TopicList.new }+fab!(:staff_user) { Fabricate(:user, groups: [Group[:staff]]) }fab!(:admin)fab!(:assignable_group) { Fabricate(:group, assignable_level: Group::ALIAS_LEVELS[:everyone]) }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 3a50548e8c1..c08b389e3e9 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@@ -42,6 +42,7 @@ RSpec.describe ProblemCheck::HcaptchaConfiguration doSiteSetting.hcaptcha_secret_key = "just a string"SiteSetting.hcaptcha_site_key = "just a string"end+include_examples "passes_problem_check"endend@@ -70,6 +71,7 @@ RSpec.describe ProblemCheck::HcaptchaConfiguration doSiteSetting.hcaptcha_secret_key = "just a string"SiteSetting.hcaptcha_site_key = "just a string"end+include_examples "passes_problem_check"endenddiff --git a/plugins/discourse-captcha/spec/services/problem_check/recaptcha_configuration_spec.rb b/plugins/discourse-captcha/spec/services/problem_check/recaptcha_configuration_spec.rbindex 2f89a5df8c9..eea3c8df3f5 100644--- a/plugins/discourse-captcha/spec/services/problem_check/recaptcha_configuration_spec.rb+++ b/plugins/discourse-captcha/spec/services/problem_check/recaptcha_configuration_spec.rb@@ -42,6 +42,7 @@ RSpec.describe ProblemCheck::RecaptchaConfiguration doSiteSetting.recaptcha_secret_key = "just a string"SiteSetting.recaptcha_site_key = "just a string"end+include_examples "passes_problem_check"endend@@ -70,6 +71,7 @@ RSpec.describe ProblemCheck::RecaptchaConfiguration doSiteSetting.recaptcha_secret_key = "just a string"SiteSetting.recaptcha_site_key = "just a string"end+include_examples "passes_problem_check"endenddiff --git a/plugins/discourse-chat-integration/spec/helpers/helper_spec.rb b/plugins/discourse-chat-integration/spec/helpers/helper_spec.rbindex 22f5adc7dbc..16f76a836eb 100644--- a/plugins/discourse-chat-integration/spec/helpers/helper_spec.rb+++ b/plugins/discourse-chat-integration/spec/helpers/helper_spec.rb@@ -180,6 +180,7 @@ RSpec.describe DiscourseChatIntegration::Manager docontext "with some rules" dolet(:group) { Fabricate(:group) }+before doDiscourseChatIntegration::Rule.create!(channel: chan1,diff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_transcript_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_transcript_spec.rbindex 5d36e5fd45f..d985adc0f5c 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_transcript_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_transcript_spec.rb@@ -103,6 +103,7 @@ RSpec.describe DiscourseChatIntegration::Provider::SlackProvider::SlackTranscripendlet(:transcript) { described_class.new(channel_name: "#general", channel_id: "G1234") }+before { SiteSetting.chat_integration_slack_access_token = "abcde" }it "doesn't raise an error when there are no messages to guess" dodiff --git a/plugins/discourse-chat-integration/spec/system/setup_provider_spec.rb b/plugins/discourse-chat-integration/spec/system/setup_provider_spec.rbindex ab7e895c91a..54d90538d93 100644--- a/plugins/discourse-chat-integration/spec/system/setup_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/system/setup_provider_spec.rb@@ -46,6 +46,7 @@ RSpec.describe "Chat integration setup provider" dodescribe "adding more providers when at least one provider is enabled" dobefore { SiteSetting.chat_integration_teams_enabled = true }+it "sets up Discord" dosetup_provider_from_menu("discord")diff --git a/plugins/discourse-data-explorer/spec/lib/discourse_data_explorer/admin_dashboard_report_provider_spec.rb b/plugins/discourse-data-explorer/spec/lib/discourse_data_explorer/admin_dashboard_report_provider_spec.rbindex 3e1aaa39e0d..d33cd4889b5 100644--- a/plugins/discourse-data-explorer/spec/lib/discourse_data_explorer/admin_dashboard_report_provider_spec.rb+++ b/plugins/discourse-data-explorer/spec/lib/discourse_data_explorer/admin_dashboard_report_provider_spec.rb@@ -31,6 +31,7 @@ RSpec.describe DiscourseDataExplorer::AdminDashboardReportProvider dolet(:user_guardian) { user.guardian }before { SiteSetting.data_explorer_enabled = true }+let(:query_ids_to_invalidate) { [visible_query.id] }after dodiff --git a/plugins/discourse-data-explorer/spec/requests/api/queries_spec.rb b/plugins/discourse-data-explorer/spec/requests/api/queries_spec.rbindex d0fc0471264..484980bc4a4 100644--- a/plugins/discourse-data-explorer/spec/requests/api/queries_spec.rb+++ b/plugins/discourse-data-explorer/spec/requests/api/queries_spec.rb@@ -135,6 +135,7 @@ RSpec.describe "JSON:API queries", type: :request docontext "when the request includes the author and the groups" dolet(:query_parameters) { { include: "user,groups" } }+it "sends every related record under its own namespace" doexpect(parsed_body["included"]).to contain_exactly({diff --git a/plugins/discourse-events/spec/integration/outgoing_web_hooks_spec.rb b/plugins/discourse-events/spec/integration/outgoing_web_hooks_spec.rbindex 36020d31889..97e59c4fe69 100644--- a/plugins/discourse-events/spec/integration/outgoing_web_hooks_spec.rb+++ b/plugins/discourse-events/spec/integration/outgoing_web_hooks_spec.rb@@ -64,6 +64,7 @@ RSpec.describe "Outgoing calendar event webhooks" dodescribe "calendar_event_destroyed" dolet(:event_post) { create_post_with_event(user) }+it "fires when event markup is removed from a post" doevent_postdiff --git a/plugins/discourse-events/spec/jobs/regular/discourse_post_event/bump_topic_spec.rb b/plugins/discourse-events/spec/jobs/regular/discourse_post_event/bump_topic_spec.rbindex 4e79549446d..a649cdc2f8a 100644--- a/plugins/discourse-events/spec/jobs/regular/discourse_post_event/bump_topic_spec.rb+++ b/plugins/discourse-events/spec/jobs/regular/discourse_post_event/bump_topic_spec.rb@@ -38,6 +38,7 @@ describe Jobs::DiscoursePostEventBumpTopic doJobs::DiscoursePostEventBumpTopic.new.execute(date: "2019-12-10 5:00")}.not_to raise_errorend+it "does not throw an error if the date param is missing" doexpect { Jobs::DiscoursePostEventBumpTopic.new.execute({}) }.not_to raise_errorenddiff --git a/plugins/discourse-events/spec/models/discourse_events/events/event_spec.rb b/plugins/discourse-events/spec/models/discourse_events/events/event_spec.rbindex 0cfcecc8b92..b158fb8952f 100644--- a/plugins/discourse-events/spec/models/discourse_events/events/event_spec.rb+++ b/plugins/discourse-events/spec/models/discourse_events/events/event_spec.rb@@ -440,6 +440,7 @@ describe DiscourseEvents::Events::Event doexpect(second_post.topic.custom_fields).to be_blankendend+describe "notify an user" dodescribe "before the event starts" doit "does notify the user" do@@ -448,6 +449,7 @@ describe DiscourseEvents::Events::Event do}.by(1)endend+describe "after the event starts" doit "doesn't notify the user" doexpect { late_event.create_notification!(notified_user, first_post) }.not_to change {diff --git a/plugins/discourse-events/spec/services/discourse_events/events/create_invitee_spec.rb b/plugins/discourse-events/spec/services/discourse_events/events/create_invitee_spec.rbindex 6c03a222841..cc66396e283 100644--- a/plugins/discourse-events/spec/services/discourse_events/events/create_invitee_spec.rb+++ b/plugins/discourse-events/spec/services/discourse_events/events/create_invitee_spec.rb@@ -3,6 +3,7 @@RSpec.describe(DiscourseEvents::Events::CreateInvitee) dodescribe described_class::Contract, type: :model doit { is_expected.to validate_presence_of(:event_id) }+it dois_expected.to validate_inclusion_of(:status).in_array(DiscourseEvents::Events::Invitee.statuses.keys.map(&:to_s),diff --git a/plugins/discourse-events/spec/services/discourse_events/events/update_invitee_spec.rb b/plugins/discourse-events/spec/services/discourse_events/events/update_invitee_spec.rbindex f96adc8b1ec..b4b591fe139 100644--- a/plugins/discourse-events/spec/services/discourse_events/events/update_invitee_spec.rb+++ b/plugins/discourse-events/spec/services/discourse_events/events/update_invitee_spec.rb@@ -4,6 +4,7 @@ RSpec.describe(DiscourseEvents::Events::UpdateInvitee) dodescribe described_class::Contract, type: :model doit { is_expected.to validate_presence_of(:event_id) }it { is_expected.to validate_presence_of(:invitee_id) }+it dois_expected.to validate_inclusion_of(:status).in_array(DiscourseEvents::Events::Invitee.statuses.keys.map(&:to_s),diff --git a/plugins/discourse-events/spec/system/livestream_zoom_webinar_spec.rb b/plugins/discourse-events/spec/system/livestream_zoom_webinar_spec.rbindex f508b17e2b3..94955c2bd2e 100644--- a/plugins/discourse-events/spec/system/livestream_zoom_webinar_spec.rb+++ b/plugins/discourse-events/spec/system/livestream_zoom_webinar_spec.rb@@ -20,6 +20,7 @@ describe "Discourse Livestream - Livestream with Zoom webinar" docontext "when user is signed in" dobefore { sign_in(current_user) }+it "shows a Join Zoom button for livestream events which have a Zoom location" dotopic_livestream.create_livestream_event_topic(composer,diff --git a/plugins/discourse-gamification/spec/lib/discourse_workflows/nodes/gamification_score/v1_spec.rb b/plugins/discourse-gamification/spec/lib/discourse_workflows/nodes/gamification_score/v1_spec.rbindex 592883249a4..ce5bf8f20da 100644--- a/plugins/discourse-gamification/spec/lib/discourse_workflows/nodes/gamification_score/v1_spec.rb+++ b/plugins/discourse-gamification/spec/lib/discourse_workflows/nodes/gamification_score/v1_spec.rb@@ -4,6 +4,7 @@ RSpec.describe DiscourseWorkflows::Nodes::GamificationScore::V1 dofab!(:user)let(:sandbox) { DiscourseWorkflows::JsSandbox.new({ "$json" => {} }) }+after { sandbox.dispose }before dodiff --git a/plugins/discourse-gamification/spec/lib/scorables/shared_scorables_spec.rb b/plugins/discourse-gamification/spec/lib/scorables/shared_scorables_spec.rbindex c4b15b0acc8..14ba4d73fec 100755--- a/plugins/discourse-gamification/spec/lib/scorables/shared_scorables_spec.rb+++ b/plugins/discourse-gamification/spec/lib/scorables/shared_scorables_spec.rb@@ -33,6 +33,7 @@ RSpec.shared_examples "Category Scoped Scorable Type" dodescribe "updates gamification score" dolet!(:create_score) { class_action_fabricator }let!(:trigger_after_create_hook) { after_create_hook }+before { DiscourseGamification::LeaderboardCachedView.create_all }it "#{described_class} updates scores for action in the category configured" dodiff --git a/plugins/discourse-gamification/spec/requests/gamification_leaderboard_controller_spec.rb b/plugins/discourse-gamification/spec/requests/gamification_leaderboard_controller_spec.rbindex 1935f0f1629..6387f9df801 100644--- a/plugins/discourse-gamification/spec/requests/gamification_leaderboard_controller_spec.rb+++ b/plugins/discourse-gamification/spec/requests/gamification_leaderboard_controller_spec.rb@@ -31,6 +31,7 @@ RSpec.describe DiscourseGamification::GamificationLeaderboardController doendlet!(:create_score_for_user_3) { UserVisit.create(user_id: user_3.id, visited_at: 2.days.ago) }let!(:create_topic) { Fabricate(:topic, user: current_user) }+fab!(:leaderboard) doFabricate(:gamification_leaderboard, name: "test", created_by_id: current_user.id)enddiff --git a/plugins/discourse-login-with-amazon/spec/system/associated_account_prefs_spec.rb b/plugins/discourse-login-with-amazon/spec/system/associated_account_prefs_spec.rbindex a3251db8dd4..aca8c9a69b3 100644--- a/plugins/discourse-login-with-amazon/spec/system/associated_account_prefs_spec.rb+++ b/plugins/discourse-login-with-amazon/spec/system/associated_account_prefs_spec.rb@@ -42,6 +42,7 @@ RSpec.describe "Amazon Associated Account Preferences" dodescribe "with user revoke enabled" dobefore { SiteSetting.login_with_amazon_user_can_revoke = true }+it "shows the revoke button" dosign_in(user)user_account_preferences_page.visit(user)@@ -55,6 +56,7 @@ RSpec.describe "Amazon Associated Account Preferences" dodescribe "with user revoke disabled" dobefore { SiteSetting.login_with_amazon_user_can_revoke = false }+it "shows the revoke button" dosign_in(user)user_account_preferences_page.visit(user)diff --git a/plugins/discourse-openid-connect/spec/lib/openid_connect_authenticator_spec.rb b/plugins/discourse-openid-connect/spec/lib/openid_connect_authenticator_spec.rbindex 2bb74f95d1d..37bad64aa86 100644--- a/plugins/discourse-openid-connect/spec/lib/openid_connect_authenticator_spec.rb+++ b/plugins/discourse-openid-connect/spec/lib/openid_connect_authenticator_spec.rb@@ -280,6 +280,7 @@ describe OpenIDConnectAuthenticator douserinfo_endpoint: "https://id.example.com/userinfo",}.to_jsonend+after { Discourse.cache.delete("openid-connect-discovery-#{document_url}") }it "loads the document correctly" dodiff --git a/plugins/discourse-openid-connect/spec/requests/rp_initiated_logout_spec.rb b/plugins/discourse-openid-connect/spec/requests/rp_initiated_logout_spec.rbindex 5696c0c76ac..b5a2f062c01 100644--- a/plugins/discourse-openid-connect/spec/requests/rp_initiated_logout_spec.rb+++ b/plugins/discourse-openid-connect/spec/requests/rp_initiated_logout_spec.rb@@ -14,6 +14,7 @@ describe "OIDC RP-Initiated Logout" doend_session_endpoint: "https://id.example.com/endsession",}end+fab!(:user)before dodiff --git a/plugins/discourse-post-voting/spec/lib/topic_view_spec.rb b/plugins/discourse-post-voting/spec/lib/topic_view_spec.rbindex 8aa0a84ad5c..c753e5ba7e4 100644--- a/plugins/discourse-post-voting/spec/lib/topic_view_spec.rb+++ b/plugins/discourse-post-voting/spec/lib/topic_view_spec.rb@@ -207,6 +207,7 @@ describe TopicView do[answer_minus_2_votes.id, answer_minus_1_vote.id, answer_0_votes.id],)end+describe "#next_page" doit "returns the next page properly when the highest id post is not the last" doexpect(TopicView.new(topic.id, user, { post_number: post.post_number }).next_page).to eql(2)diff --git a/plugins/discourse-reactions/spec/serializers/post_serializer_spec.rb b/plugins/discourse-reactions/spec/serializers/post_serializer_spec.rbindex ca22575e9e7..1bbc2c44ccd 100644--- a/plugins/discourse-reactions/spec/serializers/post_serializer_spec.rb+++ b/plugins/discourse-reactions/spec/serializers/post_serializer_spec.rb@@ -26,6 +26,7 @@ describe PostSerializer docreated_at: 20.minutes.ago,)end+fab!(:like) doFabricate(:post_action,diff --git a/plugins/discourse-rss-polling/spec/jobs/poll_feed_spec.rb b/plugins/discourse-rss-polling/spec/jobs/poll_feed_spec.rbindex 14b4da5d5d6..69a76aa3874 100644--- a/plugins/discourse-rss-polling/spec/jobs/poll_feed_spec.rb+++ b/plugins/discourse-rss-polling/spec/jobs/poll_feed_spec.rb@@ -122,6 +122,7 @@ RSpec.describe Jobs::DiscourseRssPolling::PollFeed docontext "with rss polling set to true" dobefore { SiteSetting.rss_polling_update_tags = true }+it "updates tags by default" dotopic = author.topics.lastjob.execute(diff --git a/plugins/discourse-rss-polling/spec/models/feed_item_spec.rb b/plugins/discourse-rss-polling/spec/models/feed_item_spec.rbindex 4f03f23f3ec..698c8bcb137 100644--- a/plugins/discourse-rss-polling/spec/models/feed_item_spec.rb+++ b/plugins/discourse-rss-polling/spec/models/feed_item_spec.rb@@ -9,6 +9,7 @@ RSpec.describe DiscourseRssPolling::FeedItem doit { expect(feed_item.content).to eq(expected[:content]) }it { expect(feed_item.url).to eq(expected[:url]) }it { expect(feed_item.title).to eq(expected[:title]) }+if expected.key?(:cook_method)it { expect(feed_item.cook_method).to eq(expected[:cook_method]) }end@@ -17,6 +18,7 @@ RSpec.describe DiscourseRssPolling::FeedItem docontext "with empty item" dolet(:raw_feed_item) { {} }+include_examples("correctly parses the feed", content: nil, url: nil, title: nil)enddiff --git a/plugins/discourse-solved/spec/components/post_revisor_spec.rb b/plugins/discourse-solved/spec/components/post_revisor_spec.rbindex 386f16d62d3..ba09718a076 100644--- a/plugins/discourse-solved/spec/components/post_revisor_spec.rb+++ b/plugins/discourse-solved/spec/components/post_revisor_spec.rb@@ -140,6 +140,7 @@ describe PostRevisor dodescribe "with multiple solutions enabled" dobefore { SiteSetting.solved_allow_multiple_solutions = true }+it "unaccepts all answers when both category changes to unsolved and solved tag is removed" dotopic = Fabricate(:topic, category: category_solved, tags: [solved_tag])post = Fabricate(:post, topic: topic)diff --git a/plugins/discourse-solved/spec/integration/solved_spec.rb b/plugins/discourse-solved/spec/integration/solved_spec.rbindex 6b8c7905ba4..a6279479baf 100644--- a/plugins/discourse-solved/spec/integration/solved_spec.rb+++ b/plugins/discourse-solved/spec/integration/solved_spec.rb@@ -212,6 +212,7 @@ RSpec.describe "Managing Posts solved status" dodescribe "when allow solved on all topics is enabled" dobefore { SiteSetting.allow_solved_on_all_topics = true }+it "only returns posts where the post is not solved" doresult = Search.execute("status:unsolved")expect(result.posts.pluck(:id)).to match_array(@@ -478,6 +479,7 @@ RSpec.describe "Managing Posts solved status" dodescribe "with multiple solutions enabled" dolet(:p2) { Fabricate(:post, topic: topic) }+before { SiteSetting.solved_allow_multiple_solutions = true }it "can mark multiple posts as accepted, only creating one timer" do@@ -644,6 +646,7 @@ RSpec.describe "Managing Posts solved status" dodescribe "with multiple solutions enabled" dolet(:p2) { Fabricate(:post, topic: topic) }+before { SiteSetting.solved_allow_multiple_solutions = true }describe "when solved_topics_auto_close_hours is enabled" do@@ -713,6 +716,7 @@ RSpec.describe "Managing Posts solved status" docontext "with discourse-assign installed", if: defined?(DiscourseAssign) dolet(:admin) { Fabricate(:admin) }+fab!(:group)before doSiteSetting.solved_enabled = true@@ -977,6 +981,7 @@ RSpec.describe "Managing Posts solved status" dodescribe "with multiple solutions enabled" dobefore { SiteSetting.solved_allow_multiple_solutions = true }+it "lists all solutions in topic" dot1 = Fabricate(:topic_with_op)diff --git a/plugins/discourse-solved/spec/lib/post_mover_extension_spec.rb b/plugins/discourse-solved/spec/lib/post_mover_extension_spec.rbindex b3180c47eee..f107e8233b3 100644--- a/plugins/discourse-solved/spec/lib/post_mover_extension_spec.rb+++ b/plugins/discourse-solved/spec/lib/post_mover_extension_spec.rb@@ -9,6 +9,7 @@ RSpec.describe DiscourseSolved::PostMoverExtension dofab!(:destination_topic) { Fabricate(:topic_with_op, category: category) }let!(:post_ids) { topic.posts.order(:post_number).pluck(:id) }+fab!(:solved) { Fabricate(:solved_topic, topic: topic, answer_post: reply) }before { SiteSetting.allow_solved_on_all_topics = true }diff --git a/plugins/discourse-solved/spec/requests/list_controller_spec.rb b/plugins/discourse-solved/spec/requests/list_controller_spec.rbindex 00df73ac649..e72ea4d6d14 100644--- a/plugins/discourse-solved/spec/requests/list_controller_spec.rb+++ b/plugins/discourse-solved/spec/requests/list_controller_spec.rb@@ -22,6 +22,7 @@ RSpec.describe ListController dodescribe "with multiple solutions enabled" dofab!(:p4) { Fabricate(:post, topic: p1.topic) }before { SiteSetting.solved_allow_multiple_solutions = true }+it "shows the user who posted the accepted answers second" doTopicFeaturedUsers.ensure_consistency!DiscourseSolved::AcceptAnswer.call!(params: { post_id: p3.id }, guardian: p1.user.guardian)diff --git a/plugins/discourse-solved/spec/serializers/discourse_solved/accepted_answer_serializer_spec.rb b/plugins/discourse-solved/spec/serializers/discourse_solved/accepted_answer_serializer_spec.rbindex 73d5fd41834..56238baf0e7 100644--- a/plugins/discourse-solved/spec/serializers/discourse_solved/accepted_answer_serializer_spec.rb+++ b/plugins/discourse-solved/spec/serializers/discourse_solved/accepted_answer_serializer_spec.rb@@ -44,6 +44,7 @@ RSpec.describe DiscourseSolved::AcceptedAnswerSerializer docontext "when display_name_on_posts is set" dobefore { SiteSetting.display_name_on_posts = true }+it "also includes the poster's name" doexpect(json["name"]).to eq(user.name)end@@ -58,6 +59,7 @@ RSpec.describe DiscourseSolved::AcceptedAnswerSerializer docontext "when display_name_on_posts is set" dobefore { SiteSetting.display_name_on_posts = true }+it "also includes the accepter name" doexpect(json["accepter_username"]).to eq(accepter.username)expect(json["accepter_name"]).to eq(accepter.name)diff --git a/plugins/discourse-solved/spec/services/discourse_solved/accept_answer_spec.rb b/plugins/discourse-solved/spec/services/discourse_solved/accept_answer_spec.rbindex 6ff3e8fc243..c4356ce0fb6 100644--- a/plugins/discourse-solved/spec/services/discourse_solved/accept_answer_spec.rb+++ b/plugins/discourse-solved/spec/services/discourse_solved/accept_answer_spec.rb@@ -103,6 +103,7 @@ RSpec.describe DiscourseSolved::AcceptAnswer dodescribe "with multiple solutions enabled" dobefore { SiteSetting.solved_allow_multiple_solutions = true }+it "keeps both solutions" doexpect { result }.to change { DiscourseSolved::TopicAnswer.count }.by(1)enddiff --git a/plugins/discourse-subscriptions/spec/requests/subscribe_controller_spec.rb b/plugins/discourse-subscriptions/spec/requests/subscribe_controller_spec.rbindex d00e4b6acd3..bc404f203b5 100644--- a/plugins/discourse-subscriptions/spec/requests/subscribe_controller_spec.rb+++ b/plugins/discourse-subscriptions/spec/requests/subscribe_controller_spec.rb@@ -145,6 +145,7 @@ RSpec.describe DiscourseSubscriptions::SubscribeController docustomer_id: "y",)end+context "when not showing contributors" doit "returns nothing if not set to show contributors" doSiteSetting.discourse_subscriptions_campaign_show_contributors = falsediff --git a/plugins/discourse-workflows/spec/lib/discourse_workflows/executor/execution_store_spec.rb b/plugins/discourse-workflows/spec/lib/discourse_workflows/executor/execution_store_spec.rbindex e785bce3e42..45d5f607e27 100644--- a/plugins/discourse-workflows/spec/lib/discourse_workflows/executor/execution_store_spec.rb+++ b/plugins/discourse-workflows/spec/lib/discourse_workflows/executor/execution_store_spec.rb@@ -59,6 +59,7 @@ RSpec.describe DiscourseWorkflows::Executor::ExecutionStore do)expect(messages.first.data.to_json).not_to include("not published")end+it "publishes terminal state after persistence" doexecution = store.start!diff --git a/plugins/discourse-workflows/spec/lib/discourse_workflows/nodes/code/js_task_runner_sandbox_spec.rb b/plugins/discourse-workflows/spec/lib/discourse_workflows/nodes/code/js_task_runner_sandbox_spec.rbindex 8e0a0b9bd61..5fb9c06be7a 100644--- a/plugins/discourse-workflows/spec/lib/discourse_workflows/nodes/code/js_task_runner_sandbox_spec.rb+++ b/plugins/discourse-workflows/spec/lib/discourse_workflows/nodes/code/js_task_runner_sandbox_spec.rb@@ -20,6 +20,7 @@ RSpec.describe DiscourseWorkflows::Nodes::Code::JsTaskRunnerSandbox doendbefore { @exec_ctx, @resolver, @sandbox = build_exec_ctx }+after do@resolver&.dispose@sandbox&.disposediff --git a/plugins/discourse-workflows/spec/lib/discourse_workflows/nodes/code_spec.rb b/plugins/discourse-workflows/spec/lib/discourse_workflows/nodes/code_spec.rbindex b3d13617b78..0cc1b0e0107 100644--- a/plugins/discourse-workflows/spec/lib/discourse_workflows/nodes/code_spec.rb+++ b/plugins/discourse-workflows/spec/lib/discourse_workflows/nodes/code_spec.rb@@ -2,6 +2,7 @@RSpec.describe DiscourseWorkflows::Nodes::Code::V1 dolet(:sandbox) { DiscourseWorkflows::JsSandbox.new({}) }+after { sandbox.dispose }def build_exec_ctx(items, resolver_context: nil, parameters: {}, **kwargs)diff --git a/plugins/discourse-workflows/spec/requests/discourse_workflows/templates_controller_spec.rb b/plugins/discourse-workflows/spec/requests/discourse_workflows/templates_controller_spec.rbindex f0514834d03..bcbaad487d4 100644--- a/plugins/discourse-workflows/spec/requests/discourse_workflows/templates_controller_spec.rb+++ b/plugins/discourse-workflows/spec/requests/discourse_workflows/templates_controller_spec.rb@@ -7,6 +7,7 @@ RSpec.describe DiscourseWorkflows::TemplatesController doDiscourseWorkflows::TemplateStore.reset_cache!sign_in(admin)end+after { DiscourseWorkflows::TemplateStore.reset_cache! }context "when not logged in as admin" dodiff --git a/plugins/discourse-workflows/spec/services/discourse_workflows/data_table/create_spec.rb b/plugins/discourse-workflows/spec/services/discourse_workflows/data_table/create_spec.rbindex 3021bc7cef7..9cade6f2ba6 100644--- a/plugins/discourse-workflows/spec/services/discourse_workflows/data_table/create_spec.rb+++ b/plugins/discourse-workflows/spec/services/discourse_workflows/data_table/create_spec.rb@@ -4,9 +4,11 @@ RSpec.describe DiscourseWorkflows::DataTable::Create dodescribe described_class::Contract, type: :model doit { is_expected.to validate_presence_of(:name) }it { is_expected.to validate_length_of(:name).is_at_most(100) }+it dois_expected.to allow_values("valid_name", "Name 123", "_underscore", "Table A").for(:name)end+it { is_expected.not_to allow_values("123start", "name!@#").for(:name) }enddiff --git a/plugins/discourse-workflows/spec/services/discourse_workflows/data_table/update_spec.rb b/plugins/discourse-workflows/spec/services/discourse_workflows/data_table/update_spec.rbindex dac5b1436ba..8ac4a132778 100644--- a/plugins/discourse-workflows/spec/services/discourse_workflows/data_table/update_spec.rb+++ b/plugins/discourse-workflows/spec/services/discourse_workflows/data_table/update_spec.rb@@ -5,9 +5,11 @@ RSpec.describe DiscourseWorkflows::DataTable::Update doit { is_expected.to validate_presence_of(:data_table_id) }it { is_expected.to validate_presence_of(:name) }it { is_expected.to validate_length_of(:name).is_at_most(100) }+it dois_expected.to allow_values("valid_name", "Name 123", "_underscore", "Table A").for(:name)end+it { is_expected.not_to allow_values("123start", "name!@#").for(:name) }enddiff --git a/plugins/discourse-workflows/spec/services/discourse_workflows/data_table_column/create_spec.rb b/plugins/discourse-workflows/spec/services/discourse_workflows/data_table_column/create_spec.rbindex ad1dbe63cb4..b9f84c5bca2 100644--- a/plugins/discourse-workflows/spec/services/discourse_workflows/data_table_column/create_spec.rb+++ b/plugins/discourse-workflows/spec/services/discourse_workflows/data_table_column/create_spec.rb@@ -4,23 +4,29 @@ RSpec.describe DiscourseWorkflows::DataTableColumn::Create dodescribe described_class::Contract, type: :model doit { is_expected.to validate_presence_of(:data_table_id) }it { is_expected.to validate_presence_of(:name) }+it dois_expected.to validate_length_of(:name).is_at_most(DiscourseWorkflows::DataTable::MAX_COLUMN_NAME_LENGTH,)end+it { is_expected.to allow_values("valid_col", "column_1", "_col").for(:name) }+it dois_expected.not_to allow_values("123col", "col space", "col!@#", "id", "created_at").for(:name,)end+it { is_expected.to validate_presence_of(:column_type) }+it dois_expected.to allow_values(*DiscourseWorkflows::DataTable::VALID_COLUMN_TYPES).for(:column_type,)end+it { is_expected.not_to allow_values("text", "unknown_type").for(:column_type) }enddiff --git a/plugins/discourse-workflows/spec/services/discourse_workflows/data_table_column/rename_spec.rb b/plugins/discourse-workflows/spec/services/discourse_workflows/data_table_column/rename_spec.rbindex aa324ee4b22..03e11b93cb2 100644--- a/plugins/discourse-workflows/spec/services/discourse_workflows/data_table_column/rename_spec.rb+++ b/plugins/discourse-workflows/spec/services/discourse_workflows/data_table_column/rename_spec.rb@@ -5,12 +5,15 @@ RSpec.describe DiscourseWorkflows::DataTableColumn::Rename doit { is_expected.to validate_presence_of(:data_table_id) }it { is_expected.to validate_presence_of(:column_name) }it { is_expected.to validate_presence_of(:name) }+it dois_expected.to validate_length_of(:name).is_at_most(DiscourseWorkflows::DataTable::MAX_COLUMN_NAME_LENGTH,)end+it { is_expected.to allow_values("valid_col", "column_1", "_col").for(:name) }+it dois_expected.not_to allow_values("123col", "col space", "col!@#", "id", "created_at").for(:name,diff --git a/plugins/discourse-workflows/spec/services/discourse_workflows/template/show_spec.rb b/plugins/discourse-workflows/spec/services/discourse_workflows/template/show_spec.rbindex 282601ad055..3d29bea5a74 100644--- a/plugins/discourse-workflows/spec/services/discourse_workflows/template/show_spec.rb+++ b/plugins/discourse-workflows/spec/services/discourse_workflows/template/show_spec.rb@@ -3,9 +3,11 @@RSpec.describe DiscourseWorkflows::Template::Show dodescribe described_class::Contract, type: :model doit { is_expected.to validate_presence_of(:template_id) }+it dois_expected.to allow_values("auto-tag-topics", "my_template", "test123").for(:template_id)end+it dois_expected.not_to allow_values("../etc/passwd", "UPPER", "with spaces", "with/slash").for(:template_id,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 a2b716b5acc..5686f29af90 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@@ -161,6 +161,7 @@ RSpec.describe DiscourseZendeskPlugin::Helper docontext "with different author" dolet(:post_user) { other_user }+it "should be true" doexpect(eligible).to be_truthyend@@ -178,6 +179,7 @@ RSpec.describe DiscourseZendeskPlugin::Helper docontext "with different author" dolet(:post_user) { other_user }+it "should be false" doexpect(eligible).to be_falseyenddiff --git a/plugins/discourse-zendesk-plugin/spec/requests/issues_controller_spec.rb b/plugins/discourse-zendesk-plugin/spec/requests/issues_controller_spec.rbindex bba2296f977..4499f5b5266 100644--- a/plugins/discourse-zendesk-plugin/spec/requests/issues_controller_spec.rb+++ b/plugins/discourse-zendesk-plugin/spec/requests/issues_controller_spec.rb@@ -64,6 +64,7 @@ RSpec.describe DiscourseZendeskPlugin::IssuesController do},)end+it "does not create a zendesk ticket for a topic the moderator cannot see" doadmin = Fabricate(:admin)moderator = Fabricate(:moderator)diff --git a/plugins/poll/spec/lib/polls_updater_spec.rb b/plugins/poll/spec/lib/polls_updater_spec.rbindex 933840e6de3..9faac10c54f 100644--- a/plugins/poll/spec/lib/polls_updater_spec.rb+++ b/plugins/poll/spec/lib/polls_updater_spec.rb@@ -141,6 +141,7 @@ RSpec.describe DiscoursePoll::PollsUpdater doexpect(digests.size).to eq(2)expect(poll_record.poll_votes.count).to eq(1)end+describe "when there are no votes" doit "at any time" dopost # create the postdiff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rbindex 5117c63f5cc..58562b61320 100644--- a/spec/helpers/application_helper_spec.rb+++ b/spec/helpers/application_helper_spec.rb@@ -253,6 +253,7 @@ RSpec.describe ApplicationHelper doit "encodes tags" doexpect(helper.escape_unicode("<tag>")).to eq("\u003ctag>")end+it "survives junk text" doexpect(helper.escape_unicode("hello \xc3\x28 world")).to match(/hello.*world/)end@@ -287,6 +288,7 @@ RSpec.describe ApplicationHelper doexpect(helper.render_sitelinks_search_tag).to be_nilendend+context "when not on homepage" doit "will not return sitelinks search tag" dohelper.stubs(:current_page?).returns(true)@@ -296,6 +298,7 @@ RSpec.describe ApplicationHelper doendendend+context "for subfolder install" docontext "when on homepage" doit "will return sitelinks search tag" do@@ -306,6 +309,7 @@ RSpec.describe ApplicationHelper doexpect(helper.render_sitelinks_search_tag).to include("subfolder-base-path")endend+context "when not on homepage" doit "will not return sitelinks search tag" doDiscourse.stubs(:base_path).returns("/subfolder-base-path/")diff --git a/spec/integration/json_api_kit/cursors_spec.rb b/spec/integration/json_api_kit/cursors_spec.rbindex 945df1a7dfd..7ae480687b8 100644--- a/spec/integration/json_api_kit/cursors_spec.rb+++ b/spec/integration/json_api_kit/cursors_spec.rb@@ -18,6 +18,7 @@ RSpec.describe "a listing read from a cursor" doexpect(sorted_listing[:data].map { it[:meta][:page][:cursor] }).to all(be_present)endend+let(:pages) dosorted_listing[:data].map dolisting_of({ sort:, page: { after: cursor_of(it) }, fields: { topics: [:title] } })diff --git a/spec/jobs/clean_up_tags_spec.rb b/spec/jobs/clean_up_tags_spec.rbindex bf71594f880..f4806d7e534 100644--- a/spec/jobs/clean_up_tags_spec.rb+++ b/spec/jobs/clean_up_tags_spec.rb@@ -31,6 +31,7 @@ describe Jobs::CleanUpTags do),]end+fab!(:unused_tag) doFabricate(:tag,diff --git a/spec/jobs/clean_up_unused_staged_users_spec.rb b/spec/jobs/clean_up_unused_staged_users_spec.rbindex f66bc604603..a90900cb619 100644--- a/spec/jobs/clean_up_unused_staged_users_spec.rb+++ b/spec/jobs/clean_up_unused_staged_users_spec.rb@@ -23,28 +23,33 @@ RSpec.describe Jobs::CleanUpUnusedStagedUsers docontext "with staged admin" dobefore { staged_user.update!(admin: true) }+include_examples "does not delete"endcontext "with staged moderator" dobefore { staged_user.update!(moderator: true) }+include_examples "does not delete"endcontext "when job is disabled" dobefore { SiteSetting.clean_up_unused_staged_users_after_days = 0 }+include_examples "does not delete"endendcontext "when staged user is not old enough" dobefore { staged_user.update!(created_at: 5.months.ago) }+include_examples "does not delete"endendcontext "when staged user has posts" dobefore { Fabricate(:post, user: staged_user) }+include_examples "does not delete"enddiff --git a/spec/jobs/emit_web_hook_event_spec.rb b/spec/jobs/emit_web_hook_event_spec.rbindex 736cae90b16..24b08590209 100644--- a/spec/jobs/emit_web_hook_event_spec.rb+++ b/spec/jobs/emit_web_hook_event_spec.rb@@ -351,6 +351,7 @@ RSpec.describe Jobs::EmitWebHookEvent doheadersendend+it "Allows for header modifications" doplugin_instance = Plugin::Instance.newplugin_instance.register_modifier(:web_hook_event_headers, &modifier_block)diff --git a/spec/jobs/export_user_archive_spec.rb b/spec/jobs/export_user_archive_spec.rbindex 9ef3c0300eb..71cf71a4c7d 100644--- a/spec/jobs/export_user_archive_spec.rb+++ b/spec/jobs/export_user_archive_spec.rb@@ -285,6 +285,7 @@ RSpec.describe Jobs::ExportUserArchive docontext "with auth token logs" dolet(:component) { "auth_token_logs" }+it "includes details such as the path" dodata, _csv_out = make_component_csvexpect(data.length).to eq(1)diff --git a/spec/jobs/invite_email_spec.rb b/spec/jobs/invite_email_spec.rbindex 628cb504caf..baf0ed3b55f 100644--- a/spec/jobs/invite_email_spec.rb+++ b/spec/jobs/invite_email_spec.rb@@ -8,6 +8,7 @@ RSpec.describe Jobs::InviteEmail docontext "with an invite id" dolet(:mailer) { Mail::Message.new(to: "[email protected]") }+fab!(:invite)it "delegates to the test mailer" dodiff --git a/spec/jobs/notify_category_change_spec.rb b/spec/jobs/notify_category_change_spec.rbindex b2f124c0669..77803570711 100644--- a/spec/jobs/notify_category_change_spec.rb+++ b/spec/jobs/notify_category_change_spec.rb@@ -22,9 +22,11 @@ RSpec.describe ::Jobs::NotifyCategoryChange docontext "when mailing list mode is enabled" dobefore { SiteSetting.disable_mailing_list_mode = false }+before doregular_user.user_option.update(mailing_list_mode: true, mailing_list_mode_frequency: 1)end+before { Jobs.run_immediately! }it "notifies mailing list subscribers" dodiff --git a/spec/jobs/notify_mailing_list_subscribers_spec.rb b/spec/jobs/notify_mailing_list_subscribers_spec.rbindex 6a5ec0eee4c..e17e5e8d6f5 100644--- a/spec/jobs/notify_mailing_list_subscribers_spec.rb+++ b/spec/jobs/notify_mailing_list_subscribers_spec.rb@@ -6,6 +6,7 @@ RSpec.describe Jobs::NotifyMailingListSubscribers dobefore domailing_list_user.user_option.update(mailing_list_mode: true, mailing_list_mode_frequency: 1)end+before { SiteSetting.tagging_enabled = true }fab!(:tag)@@ -40,6 +41,7 @@ RSpec.describe Jobs::NotifyMailingListSubscribers docontext "when mailing list mode is globally disabled" dobefore { SiteSetting.disable_mailing_list_mode = true }+include_examples "no emails"end@@ -53,31 +55,37 @@ RSpec.describe Jobs::NotifyMailingListSubscribers doUser.update_all(approved: false)end+include_examples "no emails"endcontext "with an invalid post_id" dobefore { post.destroy! }+include_examples "no emails"endcontext "with a deleted post" dobefore { post.trash! }+include_examples "no emails"endcontext "with a empty post" dobefore { post.update_columns(raw: "") }+include_examples "no emails"endcontext "with a user_deleted post" dobefore { post.update(user_deleted: true) }+include_examples "no emails"endcontext "with a deleted topic" dobefore { post.topic.update(deleted_at: Time.now) }+include_examples "no emails"end@@ -87,22 +95,26 @@ RSpec.describe Jobs::NotifyMailingListSubscribers doTopicAllowedUser.create(topic: post.topic, user: mailing_list_user)post.topic.reloadend+include_examples "no emails"endcontext "with a valid post from another user" docontext "when to an inactive user" dobefore { mailing_list_user.update(active: false) }+include_examples "no emails"endcontext "when to a silenced user" dobefore { mailing_list_user.update(silenced_till: 1.year.from_now) }+include_examples "no emails"endcontext "when to a suspended user" dobefore { mailing_list_user.update(suspended_till: 1.day.from_now) }+include_examples "no emails"end@@ -113,26 +125,31 @@ RSpec.describe Jobs::NotifyMailingListSubscribers docontext "when to an user who has disabled mailing list mode" dobefore { mailing_list_user.user_option.update(mailing_list_mode: false) }+include_examples "no emails"endcontext "when to an user who has frequency set to 'always'" dobefore { mailing_list_user.user_option.update(mailing_list_mode_frequency: 1) }+include_examples "one email"endcontext "when to an user who has frequency set to 'no echo'" dobefore { mailing_list_user.user_option.update(mailing_list_mode_frequency: 2) }+include_examples "one email"endcontext "when from a muted user" dobefore { MutedUser.create(user: mailing_list_user, muted_user: user) }+include_examples "no emails"endcontext "when from an ignored user" dobefore { Fabricate(:ignored_user, user: mailing_list_user, ignored_user: user) }+include_examples "no emails"end@@ -144,6 +161,7 @@ RSpec.describe Jobs::NotifyMailingListSubscribers donotification_level: TopicUser.notification_levels[:muted],)end+include_examples "no emails"end@@ -155,11 +173,13 @@ RSpec.describe Jobs::NotifyMailingListSubscribers donotification_level: CategoryUser.notification_levels[:muted],)end+include_examples "no emails"endcontext "with mute all categories by default setting" dobefore { SiteSetting.mute_all_categories_by_default = true }+include_examples "no emails"end@@ -172,6 +192,7 @@ RSpec.describe Jobs::NotifyMailingListSubscribers donotification_level: CategoryUser.notification_levels[:watching],)end+include_examples "one email"end@@ -184,6 +205,7 @@ RSpec.describe Jobs::NotifyMailingListSubscribers donotification_level: TagUser.notification_levels[:watching],)end+include_examples "one email"end@@ -196,6 +218,7 @@ RSpec.describe Jobs::NotifyMailingListSubscribers donotification_level: TopicUser.notification_levels[:watching],)end+include_examples "one email"end@@ -207,6 +230,7 @@ RSpec.describe Jobs::NotifyMailingListSubscribers donotification_level: TagUser.notification_levels[:muted],)end+include_examples "no emails"end@@ -276,16 +300,19 @@ RSpec.describe Jobs::NotifyMailingListSubscribers docontext "when to an user who has frequency set to 'daily'" dobefore { mailing_list_user.user_option.update(mailing_list_mode_frequency: 0) }+include_examples "no emails"endcontext "when to an user who has frequency set to 'always'" dobefore { mailing_list_user.user_option.update(mailing_list_mode_frequency: 1) }+include_examples "one email"endcontext "when to an user who has frequency set to 'no echo'" dobefore { mailing_list_user.user_option.update(mailing_list_mode_frequency: 2) }+include_examples "no emails"endenddiff --git a/spec/jobs/pull_hotlinked_images_spec.rb b/spec/jobs/pull_hotlinked_images_spec.rbindex d0b81bec879..73c2b26d6d6 100644--- a/spec/jobs/pull_hotlinked_images_spec.rb+++ b/spec/jobs/pull_hotlinked_images_spec.rb@@ -16,6 +16,7 @@ RSpec.describe Jobs::PullHotlinkedImages do)endlet(:upload_path) { Discourse.store.upload_path }+fab!(:user) { Fabricate(:user, refresh_auto_groups: true) }before dodiff --git a/spec/jobs/regular/site_setting_update_default_tags_spec.rb b/spec/jobs/regular/site_setting_update_default_tags_spec.rbindex c593cc7ee91..18330d4ddb7 100644--- a/spec/jobs/regular/site_setting_update_default_tags_spec.rb+++ b/spec/jobs/regular/site_setting_update_default_tags_spec.rb@@ -12,6 +12,7 @@ describe Jobs::SiteSettingUpdateDefaultTags dolet(:tracking) { NotificationLevels.all[:tracking] }let(:tags) { 3.times.collect { Fabricate(:tag) } }+before doSiteSetting.default_tags_watching = tags.first(2).pluck(:name).join("|")TagUser.create!(tag_id: tags.last.id, notification_level: tracking, user: user2)diff --git a/spec/jobs/scheduled/notify_admins_of_available_upcoming_changes_spec.rb b/spec/jobs/scheduled/notify_admins_of_available_upcoming_changes_spec.rbindex fa9790f4719..964af9d4b81 100644--- a/spec/jobs/scheduled/notify_admins_of_available_upcoming_changes_spec.rb+++ b/spec/jobs/scheduled/notify_admins_of_available_upcoming_changes_spec.rb@@ -32,6 +32,7 @@ RSpec.describe Jobs::NotifyAdminsOfAvailableUpcomingChanges doendlet(:test_upcoming_change_status) { :beta }+fab!(:admin_1, :admin)fab!(:admin_2, :admin)diff --git a/spec/jobs/user_email_spec.rb b/spec/jobs/user_email_spec.rbindex e6a06a1f81b..c013b9d000d 100644--- a/spec/jobs/user_email_spec.rb+++ b/spec/jobs/user_email_spec.rb@@ -388,6 +388,7 @@ RSpec.describe Jobs::UserEmail docontext "with confirm_new_email" dolet(:email_token) { Fabricate(:email_token, user: user) }+before doEmailChangeRequest.create!(user: user,@@ -400,6 +401,7 @@ RSpec.describe Jobs::UserEmail docontext "when the change was requested by admin" dolet(:requested_by) { Fabricate(:admin) }+it "passes along true for the requested_by_admin param which changes the wording in the email" doJobs::UserEmail.new.execute(type: :confirm_new_email,@@ -413,6 +415,7 @@ RSpec.describe Jobs::UserEmail docontext "when the change was requested by the user" dolet(:requested_by) { user }+it "passes along false for the requested_by_admin param which changes the wording in the email" doJobs::UserEmail.new.execute(type: :confirm_new_email,@@ -426,6 +429,7 @@ RSpec.describe Jobs::UserEmail docontext "when requested_by record is not present" dolet(:requested_by) { nil }+it "passes along false for the requested_by_admin param which changes the wording in the email" doJobs::UserEmail.new.execute(type: :confirm_new_email,@@ -487,6 +491,7 @@ RSpec.describe Jobs::UserEmail dodata: { original_post_id: post.id }.to_json,)end+fab!(:moderator)fab!(:regular_user, :user)diff --git a/spec/lib/auth/github_authenticator_spec.rb b/spec/lib/auth/github_authenticator_spec.rbindex 9ff52ac471a..5d55c9bf2ad 100644--- a/spec/lib/auth/github_authenticator_spec.rb+++ b/spec/lib/auth/github_authenticator_spec.rb@@ -18,6 +18,7 @@ endRSpec.describe Auth::GithubAuthenticator dolet(:authenticator) { described_class.new }+fab!(:user)describe "after_authenticate" dodiff --git a/spec/lib/backup_restore/creator_spec.rb b/spec/lib/backup_restore/creator_spec.rbindex a40ce60a386..2f206b6f9bc 100644--- a/spec/lib/backup_restore/creator_spec.rb+++ b/spec/lib/backup_restore/creator_spec.rb@@ -248,6 +248,7 @@ describe BackupRestore::Creator docontext "when the result is successful" dolet(:success) { true }+it "refreshes disk stats" dostore.expects(:reset_cache).at_least_oncerundiff --git a/spec/lib/bookmark_manager_spec.rb b/spec/lib/bookmark_manager_spec.rbindex a1538594dd9..cc73912458b 100644--- a/spec/lib/bookmark_manager_spec.rb+++ b/spec/lib/bookmark_manager_spec.rb@@ -11,6 +11,7 @@ RSpec.describe BookmarkManager dodescribe ".destroy" dolet!(:bookmark) { Fabricate(:bookmark, user: user, bookmarkable: post) }+it "deletes the existing bookmark" domanager.destroy(bookmark.id)expect(Bookmark.exists?(id: bookmark.id)).to eq(false)@@ -27,6 +28,7 @@ RSpec.describe BookmarkManager docontext "if the bookmark is belonging to some other user" dolet!(:bookmark) { Fabricate(:bookmark, user: Fabricate(:admin), bookmarkable: post) }+it "raises an invalid access error" doexpect { manager.destroy(bookmark.id) }.to raise_error(Discourse::InvalidAccess)end@@ -89,6 +91,7 @@ RSpec.describe BookmarkManager docontext "if the bookmark is belonging to some other user" dolet!(:bookmark) { Fabricate(:bookmark, user: Fabricate(:admin), bookmarkable: post) }+it "raises an invalid access error" doexpect { update_bookmark }.to raise_error(Discourse::InvalidAccess)end@@ -96,6 +99,7 @@ RSpec.describe BookmarkManager docontext "if the bookmark no longer exists" dobefore { bookmark.destroy! }+it "raises a not found error" doexpect { update_bookmark }.to raise_error(Discourse::NotFound)end@@ -133,6 +137,7 @@ RSpec.describe BookmarkManager dodescribe ".send_reminder_notification" dolet(:bookmark) { Fabricate(:bookmark, user: user) }+it "sets the reminder_last_sent_at" doexpect(bookmark.reminder_last_sent_at).to eq(nil)described_class.send_reminder_notification(bookmark.id)@@ -148,6 +153,7 @@ RSpec.describe BookmarkManager docontext "when the bookmark does no longer exist" dobefore { bookmark.destroy }+it "does not error, and does not create a notification" dodescribed_class.send_reminder_notification(bookmark.id)expect(notifications_for_user.any?).to eq(false)@@ -156,6 +162,7 @@ RSpec.describe BookmarkManager docontext "if the post has been deleted" dobefore { bookmark.bookmarkable.trash! }+it "does not error and does not create a notification" dodescribed_class.send_reminder_notification(bookmark.id)bookmark.reload@@ -188,6 +195,7 @@ RSpec.describe BookmarkManager docontext "if the bookmark is belonging to some other user" dolet!(:bookmark) { Fabricate(:bookmark, user: Fabricate(:admin)) }+it "raises an invalid access error" doexpect { manager.toggle_pin(bookmark_id: bookmark.id) }.to raise_error(Discourse::InvalidAccess,@@ -197,6 +205,7 @@ RSpec.describe BookmarkManager docontext "if the bookmark no longer exists" dobefore { bookmark.destroy! }+it "raises a not found error" doexpect { manager.toggle_pin(bookmark_id: bookmark.id) }.to raise_error(Discourse::NotFound)end@@ -389,6 +398,7 @@ RSpec.describe BookmarkManager docontext "when the post is inaccessible for the user" dobefore { post.trash! }+it "raises an invalid access error" doexpect {manager.create_for(bookmarkable_id: post.id, bookmarkable_type: "Post", name: name)@@ -398,6 +408,7 @@ RSpec.describe BookmarkManager docontext "when the topic is inaccessible for the user" dobefore { post.topic.update(category: Fabricate(:private_category, group: Fabricate(:group))) }+it "raises an invalid access error" doexpect {manager.create_for(bookmarkable_id: post.id, bookmarkable_type: "Post", name: name)diff --git a/spec/lib/category_guardian_spec.rb b/spec/lib/category_guardian_spec.rbindex 2e8e81a872d..88099d7921f 100644--- a/spec/lib/category_guardian_spec.rb+++ b/spec/lib/category_guardian_spec.rb@@ -11,6 +11,7 @@ RSpec.describe CategoryGuardian doit "returns false for anonymous user" doexpect(Guardian.new.can_post_in_category?(category)).to eq(false)end+it "returns true for admin" doexpect(Guardian.new(admin).can_post_in_category?(category)).to eq(true)enddiff --git a/spec/lib/concern/second_factor_manager_spec.rb b/spec/lib/concern/second_factor_manager_spec.rbindex 05ed5a99201..6e4c3449a81 100644--- a/spec/lib/concern/second_factor_manager_spec.rb+++ b/spec/lib/concern/second_factor_manager_spec.rb@@ -47,12 +47,14 @@ RSpec.describe SecondFactorManager do"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" 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" doSiteSetting.title = "Our Spaceballs: The Discourse"expect(user.user_second_factors.totps.first.totp_provisioning_uri).to eq(@@ -330,6 +332,7 @@ RSpec.describe SecondFactorManager dosecond_factor_method: UserSecondFactor.methods[:security_key],}end+it "returns OK" doexpect(user.authenticate_second_factor(params, server_session).ok).to eq(true)end@@ -353,6 +356,7 @@ RSpec.describe SecondFactorManager dosecond_factor_method: UserSecondFactor.methods[:security_key],}end+it "returns not OK" doresult = user.authenticate_second_factor(params, server_session)expect(result.ok).to eq(false)@@ -372,6 +376,7 @@ RSpec.describe SecondFactorManager dosecond_factor_method: UserSecondFactor.methods[:totp],}end+it "returns OK" doexpect(user.authenticate_second_factor(params, server_session).ok).to eq(true)end@@ -387,6 +392,7 @@ RSpec.describe SecondFactorManager dolet(:params) do{ second_factor_token: "blah", second_factor_method: UserSecondFactor.methods[:totp] }end+it "returns not OK" doresult = user.authenticate_second_factor(params, server_session)expect(result.ok).to eq(false)@@ -434,6 +440,7 @@ RSpec.describe SecondFactorManager docontext "when the user does not have TOTP enabled" dolet(:token) { "test" }+before { user.totps.destroy_all }it "returns an error" do@@ -458,6 +465,7 @@ RSpec.describe SecondFactorManager dolet(:params) do{ second_factor_token: valid_security_key_auth_post_data, second_factor_method: method }end+it "returns OK" doexpect(user.authenticate_second_factor(params, server_session).ok).to eq(true)enddiff --git a/spec/lib/content_buffer_spec.rb b/spec/lib/content_buffer_spec.rbindex 567f808b6e5..603a932cead 100644--- a/spec/lib/content_buffer_spec.rb+++ b/spec/lib/content_buffer_spec.rb@@ -8,6 +8,7 @@ RSpec.describe ContentBuffer doc.apply_transform!(start: { row: 0, col: 0 }, finish: { col: 1, row: 1 }, operation: :delete)expect(c.to_s).to eq("c\nc")end+it "handles deletion inside lines properly" doc = ContentBuffer.new("hello world")c.apply_transform!(start: { row: 0, col: 1 }, finish: { col: 4, row: 0 }, operation: :delete)diff --git a/spec/lib/cooked_post_processor_spec.rb b/spec/lib/cooked_post_processor_spec.rbindex bf947776f5f..4ba03a9488b 100644--- a/spec/lib/cooked_post_processor_spec.rb+++ b/spec/lib/cooked_post_processor_spec.rb@@ -410,16 +410,19 @@ RSpec.describe CookedPostProcessor docontext "with invalid width" dolet(:image_sizes) { { "http://foo.bar/image.png" => { "width" => 0, "height" => 222 } } }+include_examples "leave dimensions alone"endcontext "with invalid height" dolet(:image_sizes) { { "http://foo.bar/image.png" => { "width" => 111, "height" => 0 } } }+include_examples "leave dimensions alone"endcontext "with invalid width & height" dolet(:image_sizes) { { "http://foo.bar/image.png" => { "width" => 0, "height" => 0 } } }+include_examples "leave dimensions alone"endenddiff --git a/spec/lib/discourse_tagging_spec.rb b/spec/lib/discourse_tagging_spec.rbindex e0e7e43f22e..add10620f26 100644--- a/spec/lib/discourse_tagging_spec.rb+++ b/spec/lib/discourse_tagging_spec.rb@@ -1132,6 +1132,7 @@ RSpec.describe DiscourseTagging dolet!(:staff_tag_group) doFabricate(:tag_group, permissions: { "staff" => 1 }, tag_names: [hidden_tag.name])end+fab!(:topic) { Fabricate(:topic, tags: [tag1, tag2, tag3, hidden_tag]) }it "returns all tags to staff" do@@ -1397,6 +1398,7 @@ RSpec.describe DiscourseTagging dolet!(:staff_tag_group) doFabricate(:tag_group, permissions: { "staff" => 1 }, tag_names: [hidden_tag.name])end+fab!(:topic) { Fabricate(:topic, user: user) }fab!(:post) { Fabricate(:post, user: user, topic: topic, post_number: 1) }diff --git a/spec/lib/discourse_updates_spec.rb b/spec/lib/discourse_updates_spec.rbindex 3b4aaad5819..02bc148fe95 100644--- a/spec/lib/discourse_updates_spec.rb+++ b/spec/lib/discourse_updates_spec.rb@@ -46,6 +46,7 @@ RSpec.describe DiscourseUpdates docontext "when a good version check request happened recently" docontext "when server is up-to-date" dolet(:time) { 12.hours.ago }+before { stub_data(Discourse::VERSION::STRING, 0, time) }it "returns all the version fields" do@@ -62,6 +63,7 @@ RSpec.describe DiscourseUpdates docontext "when server is not up-to-date" dolet(:time) { 12.hours.ago }+before { stub_data("0.9.0", 2, time) }it "returns all the version fields" do@@ -117,11 +119,13 @@ RSpec.describe DiscourseUpdates docontext "when installed is latest" dobefore { stub_data(Discourse::VERSION::STRING, 1, 8.hours.ago) }+include_examples "queue version check and report that version is ok"endcontext "when installed does not match latest version, but missing_versions_count is 0" dobefore { stub_data("0.10.10.123", 0, 8.hours.ago) }+include_examples "queue version check and report that version is ok"endend@@ -146,11 +150,13 @@ RSpec.describe DiscourseUpdates docontext "when missing_versions_count is 0" dobefore { stub_data("0.9.7", 0, 8.hours.ago) }+include_examples "when last_installed_version is old"endcontext "when missing_versions_count is not 0" dobefore { stub_data("0.9.7", 1, 8.hours.ago) }+include_examples "when last_installed_version is old"endenddiff --git a/spec/lib/discourse_webauthn/authentication_service_spec.rb b/spec/lib/discourse_webauthn/authentication_service_spec.rbindex 1956bc740be..af18d071d47 100644--- a/spec/lib/discourse_webauthn/authentication_service_spec.rb+++ b/spec/lib/discourse_webauthn/authentication_service_spec.rb@@ -110,6 +110,7 @@ RSpec.describe DiscourseWebauthn::AuthenticationService docontext "when params is blank" dolet(:params) { nil }+it "raises a MalformedPublicKeyCredentialError" doexpect { service.authenticate_security_key }.to raise_error(DiscourseWebauthn::MalformedPublicKeyCredentialError,@@ -120,6 +121,7 @@ RSpec.describe DiscourseWebauthn::AuthenticationService docontext "when params is not blank and not a hash" dolet(:params) { "test" }+it "raises a MalformedPublicKeyCredentialError" doexpect { service.authenticate_security_key }.to raise_error(DiscourseWebauthn::MalformedPublicKeyCredentialError,diff --git a/spec/lib/email/authentication_results_spec.rb b/spec/lib/email/authentication_results_spec.rbindex 2794674f162..539ee645bcf 100644--- a/spec/lib/email/authentication_results_spec.rb+++ b/spec/lib/email/authentication_results_spec.rb@@ -210,16 +210,19 @@ RSpec.describe Email::AuthenticationResults docontext "with a single authentication-results header" docontext "with a valid fail" dolet(:headers) { "valid.com; dmarc=fail" }+include_examples "is verdict", :failendcontext "with a valid pass" dolet(:headers) { "valid.com; dmarc=pass" }+include_examples "is verdict", :passendcontext "with a valid error" dolet(:headers) { "valid.com; dmarc=error" }+include_examples "is verdict", :grayend@@ -228,11 +231,13 @@ RSpec.describe Email::AuthenticationResults docontext "with a fail" dolet(:headers) { "foobar.com; dmarc=fail" }+include_examples "is verdict", :grayendcontext "with a pass" dolet(:headers) { "foobar.com; dmarc=pass" }+include_examples "is verdict", :grayendend@@ -241,16 +246,19 @@ RSpec.describe Email::AuthenticationResults docontext "with multiple authentication-results headers" docontext "with a valid fail, and an invalid pass" dolet(:headers) { ["valid.com; dmarc=fail", "invalid.com; dmarc=pass"] }+include_examples "is verdict", :failendcontext "with a valid fail, and a valid pass" dolet(:headers) { ["valid.com; dmarc=fail", "valid.com; dmarc=pass"] }+include_examples "is verdict", :failendcontext "with a valid error, and a valid pass" dolet(:headers) { ["valid.com; dmarc=foobar", "valid.com; dmarc=pass"] }+include_examples "is verdict", :passend@@ -259,6 +267,7 @@ RSpec.describe Email::AuthenticationResults docontext "with an error, and a pass" dolet(:headers) { ["foobar.com; dmarc=foobar", "foobar.com; dmarc=pass"] }+include_examples "is verdict", :grayendenddiff --git a/spec/lib/email/processor_spec.rb b/spec/lib/email/processor_spec.rbindex 8021ab8ffa0..db44c73dbbd 100644--- a/spec/lib/email/processor_spec.rb+++ b/spec/lib/email/processor_spec.rb@@ -18,6 +18,7 @@ RSpec.describe Email::Processor docontext "when reply via email is too short" dolet(:mail) { file_from_fixtures("chinese_reply.eml", "emails").read }+fab!(:post)fab!(:user) { Fabricate(:user, email: "[email protected]", refresh_auto_groups: true) }@@ -52,6 +53,7 @@ RSpec.describe Email::Processor do)endend+describe "from reply to email address" dolet(:mail) do"Date: Fri, 15 Jan 2016 00:12:43 +0100\nFrom: [email protected]\nTo: [email protected]\nSubject: FOO BAR\n\nFoo foo bar bar?"diff --git a/spec/lib/email/receiver_spec.rb b/spec/lib/email/receiver_spec.rbindex 4466069e8c0..9af50d188ee 100644--- a/spec/lib/email/receiver_spec.rb+++ b/spec/lib/email/receiver_spec.rb@@ -200,6 +200,7 @@ RSpec.describe Email::Receiver docontext "with reply_by_email configured" dobefore { configure_reply_by_email }+it "invites everyone in the chain but emails configured as 'incoming' (via reply, group or category)" doexpect { process(:cc) }.to change(Topic, :count)@@ -583,6 +584,7 @@ RSpec.describe Email::Receiver doprocess(:email_to_group_email_username_1)Topic.lastend+fab!(:user_in_group) dou = Fabricate(:user)Fabricate(:group_user, user: u, group: group)@@ -2003,6 +2005,7 @@ RSpec.describe Email::Receiver doEmail::Receiver::ReplyNotAllowedError,)end+it "works" doexpect { process(:reply_user_matching) }.to change { topic.posts.count }enddiff --git a/spec/lib/email/renderer_spec.rb b/spec/lib/email/renderer_spec.rbindex 63570ceb315..e637fb5a010 100644--- a/spec/lib/email/renderer_spec.rb+++ b/spec/lib/email/renderer_spec.rb@@ -25,6 +25,7 @@ RSpec.describe Email::Renderer docontext "with email_renderer_html modifier" doafter { DiscoursePluginRegistry.reset! }+it "can modify the html" doPlugin::Instance.newdiff --git a/spec/lib/email/sender_spec.rb b/spec/lib/email/sender_spec.rbindex c6d66c66b73..bcde8ff146b 100644--- a/spec/lib/email/sender_spec.rb+++ b/spec/lib/email/sender_spec.rb@@ -4,6 +4,7 @@ require "email/sender"RSpec.describe Email::Sender dobefore { SiteSetting.secure_uploads_allow_embed_images_in_emails = false }+fab!(:post)let(:mock_smtp_transaction_response) do"250 Ok: queued as [email protected]"diff --git a/spec/lib/email/styles_spec.rb b/spec/lib/email/styles_spec.rbindex 8dd3fc7aa78..c60839cbc0f 100644--- a/spec/lib/email/styles_spec.rb+++ b/spec/lib/email/styles_spec.rb@@ -313,6 +313,7 @@ RSpec.describe Email::Styles doendlet(:attachments) { { "testimage.png" => stub(url: "email/test.png") } }+it "replaces secure uploads within a link with a placeholder" dofrag =html_fragment(@@ -534,6 +535,7 @@ RSpec.describe Email::Styles do<div style="clear: both"></div></aside>HTML+it "keeps the special onebox styles" dostrip_and_inlineexpect(@frag.to_s).to include("cid:email/test.png")diff --git a/spec/lib/file_store/s3_store_spec.rb b/spec/lib/file_store/s3_store_spec.rbindex a4ba3788799..cfd01ad93f4 100644--- a/spec/lib/file_store/s3_store_spec.rb+++ b/spec/lib/file_store/s3_store_spec.rb@@ -15,6 +15,7 @@ RSpec.describe FileStore::S3Store dofab!(:optimized_image)let(:optimized_image_file) { file_from_fixtures("logo.png") }let(:uploaded_file) { file_from_fixtures("logo.png") }+fab!(:upload) { Fabricate(:upload, sha1: Digest::SHA1.hexdigest("secret image string")) }before dodiff --git a/spec/lib/guardian/flag_guardian_spec.rb b/spec/lib/guardian/flag_guardian_spec.rbindex 64ce0aa9bda..9ed9c271adc 100644--- a/spec/lib/guardian/flag_guardian_spec.rb+++ b/spec/lib/guardian/flag_guardian_spec.rb@@ -6,6 +6,7 @@ RSpec.describe FlagGuardian dofab!(:moderator)after(:each) { Flag.reset_flag_settings! }+describe "#can_create_flag?" doit "returns true for admin and when custom flags limit is not reached" doSiteSetting.custom_flags_limit = 1diff --git a/spec/lib/guardian/invite_guardian_spec.rb b/spec/lib/guardian/invite_guardian_spec.rbindex c25b45c7883..f77b40351ff 100644--- a/spec/lib/guardian/invite_guardian_spec.rb+++ b/spec/lib/guardian/invite_guardian_spec.rb@@ -120,6 +120,7 @@ RSpec.describe InviteGuardian doSiteSetting.invite_allowed_groups = Group::AUTO_GROUPS[:trust_level_2]user.update!(trust_level: 2)end+fab!(:category) { Fabricate(:category, read_restricted: true) }fab!(:topic)fab!(:private_topic) { Fabricate(:topic, category: category) }diff --git a/spec/lib/guardian/post_guardian_spec.rb b/spec/lib/guardian/post_guardian_spec.rbindex 55817e4fb1e..dce84101f60 100644--- a/spec/lib/guardian/post_guardian_spec.rb+++ b/spec/lib/guardian/post_guardian_spec.rb@@ -461,6 +461,7 @@ RSpec.describe PostGuardian dofab!(:private_message) { Fabricate(:system_message_topic, user: user) }before { user.save! }+it "allows the user to reply to system messages" doexpect(Guardian.new(user).can_create_post?(private_message)).to eq(true)SiteSetting.enable_system_message_replies = false@@ -1040,6 +1041,7 @@ RSpec.describe PostGuardian doSiteSetting.allow_likes_in_anonymous_mode = falseSiteSetting.allow_anonymous_mode = trueend+describe "an anonymous user" dolet(:post_action) douser.id = anon.iddiff --git a/spec/lib/guardian/user_guardian_spec.rb b/spec/lib/guardian/user_guardian_spec.rbindex a54e8a7a9b9..22493d55279 100644--- a/spec/lib/guardian/user_guardian_spec.rb+++ b/spec/lib/guardian/user_guardian_spec.rb@@ -673,12 +673,14 @@ RSpec.describe UserGuardian docontext "for moderators" dolet(:guardian) { Guardian.new(moderator) }+include_examples "can_delete_user examples"include_examples "can_delete_user staff examples"endcontext "for admins" dolet(:guardian) { Guardian.new(admin) }+include_examples "can_delete_user examples"include_examples "can_delete_user staff examples"end@@ -694,6 +696,7 @@ RSpec.describe UserGuardian docontext "for moderators" dolet(:guardian) { Guardian.new(moderator) }+include_examples "can_merge_user examples"it "isn't allowed if current_user is not an admin" do@@ -703,6 +706,7 @@ RSpec.describe UserGuardian docontext "for admins" dolet(:guardian) { Guardian.new(admin) }+include_examples "can_merge_user examples"endenddiff --git a/spec/lib/guardian_spec.rb b/spec/lib/guardian_spec.rbindex 4b755c7c878..386090cf4e4 100644--- a/spec/lib/guardian_spec.rb+++ b/spec/lib/guardian_spec.rb@@ -261,6 +261,7 @@ RSpec.describe Guardian docontext "when personal_message_enabled_groups does not contain the user" dolet(:group) { Fabricate(:group) }+before { SiteSetting.personal_message_enabled_groups = group.id }it "returns false if user is not staff member" do@@ -410,6 +411,7 @@ RSpec.describe Guardian docontext "when personal_message_enabled_groups does contain the user" dolet(:group) { Fabricate(:group) }+before { SiteSetting.personal_message_enabled_groups = group.id }it "returns true" do@@ -422,6 +424,7 @@ RSpec.describe Guardian docontext "when personal_message_enabled_groups does not contain the user" dolet(:group) { Fabricate(:group) }+before { SiteSetting.personal_message_enabled_groups = group.id }it "returns false if user is not staff member" do@@ -488,6 +491,7 @@ RSpec.describe Guardian doglobal_setting :allow_impersonation, falseexpect(Guardian.new(admin).can_impersonate?(moderator)).to be_falseyend+it "allows impersonation correctly" doexpect(Guardian.new(admin).can_impersonate?(nil)).to be_falseyexpect(Guardian.new.can_impersonate?(user)).to be_falsey@@ -1269,6 +1273,7 @@ RSpec.describe Guardian docontext "with first post of a static page doc" dolet!(:tos_topic) { Fabricate(:topic, user: Discourse.system_user) }let!(:tos_first_post) { Fabricate(:post, topic: tos_topic, user: tos_topic.user) }+before { SiteSetting.tos_topic_id = tos_topic.id }it "restricts static doc posts" do@@ -2405,6 +2410,7 @@ RSpec.describe Guardian docontext "with posts" dobefore { target_user.stubs(:post_count).returns(1) }+include_examples "staff can always change usernames"it "is false for the user to change their own username" doexpect(Guardian.new(target_user).can_edit_username?(target_user)).to be_falsey@@ -2738,6 +2744,7 @@ RSpec.describe Guardian docontext "when ignorer is staff" dolet(:guardian) { Guardian.new(admin) }+it "allows ignoring user" doexpect(guardian.can_ignore_user?(another_user)).to eq(true)end@@ -2745,6 +2752,7 @@ RSpec.describe Guardian docontext "when ignorer is not in required trust level group" dolet(:guardian) { Guardian.new(trust_level_0) }+it "does not allow ignoring user" doexpect(guardian.can_ignore_user?(another_user)).to eq(false)end@@ -2752,6 +2760,7 @@ RSpec.describe Guardian docontext "when ignorer is in the required trust level group" dolet(:guardian) { Guardian.new(trust_level_1) }+it "allows ignoring user" doexpect(guardian.can_ignore_user?(another_user)).to eq(true)end@@ -2759,6 +2768,7 @@ RSpec.describe Guardian docontext "when ignorer is in a higher than required trust level group" dolet(:guardian) { Guardian.new(trust_level_3) }+it "allows ignoring user" doexpect(guardian.can_ignore_user?(another_user)).to eq(true)end@@ -2790,6 +2800,7 @@ RSpec.describe Guardian docontext "when muter's trust level is below tl1" dolet(:guardian) { Guardian.new(trust_level_0) }+fab!(:trust_level_0)it "does not allow muting user" do@@ -2914,6 +2925,7 @@ RSpec.describe Guardian docontext "when post is older than post_edit_time_limit" dolet(:old_post) { Fabricate(:post, user: trust_level_2, created_at: 6.minutes.ago) }+before doSiteSetting.self_wiki_allowed_groups = "1|2|12"SiteSetting.tl2_post_edit_time_limit = 5@@ -3242,6 +3254,7 @@ RSpec.describe Guardian dodescribe "topic featured link category restriction" dobefore { SiteSetting.topic_featured_link_enabled = true }+let(:guardian) { Guardian.new(user) }let(:uncategorized) { Category.find(SiteSetting.uncategorized_category_id) }diff --git a/spec/lib/json_api_kit/declarations/relationship_spec.rb b/spec/lib/json_api_kit/declarations/relationship_spec.rbindex 0c97fa40497..f04857b2637 100644--- a/spec/lib/json_api_kit/declarations/relationship_spec.rb+++ b/spec/lib/json_api_kit/declarations/relationship_spec.rb@@ -25,6 +25,7 @@ RSpec.describe JsonApiKit::Declarations::Relationship doendendend+let(:groups_resource) { Class.new(JsonApiKit::Resource) { type :groups } }let(:users_resource) dorelated = groups_resourcediff --git a/spec/lib/json_api_kit/request/contract/collection_spec.rb b/spec/lib/json_api_kit/request/contract/collection_spec.rbindex 324cd84e546..e5c072ef018 100644--- a/spec/lib/json_api_kit/request/contract/collection_spec.rb+++ b/spec/lib/json_api_kit/request/contract/collection_spec.rb@@ -61,9 +61,11 @@ RSpec.describe JsonApiKit::Request::Contract::Collection, type: :model doit { is_expected.to allow_value("", "created_at", "-created_at").for(:sort) }it { is_expected.to allow_value("created_at,-title").for(:sort) }it { is_expected.not_to allow_value({ secrets: :asc }).for(:sort) }+it dois_expected.not_to allow_value({ created_at: :sideways }, { created_at: "asc" }).for(:sort)end+it { is_expected.not_to allow_value("secrets", "created_at,secrets").for(:sort) }it { is_expected.not_to allow_value(%w[created_at], 5).for(:sort) }@@ -218,9 +220,11 @@ RSpec.describe JsonApiKit::Request::Contract::Collection, type: :model do.is_less_than_or_equal_to(50).allow_nilend+it { is_expected.not_to allow_value("").for(:size) }it { is_expected.to allow_value(cursor).for(:after) }it { is_expected.to allow_value(cursor).for(:before) }+it dois_expected.not_to allow_value("not-a-cursor",@@ -229,6 +233,7 @@ RSpec.describe JsonApiKit::Request::Contract::Collection, type: :model docursor_not_matching_segment,).for(:after)end+it dois_expected.not_to allow_value("not-a-cursor",@@ -276,12 +281,14 @@ RSpec.describe JsonApiKit::Request::Contract::Collection, type: :model do.is_greater_than_or_equal_to(0).allow_nilend+it dois_expected.to validate_numericality_of(:after_size).only_integer.is_greater_than_or_equal_to(0).allow_nilend+it { is_expected.not_to allow_value("").for(:before_size) }it { is_expected.not_to allow_value("").for(:after_size) }diff --git a/spec/lib/json_api_kit/schema_spec.rb b/spec/lib/json_api_kit/schema_spec.rbindex e16304d4809..027599bef13 100644--- a/spec/lib/json_api_kit/schema_spec.rb+++ b/spec/lib/json_api_kit/schema_spec.rb@@ -56,6 +56,7 @@ RSpec.describe JsonApiKit::Schema doendendend+describe "#table_of" dosubject(:table) { schema.table_of(:user) }diff --git a/spec/lib/json_error_spec.rb b/spec/lib/json_error_spec.rbindex 14211498ec6..8081e728cc0 100644--- a/spec/lib/json_error_spec.rb+++ b/spec/lib/json_error_spec.rb@@ -41,6 +41,7 @@ RSpec.describe JsonError dodescribe "an activerecord object with errors" dolet(:invalid_user) { User.new }+it "returns the errors correctly" doexpect(invalid_user).not_to be_validresult = creator.create_errors_json(invalid_user)diff --git a/spec/lib/message_id_service_spec.rb b/spec/lib/message_id_service_spec.rbindex 5b2573bdfec..b72c97aa0b9 100644--- a/spec/lib/message_id_service_spec.rb+++ b/spec/lib/message_id_service_spec.rb@@ -57,6 +57,7 @@ RSpec.describe Email::MessageIdService dolet(:gmail_format_message_id) do"<CAPGrNgZ7QEFuPcsxJBRZLhBhAYPO_ruYpCANSdqiQEbc9Otpiw@mail.gmail.com>"end+it "finds a post based only on a discourse-format message id" doexpect(described_class.find_post_from_message_ids([discourse_format_message_id])).to eq(post)enddiff --git a/spec/lib/middleware/request_tracker_spec.rb b/spec/lib/middleware/request_tracker_spec.rbindex 773c6274f8f..186ac277006 100644--- a/spec/lib/middleware/request_tracker_spec.rb+++ b/spec/lib/middleware/request_tracker_spec.rb@@ -747,6 +747,7 @@ RSpec.describe Middleware::RequestTracker docontext "when SiteSetting.trigger_browser_pageview_events is true" dobefore { SiteSetting.trigger_browser_pageview_events = true }+it "triggers event for anonymous user page views when `login_required` site setting is false" dosession_id = "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx"DiscourseIpInfo.stubs(:get).returns(country_code: "AU")diff --git a/spec/lib/new_post_manager_spec.rb b/spec/lib/new_post_manager_spec.rbindex f95497e0ec8..095c3c7869b 100644--- a/spec/lib/new_post_manager_spec.rb+++ b/spec/lib/new_post_manager_spec.rb@@ -149,6 +149,7 @@ RSpec.describe NewPostManager doSiteSetting.approve_post_count = 100topic.user.trust_level = 0end+it "will return an enqueue result" doresult = NewPostManager.default_handler(manager)expect(NewPostManager.queue_enabled?).to eq(true)@@ -162,6 +163,7 @@ RSpec.describe NewPostManager doSiteSetting.approve_post_count = 100topic.user.trust_level = 1end+it "will return an enqueue result" doresult = NewPostManager.default_handler(manager)expect(NewPostManager.queue_enabled?).to eq(true)@@ -203,6 +205,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" doresult = NewPostManager.default_handler(manager)expect(NewPostManager.queue_enabled?).to eq(true)@@ -251,6 +254,7 @@ RSpec.describe NewPostManager dobefore doSiteSetting.approve_new_topics_unless_allowed_groups = Group::AUTO_GROUPS[:trust_level_4]end+it "doesn't return a result action" doresult = NewPostManager.default_handler(manager)expect(result).to eq(nil)@@ -397,10 +401,12 @@ RSpec.describe NewPostManager dolet(:manager) doNewPostManager.new(user, raw: "this is new topic content", title: "new topic title")end+context "with a high trust level setting for new topics" dobefore doSiteSetting.approve_new_topics_unless_allowed_groups = Group::AUTO_GROUPS[:trust_level_4]end+it "will return an enqueue result" doresult = NewPostManager.default_handler(manager)expect(NewPostManager.queue_enabled?).to eq(true)@@ -645,6 +651,7 @@ RSpec.describe NewPostManager docontext "when there is a minimum number of tags required from a certain tag group for the category" dolet(:tag_group) { Fabricate(:tag_group) }let(:tag) { Fabricate(:tag) }+before doTagGroupMembership.create(tag: tag, tag_group: tag_group)category.update(diff --git a/spec/lib/onebox/engine/allowlisted_generic_onebox_spec.rb b/spec/lib/onebox/engine/allowlisted_generic_onebox_spec.rbindex 616fe08a8e9..5cc78866ae6 100644--- a/spec/lib/onebox/engine/allowlisted_generic_onebox_spec.rb+++ b/spec/lib/onebox/engine/allowlisted_generic_onebox_spec.rb@@ -103,6 +103,7 @@ RSpec.describe Onebox::Engine::AllowlistedGenericOnebox dolet(:canonical_url) do"https://www.etsy.com/in-en/listing/87673424/personalized-word-pillow-case-letter"end+before dostub_request(:get, mobile_url).to_return(status: 200, body: onebox_response("etsy_mobile"))stub_request(:get, canonical_url).to_return(status: 200, body: onebox_response("etsy"))@@ -132,6 +133,7 @@ RSpec.describe Onebox::Engine::AllowlistedGenericOnebox dolet(:discourse_topic_reply_url) do"https://meta.discourse.org/t/congratulations-most-stars-in-2013-github-octoverse/12483/2"end+before dostub_request(:get, discourse_topic_url).to_return(status: 200,@@ -192,6 +194,7 @@ RSpec.describe Onebox::Engine::AllowlistedGenericOnebox dodescribe "missing description" dolet(:url) { "https://en-americas-support.nintendo.com/app/answers/detail/a_id/67660" }+before dostub_request(:get, url).to_return(status: 200, body: onebox_response("title_no_description"))stub_request(diff --git a/spec/lib/onebox/engine/twitter_status_onebox_spec.rb b/spec/lib/onebox/engine/twitter_status_onebox_spec.rbindex a33bf3577aa..056529101a4 100644--- a/spec/lib/onebox/engine/twitter_status_onebox_spec.rb+++ b/spec/lib/onebox/engine/twitter_status_onebox_spec.rb@@ -149,6 +149,7 @@ RSpec.describe Onebox::Engine::TwitterStatusOnebox dolet(:tweet_content) { "I've never played Minecraft" }include_context "with standard tweet info"before { @onebox_fixture = "twitterstatus_noclient" }+include_context "with engines"let(:avatar) do@@ -169,6 +170,7 @@ RSpec.describe Onebox::Engine::TwitterStatusOnebox do@link = "https://x.com/MKBHD/status/1625192182859632661"@onebox_fixture = "xstatus_noclient"end+include_context "with engines"it_behaves_like "an engine"diff --git a/spec/lib/onebox/helpers_spec.rb b/spec/lib/onebox/helpers_spec.rbindex 3fa366e1196..885a7adc1b0 100644--- a/spec/lib/onebox/helpers_spec.rb+++ b/spec/lib/onebox/helpers_spec.rb@@ -3,6 +3,7 @@RSpec.describe Onebox::Helpers dodescribe ".truncate" dolet(:test_string) { "Chops off on spaces" }+it { expect(described_class.truncate(test_string)).to eq(test_string) }it { expect(described_class.truncate(test_string, 5)).to eq("Chops...") }it { expect(described_class.truncate(test_string, 7)).to eq("Chops...") }@@ -253,32 +254,39 @@ RSpec.describe Onebox::Helpers do"http://example.com/fo%20o",)end+it doexpect(described_class.normalize_url_for_output("http://example.com/fo'o")).to eq("http://example.com/fo'o",)end+it doexpect(described_class.normalize_url_for_output('http://example.com/fo"o')).to eq("http://example.com/fo"o",)end+it doexpect(described_class.normalize_url_for_output("http://example.com/fo<o>")).to eq("http://example.com/foo",)end+it doexpect(described_class.normalize_url_for_output("http://example.com/d’écran-à")).to eq("http://example.com/d’écran-à",)end+it doexpect(described_class.normalize_url_for_output("//example.com/hello")).to eq("//example.com/hello",)end+it { expect(described_class.normalize_url_for_output("example.com/hello")).to eq("") }+it doexpect(described_class.normalize_url_for_output(@@ -297,6 +305,7 @@ RSpec.describe Onebox::Helpers do),).to eq("https://meta.discourse.org/favicon.ico")end+it doexpect(described_class.get_absolute_image_url(@@ -305,6 +314,7 @@ RSpec.describe Onebox::Helpers do),).to eq("http://meta.discourse.org/favicon.ico")end+it doexpect(described_class.get_absolute_image_url(@@ -313,11 +323,13 @@ RSpec.describe Onebox::Helpers do),).to eq("https://meta.discourse.org/favicon.ico")end+it doexpect(described_class.get_absolute_image_url("/favicon.ico", "https://meta.discourse.org"),).to eq("https://meta.discourse.org/favicon.ico")end+it doexpect(described_class.get_absolute_image_url(@@ -326,6 +338,7 @@ RSpec.describe Onebox::Helpers do),).to eq("https://meta.discourse.org/favicon.ico")end+it doexpect(described_class.get_absolute_image_url(@@ -342,31 +355,37 @@ RSpec.describe Onebox::Helpers do"http://example.com/f%22o&o?%5Bb%22ar%5D",)end+it doexpect(described_class.uri_encode("http://example.com/f.o~o;?<ba'r>")).to eq("http://example.com/f.o~o;?%3Cba%27r%3E",)end+it doexpect(described_class.uri_encode("http://example.com/<+pa'th>(foo)?b+a+r")).to eq("http://example.com/%3C+pa'th%3E(foo)?b+a+r",)end+it doexpect(described_class.uri_encode("http://example.com/p,a:t!h-f$o@o*?b!a#r@")).to eq("http://example.com/p,a:t!h-f$o@o*?b%21a#r%40",)end+it doexpect(described_class.uri_encode("http://example.com/path&foo?b'a<r>&qu(er)y=1")).to eq("http://example.com/path&foo?b%27a%3Cr%3E&qu%28er%29y=1",)end+it doexpect(described_class.uri_encode("http://example.com/index&<script>alert('XSS');</script>"),).to eq("http://example.com/index&%3Cscript%3Ealert('XSS');%3C/script%3E")end+it doexpect(described_class.uri_encode(@@ -376,6 +395,7 @@ RSpec.describe Onebox::Helpers do"http://example.com/index.html?message=%3Cscript%3Ealert%28%27XSS%27%29%3B%3C%2Fscript%3E",)end+it doexpect(described_class.uri_encode(@@ -385,6 +405,7 @@ RSpec.describe Onebox::Helpers do"http://example.com/index.php/%3CIFRAME%20SRC=source.com%20onload='alert(document.cookie)'%3E%3C/IFRAME%3E",)end+it doexpect(described_class.uri_encode("https://en.wiktionary.org/wiki/greengrocer%27s_apostrophe"),@@ -396,11 +417,13 @@ RSpec.describe Onebox::Helpers dodescribed_class.uri_encode("https://example.com/random%2Bpath?q=random%2Bquery"),).to eq("https://example.com/random%2Bpath?q=random%2Bquery")end+it doexpect(described_class.uri_encode("https://glitch.com/edit/#!/equinox-watch")).to eq("https://glitch.com/edit/#!/equinox-watch",)end+it doexpect(described_class.uri_encode("https://gitpod.io/#https://github.com/eclipse-theia/theia"),diff --git a/spec/lib/oneboxer_spec.rb b/spec/lib/oneboxer_spec.rbindex 645b8322e58..236aaa780f8 100644--- a/spec/lib/oneboxer_spec.rb+++ b/spec/lib/oneboxer_spec.rb@@ -43,6 +43,7 @@ RSpec.describe Oneboxer dodescribe "#invalidate" dolet(:url) { "http://test.com" }+it "clears the cached preview for the onebox URL and the failed URL cache" doDiscourse.cache.write(Oneboxer.onebox_cache_key(url), "test")Discourse.cache.write(Oneboxer.onebox_failed_cache_key(url), true)diff --git a/spec/lib/plugin/instance_spec.rb b/spec/lib/plugin/instance_spec.rbindex dac663352d4..eb3a5d3086d 100644--- a/spec/lib/plugin/instance_spec.rb+++ b/spec/lib/plugin/instance_spec.rb@@ -947,6 +947,7 @@ TEXTdescribe "#register_notification_consolidation_plan" dolet(:plugin) { Plugin::Instance.new }+fab!(:topic)after { DiscoursePluginRegistry.reset_register!(:notification_consolidation_plans) }diff --git a/spec/lib/post_destroyer_spec.rb b/spec/lib/post_destroyer_spec.rbindex f3c0d818078..d0c91a334c5 100644--- a/spec/lib/post_destroyer_spec.rb+++ b/spec/lib/post_destroyer_spec.rb@@ -353,6 +353,7 @@ RSpec.describe PostDestroyer docontext "when the topic is deleted" dobefore { @reply.topic.trash! }+it "changes deleted_at to nil" dochanges_deleted_at_to_nilenddiff --git a/spec/lib/post_revisor_spec.rb b/spec/lib/post_revisor_spec.rbindex 95f562166a9..8b1be486f33 100644--- a/spec/lib/post_revisor_spec.rb+++ b/spec/lib/post_revisor_spec.rb@@ -394,6 +394,7 @@ describe PostRevisor dodescribe "with PMs" dofab!(:pm, :private_message_topic)let(:first_post) { create_post(user: admin, topic: pm, allow_uncategorized_topics: false) }+fab!(:category) { Fabricate(:category, topic_count: 1) }it "Does not create a category change small_action post when converting to a topic" doexpect do@@ -1779,6 +1780,7 @@ describe PostRevisor docontext "with secure uploads uploads" dolet!(:image5) { Fabricate(:secure_upload) }+before doJobs.run_immediately!setup_s3diff --git a/spec/lib/pretty_text_spec.rb b/spec/lib/pretty_text_spec.rbindex 080b2eb5cd3..4a3aec39c77 100644--- a/spec/lib/pretty_text_spec.rb+++ b/spec/lib/pretty_text_spec.rb@@ -327,6 +327,7 @@ RSpec.describe PrettyText dolet(:default_avatar) do"//test.localhost/uploads/default/avatars/42d/57c/46ce7ee487/{size}.png"end+fab!(:group)fab!(:user) { Fabricate(:user, primary_group: group) }@@ -2216,6 +2217,7 @@ HTMLcontext "with watched words as regular expressions" dobefore { SiteSetting.watched_words_regular_expressions = true }+it "supports words as regular expressions" do%w[xyz* plee+ase].each do |word|Fabricate(:watched_word, action: WatchedWord.actions[:censor], word: word)diff --git a/spec/lib/promotion_spec.rb b/spec/lib/promotion_spec.rbindex a3e905a1039..c9f613f0d0d 100644--- a/spec/lib/promotion_spec.rb+++ b/spec/lib/promotion_spec.rb@@ -120,6 +120,7 @@ RSpec.describe Promotion dostat.posts_read_count = SiteSetting.tl1_requires_read_postsstat.time_read = SiteSetting.tl1_requires_time_spent_mins * 60end+it "sends promotion message by default" doSiteSetting.send_tl1_welcome_message = true@result = promotion.reviewdiff --git a/spec/lib/s3_cors_rulesets_spec.rb b/spec/lib/s3_cors_rulesets_spec.rbindex 60344e991d0..f7a036ba337 100644--- a/spec/lib/s3_cors_rulesets_spec.rb+++ b/spec/lib/s3_cors_rulesets_spec.rb@@ -14,6 +14,7 @@ RSpec.describe S3CorsRulesets docontext "when S3 is set up with global settings" dolet(:use_db_s3_config) { false }+before doglobal_setting :s3_use_iam_profile, trueglobal_setting :s3_bucket, "s3-upload-bucket"diff --git a/spec/lib/search_spec.rb b/spec/lib/search_spec.rbindex a54990795db..c61c2d5c6b9 100644--- a/spec/lib/search_spec.rb+++ b/spec/lib/search_spec.rb@@ -105,6 +105,7 @@ RSpec.describe Search dolet!(:staff_tag_group) doFabricate(:tag_group, permissions: { "staff" => 1 }, tag_names: [hidden_tag.name])end+fab!(:topic) { Fabricate(:topic, tags: [hidden_tag]) }fab!(:post) { Fabricate(:post, topic: topic) }@@ -3115,6 +3116,7 @@ RSpec.describe Search dodescribe "ignore_diacritics" dobefore { SiteSetting.search_ignore_accents = true }+let!(:post1) { Fabricate(:post, raw: "สวัสดี Rágis hello") }it("allows strips correctly") do@@ -3137,6 +3139,7 @@ RSpec.describe Search dodescribe "include_diacritics" dobefore { SiteSetting.search_ignore_accents = false }+let!(:post1) { Fabricate(:post, raw: "สวัสดี Régis hello") }it("allows strips correctly") do@@ -3332,7 +3335,9 @@ RSpec.describe Search dodescribe "exclude_topics filter" dobefore { SiteSetting.tagging_enabled = true }+let!(:user) { Fabricate(:user) }+fab!(:group) { Fabricate(:group, name: "bruce-world-fans") }fab!(:topic) { Fabricate(:topic, title: "Bruce topic not a result") }@@ -3393,6 +3398,7 @@ RSpec.describe Search doSearchIndexer.enableDiscoursePluginRegistry.clear_modifiers!end+after doSearchIndexer.disablediff --git a/spec/lib/second_factor/auth_manager_spec.rb b/spec/lib/second_factor/auth_manager_spec.rbindex 6de6eefc2bf..975b3249ac2 100644--- a/spec/lib/second_factor/auth_manager_spec.rb+++ b/spec/lib/second_factor/auth_manager_spec.rb@@ -3,6 +3,7 @@RSpec.describe SecondFactor::AuthManager dofab!(:user)let(:guardian) { Guardian.new(user) }+fab!(:user_totp) { Fabricate(:user_second_factor_totp, user: user) }def create_request(request_method: "GET", path: "/")diff --git a/spec/lib/site_setting_extension_spec.rb b/spec/lib/site_setting_extension_spec.rbindex 490cd7ab332..727b327dd5c 100644--- a/spec/lib/site_setting_extension_spec.rb+++ b/spec/lib/site_setting_extension_spec.rb@@ -320,6 +320,7 @@ RSpec.describe SiteSettingExtension dosettings.setting(:image_list_test, "", type: :uploaded_image_list)settings.refresh!end+it "correctly nukes overrides" dosettings.test_override = "bla"settings.remove_override!(:test_override)diff --git a/spec/lib/site_settings/type_supervisor_spec.rb b/spec/lib/site_settings/type_supervisor_spec.rbindex 36b3f293fd1..3186ec9fc0c 100644--- a/spec/lib/site_settings/type_supervisor_spec.rb+++ b/spec/lib/site_settings/type_supervisor_spec.rb@@ -24,84 +24,111 @@ RSpec.describe SiteSettings::TypeSupervisor doit "'string' should be at 1st position" doexpect(SiteSettings::TypeSupervisor.types[:string]).to eq(1)end+it "'time' should be at 2nd position" doexpect(SiteSettings::TypeSupervisor.types[:time]).to eq(2)end+it "'integer' should be at 3rd position" doexpect(SiteSettings::TypeSupervisor.types[:integer]).to eq(3)end+it "'float' should be at 4th position" doexpect(SiteSettings::TypeSupervisor.types[:float]).to eq(4)end+it "'bool' should be at 5th position" doexpect(SiteSettings::TypeSupervisor.types[:bool]).to eq(5)end+it "'null' should be at 6th position" doexpect(SiteSettings::TypeSupervisor.types[:null]).to eq(6)end+it "'enum' should be at 7th position" doexpect(SiteSettings::TypeSupervisor.types[:enum]).to eq(7)end+it "'list' should be at 8th position" doexpect(SiteSettings::TypeSupervisor.types[:list]).to eq(8)end+it "'url_list' should be at 9th position" doexpect(SiteSettings::TypeSupervisor.types[:url_list]).to eq(9)end+it "'host_list' should be at 10th position" doexpect(SiteSettings::TypeSupervisor.types[:host_list]).to eq(10)end+it "'category_list' should be at 11th position" doexpect(SiteSettings::TypeSupervisor.types[:category_list]).to eq(11)end+it "'value_list' should be at 12th position" doexpect(SiteSettings::TypeSupervisor.types[:value_list]).to eq(12)end+it "'regex' should be at 13th position" doexpect(SiteSettings::TypeSupervisor.types[:regex]).to eq(13)end+it "'email' should be at 14th position" doexpect(SiteSettings::TypeSupervisor.types[:email]).to eq(14)end+it "'username' should be at 15th position" doexpect(SiteSettings::TypeSupervisor.types[:username]).to eq(15)end+it "'category' should be at 16th position" doexpect(SiteSettings::TypeSupervisor.types[:category]).to eq(16)end+it "'uploaded_image_list' should be at 17th position" doexpect(SiteSettings::TypeSupervisor.types[:uploaded_image_list]).to eq(17)end+it "'upload' should be at the right position" doexpect(SiteSettings::TypeSupervisor.types[:upload]).to eq(18)end+it "'group' should be at the right position" doexpect(SiteSettings::TypeSupervisor.types[:group]).to eq(19)end+it "'group_list' should be at the right position" doexpect(SiteSettings::TypeSupervisor.types[:group_list]).to eq(20)end+it "'tag_list' should be at the right position" doexpect(SiteSettings::TypeSupervisor.types[:tag_list]).to eq(21)end+it "'color' should be at the right position" doexpect(SiteSettings::TypeSupervisor.types[:color]).to eq(22)end+it "'simple_list' should be at the right position" doexpect(SiteSettings::TypeSupervisor.types[:simple_list]).to eq(23)end+it "'emoji_list' should be at the right position" doexpect(SiteSettings::TypeSupervisor.types[:emoji_list]).to eq(24)end+it "'tag_group_list' should be at the right position" doexpect(SiteSettings::TypeSupervisor.types[:tag_group_list]).to eq(26)end+it "'file_size_restriction' should be at the right position" doexpect(SiteSettings::TypeSupervisor.types[:file_size_restriction]).to eq(27)end+it "'datetime' should be at the right position" doexpect(SiteSettings::TypeSupervisor.types[:datetime]).to eq(31)end+it "'date' should be at the right position" doexpect(SiteSettings::TypeSupervisor.types[:date]).to eq(33)enddiff --git a/spec/lib/site_settings/validations_spec.rb b/spec/lib/site_settings/validations_spec.rbindex 687078c47e9..3f3a050e527 100644--- a/spec/lib/site_settings/validations_spec.rb+++ b/spec/lib/site_settings/validations_spec.rb@@ -141,6 +141,7 @@ RSpec.describe SiteSettings::Validations dolet(:error_message) doI18n.t("errors.site_settings.second_factor_cannot_be_enforced_with_disabled_local_login")end+before { SiteSetting.enable_local_logins = false }it "should raise an error" do@@ -165,6 +166,7 @@ RSpec.describe SiteSettings::Validations do"errors.site_settings.second_factor_cannot_be_enforced_with_discourse_connect_enabled",)end+before doSiteSetting.discourse_connect_url = "https://www.example.com/sso"SiteSetting.discourse_connect_secret = "x" * 10@@ -236,6 +238,7 @@ RSpec.describe SiteSettings::Validations docontext "if secure uploads is enabled" dolet(:error_message) { I18n.t("errors.site_settings.page_publishing_requirements") }+before { enable_secure_uploads }it "is not ok" dodiff --git a/spec/lib/tasks/s3_rake_spec.rb b/spec/lib/tasks/s3_rake_spec.rbindex 0b21eb0c2bc..d344f9fa911 100644--- a/spec/lib/tasks/s3_rake_spec.rb+++ b/spec/lib/tasks/s3_rake_spec.rb@@ -12,6 +12,7 @@ RSpec.describe "s3:upload_assets rake task" dolet(:task) { Rake::Task["s3:upload_assets"] }let(:logger) { instance_double(Logger) }+before doallow(Logger).to receive(:new).and_return(logger)allow(logger).to receive(:<<)diff --git a/spec/lib/topic_query_spec.rb b/spec/lib/topic_query_spec.rbindex 2e4e6c55fc3..3c93e10b25d 100644--- a/spec/lib/topic_query_spec.rb+++ b/spec/lib/topic_query_spec.rb@@ -1150,6 +1150,7 @@ RSpec.describe TopicQuery dodescribe "categorized" dofab!(:category, :category_with_definition)let(:topic_category) { category.topic }+fab!(:topic_no_cat, :topic)fab!(:topic_in_cat1) doFabricate(:topic, category: category, bumped_at: 10.minutes.ago, created_at: 10.minutes.ago)diff --git a/spec/lib/topic_upload_security_manager_spec.rb b/spec/lib/topic_upload_security_manager_spec.rbindex c684444312f..8d1a580aa74 100644--- a/spec/lib/topic_upload_security_manager_spec.rb+++ b/spec/lib/topic_upload_security_manager_spec.rb@@ -41,6 +41,7 @@ RSpec.describe TopicUploadSecurityManager docontext "when changing the topic to a non-private category" dobefore { topic.update(category: Fabricate(:category)) }+it "changes the upload secure statuses to false and updates ACLs and rebakes" doexpect_upload_status_to_change_and_rebakeend@@ -71,6 +72,7 @@ RSpec.describe TopicUploadSecurityManager docontext "when making the PM into a public topic" dobefore { topic.update(archetype: Archetype.default) }+it "changes the upload secure statuses to false and updates ACLs and rebakes" doexpect_upload_status_to_change_and_rebakeenddiff --git a/spec/lib/topic_view_spec.rb b/spec/lib/topic_view_spec.rbindex a0569e6e26e..a7c2b96b71c 100644--- a/spec/lib/topic_view_spec.rb+++ b/spec/lib/topic_view_spec.rb@@ -948,11 +948,13 @@ RSpec.describe TopicView docontext "with uncategorized topic" docontext "when topic_page_title_includes_category is false" dobefore { SiteSetting.topic_page_title_includes_category = false }+it { is_expected.to eq(topic.title) }endcontext "when topic_page_title_includes_category is true" dobefore { SiteSetting.topic_page_title_includes_category = true }+it { is_expected.to eq(topic.title) }context "with tagged topic" do@@ -1024,11 +1026,13 @@ RSpec.describe TopicView docontext "when topic_page_title_includes_category is false" dobefore { SiteSetting.topic_page_title_includes_category = false }+it { is_expected.to eq(topic.title) }endcontext "when topic_page_title_includes_category is true" dobefore { SiteSetting.topic_page_title_includes_category = true }+it { is_expected.to start_with(topic.title) }it { is_expected.to end_with(category.name) }diff --git a/spec/lib/topics_filter_spec.rb b/spec/lib/topics_filter_spec.rbindex 11fef873a62..4d564226f70 100644--- a/spec/lib/topics_filter_spec.rb+++ b/spec/lib/topics_filter_spec.rb@@ -7,6 +7,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" doexpect(options).to be_an(Array)expect(options).to all(be_a(Hash))@@ -344,6 +345,7 @@ RSpec.describe TopicsFilter do).to start_with(t1.id, t2.id)endend+describe "when filtering with multiple filters" dofab!(:tag) { Fabricate(:tag, name: "tag1") }fab!(:tag2) { Fabricate(:tag, name: "tag2") }@@ -411,6 +413,7 @@ RSpec.describe TopicsFilter do)endend+before { user_for_new_filters.user_option.update!(new_topic_duration_minutes: 1.day.ago) }it "in:new-topics returns only new topics" do@@ -1654,6 +1657,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" doexpect(TopicsFilterdiff --git a/spec/lib/upload_creator_spec.rb b/spec/lib/upload_creator_spec.rbindex 5f0024d3a59..c9af39f403b 100644--- a/spec/lib/upload_creator_spec.rb+++ b/spec/lib/upload_creator_spec.rb@@ -755,6 +755,7 @@ RSpec.describe UploadCreator docontext "if type of upload is in the composer" dolet(:opts) { { type: "composer" } }+it "sets the upload to secure and sets the original_sha1 column, because we don't know the context of the composer" doexpect(result.secure).to eq(true)expect(result.original_sha1).not_to eq(nil)@@ -763,6 +764,7 @@ RSpec.describe UploadCreator docontext "if the upload is for a PM" dolet(:opts) { { for_private_message: true } }+it "sets the upload to secure and sets the original_sha1" doexpect(result.secure).to eq(true)expect(result.original_sha1).not_to eq(nil)@@ -771,6 +773,7 @@ RSpec.describe UploadCreator docontext "if the upload is for a group message" dolet(:opts) { { for_group_message: true } }+it "sets the upload to secure and sets the original_sha1" doexpect(result.secure).to eq(true)expect(result.original_sha1).not_to eq(nil)@@ -779,6 +782,7 @@ RSpec.describe UploadCreator docontext "if SiteSetting.login_required" dobefore { SiteSetting.login_required = true }+it "sets the upload to secure and sets the original_sha1" doexpect(result.secure).to eq(true)expect(result.original_sha1).not_to eq(nil)diff --git a/spec/lib/upload_security_spec.rb b/spec/lib/upload_security_spec.rbindex 42ffbda4cd2..658d4997ad1 100644--- a/spec/lib/upload_security_spec.rb+++ b/spec/lib/upload_security_spec.rb@@ -39,6 +39,7 @@ RSpec.describe UploadSecurity docontext "when uploading in public context" dodescribe "for a public type badge_image" dolet(:type) { "badge_image" }+it "returns false" doexpect(security.should_be_secure?).to eq(false)end@@ -46,6 +47,7 @@ RSpec.describe UploadSecurity dodescribe "for a public type group_flair" dolet(:type) { "group_flair" }+it "returns false" doexpect(security.should_be_secure?).to eq(false)end@@ -53,6 +55,7 @@ RSpec.describe UploadSecurity dodescribe "for a public type avatar" dolet(:type) { "avatar" }+it "returns false" doexpect(security.should_be_secure?).to eq(false)end@@ -60,6 +63,7 @@ RSpec.describe UploadSecurity dodescribe "for a public type custom_emoji" dolet(:type) { "custom_emoji" }+it "returns false" doexpect(security.should_be_secure?).to eq(false)end@@ -67,6 +71,7 @@ RSpec.describe UploadSecurity dodescribe "for a public type profile_background" dolet(:type) { "profile_background" }+it "returns false" doexpect(security.should_be_secure?).to eq(false)end@@ -74,6 +79,7 @@ RSpec.describe UploadSecurity dodescribe "for a public type category_logo" dolet(:type) { "category_logo" }+it "returns false" doexpect(security.should_be_secure?).to eq(false)end@@ -81,6 +87,7 @@ RSpec.describe UploadSecurity dodescribe "for a public type category_background" dolet(:type) { "category_background" }+it "returns false" doexpect(security.should_be_secure?).to eq(false)end@@ -155,6 +162,7 @@ RSpec.describe UploadSecurity docontext "when uploading in the composer" dolet(:type) { "composer" }+it "returns true" doexpect(security.should_be_secure?).to eq(true)end@@ -162,6 +170,7 @@ RSpec.describe UploadSecurity docontext "when uploading for a group message" dobefore { upload.stubs(:for_group_message).returns(true) }+it "returns true" doexpect(security.should_be_secure?).to eq(true)end@@ -169,6 +178,7 @@ RSpec.describe UploadSecurity docontext "when uploading for a PM" dobefore { upload.stubs(:for_private_message).returns(true) }+it "returns true" doexpect(security.should_be_secure?).to eq(true)end@@ -176,6 +186,7 @@ RSpec.describe UploadSecurity docontext "when upload is already secure" dobefore { upload.update(secure: true) }+it "returns true" doexpect(security.should_be_secure?).to eq(true)end@@ -186,6 +197,7 @@ RSpec.describe UploadSecurity docontext "when the access control post has_secure_uploads?" dobefore { upload.update(access_control_post: post_in_secure_context) }+it "returns true" doexpect(security.should_be_secure?).to eq(true)enddiff --git a/spec/lib/validators/post_validator_spec.rb b/spec/lib/validators/post_validator_spec.rbindex 90a20ad70f5..3bc1490255c 100644--- a/spec/lib/validators/post_validator_spec.rb+++ b/spec/lib/validators/post_validator_spec.rb@@ -525,6 +525,7 @@ RSpec.describe PostValidator dodescribe "staged user" dobefore { post.acting_user = build(:user, staged: true) }+include_examples "almost no validations"endenddiff --git a/spec/lib/validators/quality_title_validator_spec.rb b/spec/lib/validators/quality_title_validator_spec.rbindex 6525be4853a..6e8cee742f6 100644--- a/spec/lib/validators/quality_title_validator_spec.rb+++ b/spec/lib/validators/quality_title_validator_spec.rb@@ -10,6 +10,7 @@ RSpec.describe QualityTitleValidator dolet(:meaningless_title) { "asdf asdf asdf asdf" }let(:loud_title) { "ALL CAPS INVALID TITLE" }let(:pretentious_title) { "superverylongwordintitlefornoparticularreason" }+fab!(:topic) { Fabricate(:post).topic }before { SiteSetting.title_prettify = false }diff --git a/spec/lib/validators/user_password_validator_spec.rb b/spec/lib/validators/user_password_validator_spec.rbindex 24d0259d5ac..fd4b1216d57 100644--- a/spec/lib/validators/user_password_validator_spec.rb+++ b/spec/lib/validators/user_password_validator_spec.rb@@ -52,6 +52,7 @@ RSpec.describe UserPasswordValidator doendendend+context "when password is commonly used" dobefore doSiteSetting.min_password_length = 8diff --git a/spec/lib/version_compatibility_spec.rb b/spec/lib/version_compatibility_spec.rbindex 2fce90d6247..0ecd6cee2e6 100644--- a/spec/lib/version_compatibility_spec.rb+++ b/spec/lib/version_compatibility_spec.rb@@ -98,6 +98,7 @@ RSpec.describe Discourse do2.4.4.beta6: twofourfourbetasix2.4.2.beta1: twofourtwobetaoneYML+include_examples "test compatible resource"end@@ -109,6 +110,7 @@ RSpec.describe Discourse do2.5.0.beta2: twofivebetatwo2.4.4.beta6: twofourfourbetasixYML+include_examples "test compatible resource"enddiff --git a/spec/mailers/invite_mailer_spec.rb b/spec/mailers/invite_mailer_spec.rbindex b8beca16486..a47ae78fd28 100644--- a/spec/mailers/invite_mailer_spec.rb+++ b/spec/mailers/invite_mailer_spec.rb@@ -80,6 +80,7 @@ RSpec.describe InviteMailer dofab!(:invite)let(:plugin) { Plugin::Instance.new }let(:custom_template) { "plugin_custom_invite_template" }+before doI18n.backend.store_translations(:en,diff --git a/spec/mailers/user_notifications_spec.rb b/spec/mailers/user_notifications_spec.rbindex 3069521f7d7..af18031a1f4 100644--- a/spec/mailers/user_notifications_spec.rb+++ b/spec/mailers/user_notifications_spec.rb@@ -1324,6 +1324,7 @@ RSpec.describe UserNotifications dodescribe "user mentioned email" doinclude_examples "notification email building" dolet(:notification_type) { :mentioned }+include_examples "respect for private_email"include_examples "supports reply by email"include_examples "sets user locale"@@ -1347,6 +1348,7 @@ RSpec.describe UserNotifications dodescribe "user replied" doinclude_examples "notification email building" dolet(:notification_type) { :replied }+include_examples "respect for private_email"include_examples "supports reply by email"include_examples "sets user locale"@@ -1356,6 +1358,7 @@ RSpec.describe UserNotifications dodescribe "user quoted" doinclude_examples "notification email building" dolet(:notification_type) { :quoted }+include_examples "respect for private_email"include_examples "supports reply by email"include_examples "sets user locale"@@ -1365,6 +1368,7 @@ RSpec.describe UserNotifications dodescribe "user posted" doinclude_examples "notification email building" dolet(:notification_type) { :posted }+include_examples "respect for private_email"include_examples "supports reply by email"include_examples "sets user locale"@@ -1465,6 +1469,7 @@ RSpec.describe UserNotifications dodescribe "watching first post" doinclude_examples "notification email building" dolet(:notification_type) { :invited_to_topic }+include_examples "respect for private_email"include_examples "no reply by email"include_examples "sets user locale"@@ -1570,6 +1575,7 @@ RSpec.describe UserNotifications doinclude_examples "with notification derived from template" dolet(:locale) { "fr" }let(:mail_type) { mail_type }+it "sets the locale" doexpects_build_with(has_entry(:locale, "fr"))end@@ -1593,6 +1599,7 @@ RSpec.describe UserNotifications doinclude_examples "with notification derived from template" dolet(:locale) { "fr" }let(:mail_type) { mail_type }+it "sets the locale" doexpects_build_with(has_entry(:locale, "en"))enddiff --git a/spec/models/badge_spec.rb b/spec/models/badge_spec.rbindex b02072d4c20..7cac8fdfcbf 100644--- a/spec/models/badge_spec.rb+++ b/spec/models/badge_spec.rb@@ -83,16 +83,19 @@ RSpec.describe Badge docontext "when system badge" dobefore { badge.system = true }+it { is_expected.to be false }endcontext "when has query" dobefore { badge.query = "SELECT id FROM users" }+it { is_expected.to be true }endcontext "when not a system badge" dobefore { badge.update_columns(system: false) }+it { is_expected.to be true }endend@@ -164,6 +167,7 @@ RSpec.describe Badge docontext "when a translation key not for a badge is provided" dolet(:translation_key) { "reports.flags.title" }+it "returns nil" doexpect(Badge.find_system_badge_id_from_translation_key(translation_key)).to eq(nil)enddiff --git a/spec/models/category_spec.rb b/spec/models/category_spec.rbindex 196c402b3bf..d93f37620f7 100644--- a/spec/models/category_spec.rb+++ b/spec/models/category_spec.rb@@ -759,6 +759,7 @@ RSpec.describe Category dolet(:new_category) doFabricate(:category_with_definition, name: "2nd Category", user: category.user)end+before dotopic.change_category_to_id(new_category.id)topic.reload@@ -1507,6 +1508,7 @@ RSpec.describe Category dodescribe "#cannot_delete_reason" dofab!(:admin)let(:guardian) { Guardian.new(admin) }+fab!(:category)describe "when category is uncategorized" do@@ -1637,6 +1639,7 @@ RSpec.describe Category dodescribe "allowed_tags=" dolet(:category) { Fabricate(:category) }+fab!(:tag)fab!(:tag2, :tag)diff --git a/spec/models/category_user_spec.rb b/spec/models/category_user_spec.rbindex 6428eb8df95..16e9aafad39 100644--- a/spec/models/category_user_spec.rb+++ b/spec/models/category_user_spec.rb@@ -348,6 +348,7 @@ RSpec.describe CategoryUser docontext "for anon" dolet(:user) { nil }+before doSiteSetting.default_categories_watching = category1.id.to_sSiteSetting.default_categories_tracking = category2.id.to_s@@ -355,6 +356,7 @@ RSpec.describe CategoryUser doSiteSetting.default_categories_normal = category4.id.to_sSiteSetting.default_categories_muted = category5.id.to_send+it "every category from the default_categories_* site settings get overridden to regular, except for muted" dolevels = CategoryUser.notification_levels_for(user)expect(levels[category1.id]).to eq(CategoryUser.notification_levels[:regular])@@ -393,6 +395,7 @@ RSpec.describe CategoryUser donotification_level: CategoryUser.notification_levels[:muted],)end+it "gets the category_user notification levels for all categories the user is tracking and does notinclude categories the user is not tracking at all" docategory6 = Fabricate(:category)@@ -462,6 +465,7 @@ RSpec.describe CategoryUser docategory2category3end+it "calculates muted categories based on parent category state" doexpect(CategoryUser.indirectly_muted_category_ids(user)).to eq([])diff --git a/spec/models/email_log_spec.rb b/spec/models/email_log_spec.rbindex c3631362769..90f738aeace 100644--- a/spec/models/email_log_spec.rb+++ b/spec/models/email_log_spec.rb@@ -161,6 +161,7 @@ RSpec.describe EmailLog dodescribe ".addressed_to_user scope" dolet(:user) { Fabricate(:user, email: "[email protected]") }+before doFabricate(:email_log, to_address: "[email protected]")Fabricate(:email_log, cc_addresses: "[email protected];[email protected]")diff --git a/spec/models/invite_spec.rb b/spec/models/invite_spec.rbindex 66fe00b2c1a..929126fe9b0 100644--- a/spec/models/invite_spec.rb+++ b/spec/models/invite_spec.rb@@ -472,6 +472,7 @@ RSpec.describe Invite douser = invite.redeemexpect(user.groups).to contain_exactly(group)end+it "should not raise error when both group & site tag preferences same" dotag = Fabricate(:tag)group.tracking_tags = [tag.name]diff --git a/spec/models/optimized_image_spec.rb b/spec/models/optimized_image_spec.rbindex 4d4e9bbd228..4884f0fdcff 100644--- a/spec/models/optimized_image_spec.rb+++ b/spec/models/optimized_image_spec.rb@@ -4,6 +4,7 @@ require "chunky_png"RSpec.describe OptimizedImage dolet(:upload) { build(:upload) }+before { upload.id = 42 }describe ".crop" do@@ -303,6 +304,7 @@ RSpec.describe OptimizedImage docontext "when using an internal store" dolet(:store) { FakeInternalStore.new }+before { Discourse.stubs(:store).returns(store) }context "when an error happened while generating the thumbnail" dodiff --git a/spec/models/post_action_spec.rb b/spec/models/post_action_spec.rbindex 8b7a2efd962..ba94ec4e6d6 100644--- a/spec/models/post_action_spec.rb+++ b/spec/models/post_action_spec.rb@@ -601,6 +601,7 @@ RSpec.describe PostAction dopost.reloadexpect(post.hidden).to eq(true)end+it "hide tl0 posts that are flagged as spam by a tl3 user" donewuser = Fabricate(:newuser, refresh_auto_groups: true)post = create_post(user: newuser)diff --git a/spec/models/post_mover_spec.rb b/spec/models/post_mover_spec.rbindex 72253a1f5f2..c3d09598870 100644--- a/spec/models/post_mover_spec.rb+++ b/spec/models/post_mover_spec.rb@@ -2998,6 +2998,7 @@ RSpec.describe PostMover dofab!(:user)before { SiteSetting.delete_merged_stub_topics_after_days = 0 }+let(:modifier_block) doProc.new do |is_currently_allowed_to_delete, topic, who_is_merging|expect(is_currently_allowed_to_delete).to eq(false)@@ -3005,6 +3006,7 @@ RSpec.describe PostMover douser.id == who_is_merging.idendend+it "lets user merge topics immediately" doplugin_instance = Plugin::Instance.newplugin_instance.register_modifier(:is_allowed_to_delete_after_merge, &modifier_block)@@ -3208,6 +3210,7 @@ RSpec.describe PostMover dofab!(:user)before { SiteSetting.delete_merged_stub_topics_after_days = 0 }+let(:modifier_block) { Proc.new { |continue, _| false } }it "does not create small action post when modifier returns false" dodiff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rbindex 56f020585b7..0dd656fc7e9 100644--- a/spec/models/post_spec.rb+++ b/spec/models/post_spec.rb@@ -121,6 +121,7 @@ RSpec.describe Post docontext "with a post with links" dolet(:post) { Fabricate(:post_with_external_links) }+before dopost.trash!post.reload@@ -185,6 +186,7 @@ RSpec.describe Post docontext "if the topic category is read_restricted" dolet(:category) { Fabricate(:private_category, group: Fabricate(:group)) }+before { topic.change_category_to_id(category.id) }it "returns true" do@@ -1010,6 +1012,7 @@ RSpec.describe Post dolet!(:p1) { Fabricate(:post, post_args.merge(score: 4, percent_rank: 0.33)) }let!(:p2) { Fabricate(:post, post_args.merge(score: 10, percent_rank: 0.66)) }let!(:p3) { Fabricate(:post, post_args.merge(score: 5, percent_rank: 0.99)) }+fab!(:p4) { Fabricate(:post, percent_rank: 0.99) }it "returns the OP and posts above the threshold in summary mode" do@@ -2019,6 +2022,7 @@ RSpec.describe Post docontext "for custom emoji" dobefore { CustomEmoji.create(name: "meme", upload: image_upload) }+it "never sets an access control post because they should not be secure" dopost.link_post_uploadsexpect(image_upload.reload.access_control_post_id).to eq(nil)diff --git a/spec/models/reviewable_note_spec.rb b/spec/models/reviewable_note_spec.rbindex a7a498c74a4..84bf67d8078 100644--- a/spec/models/reviewable_note_spec.rb+++ b/spec/models/reviewable_note_spec.rb@@ -15,11 +15,13 @@ RSpec.describe ReviewableNote dosubject { build(:reviewable_note, reviewable: reviewable, user: admin) }it { is_expected.to validate_presence_of(:content) }+it dois_expected.to validate_length_of(:content).is_at_least(1).is_at_most(ReviewableNote::MAX_CONTENT_LENGTH,)end+it { is_expected.to validate_presence_of(:reviewable_id) }it { is_expected.to validate_presence_of(:user_id) }diff --git a/spec/models/reviewable_spec.rb b/spec/models/reviewable_spec.rbindex ab7a5fa3490..615a4948823 100644--- a/spec/models/reviewable_spec.rb+++ b/spec/models/reviewable_spec.rb@@ -309,6 +309,7 @@ RSpec.describe Reviewable, type: :model dofab!(:category) { Fabricate(:category, read_restricted: true) }let(:topic) { Fabricate(:topic, category: category) }let(:post) { Fabricate(:post, topic: topic) }+fab!(:moderator)fab!(:admin)diff --git a/spec/models/reviewable_user_spec.rb b/spec/models/reviewable_user_spec.rbindex e09be046cb8..cdb0e86caac 100644--- a/spec/models/reviewable_user_spec.rb+++ b/spec/models/reviewable_user_spec.rb@@ -7,6 +7,7 @@ RSpec.describe ReviewableUser, type: :model douser.activateuserend+fab!(:admin)describe "#actions_for" dodiff --git a/spec/models/screened_email_spec.rb b/spec/models/screened_email_spec.rbindex 479df6b19bb..d890f7d4c6a 100644--- a/spec/models/screened_email_spec.rb+++ b/spec/models/screened_email_spec.rb@@ -96,7 +96,9 @@ RSpec.describe ScreenedEmail dolet!(:screened_email) doFabricate(:screened_email, email: email, action_type: ScreenedEmail.actions[:block])end+it { is_expected.to eq(true) }+include_examples "when a ScreenedEmail record matches"end@@ -104,7 +106,9 @@ RSpec.describe ScreenedEmail dolet!(:screened_email) doFabricate(:screened_email, email: email, action_type: ScreenedEmail.actions[:do_nothing])end+it { is_expected.to eq(false) }+include_examples "when a ScreenedEmail record matches"endenddiff --git a/spec/models/screened_ip_address_spec.rb b/spec/models/screened_ip_address_spec.rbindex faad7ed2b40..0dae714f128 100644--- a/spec/models/screened_ip_address_spec.rb+++ b/spec/models/screened_ip_address_spec.rb@@ -154,6 +154,7 @@ RSpec.describe ScreenedIpAddress docontext "when using exact match" dofab!(:existing, :screened_ip_address)let(:ip_address_arg) { existing.ip_address }+include_examples "exact match of ip address"end@@ -162,11 +163,13 @@ RSpec.describe ScreenedIpAddress docontext "with exact address" dolet(:ip_address_arg) { "99.232.23.124" }+include_examples "exact match of ip address"endcontext "with address in same subnet" dolet(:ip_address_arg) { "99.232.23.135" }+include_examples "exact match of ip address"endenddiff --git a/spec/models/site_setting_spec.rb b/spec/models/site_setting_spec.rbindex 2574f484343..fbafd07bf5e 100644--- a/spec/models/site_setting_spec.rb+++ b/spec/models/site_setting_spec.rb@@ -406,6 +406,7 @@ RSpec.describe SiteSetting dodescribe "creating upload references for type objects settings with upload fields" dolet(:provider) { SiteSettings::DbProvider.new(SiteSetting) }+fab!(:upload)fab!(:upload2, :upload)diff --git a/spec/models/tag_group_spec.rb b/spec/models/tag_group_spec.rbindex 9e2bb809961..4666a83efb6 100644--- a/spec/models/tag_group_spec.rb+++ b/spec/models/tag_group_spec.rb@@ -163,6 +163,7 @@ RSpec.describe TagGroup dodescribe "tag_names=" dolet(:tag_group) { Fabricate(:tag_group) }+fab!(:tag)before { SiteSetting.tagging_enabled = true }diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rbindex d7f74044b48..774d1174480 100644--- a/spec/models/tag_spec.rb+++ b/spec/models/tag_spec.rb@@ -4,6 +4,7 @@ RSpec.describe Tag dolet(:tag) { Fabricate(:tag) }let(:tag2) { Fabricate(:tag) }let(:topic) { Fabricate(:topic, tags: [tag]) }+fab!(:user)before dodiff --git a/spec/models/tag_user_spec.rb b/spec/models/tag_user_spec.rbindex 951d658a83d..4ac4cb43aaa 100644--- a/spec/models/tag_user_spec.rb+++ b/spec/models/tag_user_spec.rb@@ -189,6 +189,7 @@ RSpec.describe TagUser dofab!(:user) { Fabricate(:user, refresh_auto_groups: true) }fab!(:watched_tag, :tag)let(:muted_tag) { Fabricate(:tag) }+fab!(:tracked_tag, :tag)context "with some tag notification settings" do@@ -418,12 +419,14 @@ RSpec.describe TagUser docontext "for anon" dolet(:user) { nil }+before doSiteSetting.default_tags_watching = tag1.nameSiteSetting.default_tags_tracking = tag2.nameSiteSetting.default_tags_watching_first_post = tag3.nameSiteSetting.default_tags_muted = tag4.nameend+it "every tag from the default_tags_* site settings get overridden to watching_first_post, except for muted" dolevels = TagUser.notification_levels_for(user)expect(levels[tag1.id][:level]).to eq(TagUser.notification_levels[:regular])@@ -435,6 +438,7 @@ RSpec.describe TagUser docontext "for a user" dolet(:user) { Fabricate(:user) }+before doTagUser.create(user: user,diff --git a/spec/models/topic_embed_spec.rb b/spec/models/topic_embed_spec.rbindex 171449e3d04..42ee9d76652 100644--- a/spec/models/topic_embed_spec.rb+++ b/spec/models/topic_embed_spec.rb@@ -14,6 +14,7 @@ RSpec.describe TopicEmbed dolet(:contents) do"<p>hello world new post <a href='/hello'>hello</a> <img src='images/wat.jpg'></p>"end+fab!(:embeddable_host)fab!(:category)fab!(:tag)@@ -913,6 +914,7 @@ RSpec.describe TopicEmbed dolet(:title) { "How to turn a fish from good to evil in 30 seconds" }let(:url) { "http://eviltrout.com/123" }let(:contents) { "<p>hello world new post :D</p>" }+fab!(:embeddable_host)fab!(:category)fab!(:tag)diff --git a/spec/models/topic_link_spec.rb b/spec/models/topic_link_spec.rbindex 2d1558f8378..8d6ae783ff6 100644--- a/spec/models/topic_link_spec.rb+++ b/spec/models/topic_link_spec.rb@@ -2,6 +2,7 @@RSpec.describe TopicLink dolet(:test_uri) { URI.parse(Discourse.base_url) }+fab!(:user) { Fabricate(:user, refresh_auto_groups: true) }fab!(:topic) { Fabricate(:topic, user: user, title: "unique topic name") }fab!(:post)diff --git a/spec/models/topic_spec.rb b/spec/models/topic_spec.rbindex 5838aaa5e00..c853ef70bd9 100644--- a/spec/models/topic_spec.rb+++ b/spec/models/topic_spec.rb@@ -2,6 +2,7 @@RSpec.describe Topic dolet(:now) { Time.zone.local(2013, 11, 20, 8, 0) }+fab!(:user) { Fabricate(:user, refresh_auto_groups: true) }fab!(:user1) { Fabricate(:user, refresh_auto_groups: true) }fab!(:whisperers_group, :group)@@ -1739,6 +1740,7 @@ RSpec.describe Topic docontext "when closed" dolet(:status) { "closed" }+it_behaves_like "a status that closes a topic"it "should archive group message" do@@ -1760,6 +1762,7 @@ RSpec.describe Topic docontext "when autoclosed" dolet(:status) { "autoclosed" }+it_behaves_like "a status that closes a topic"context "when topic was set to close when it was created" do@@ -2229,6 +2232,7 @@ RSpec.describe Topic dodescribe "tracking state notifications" dobefore { SiteSetting.experimental_topic_category_change_notification = true }+it "publishes category change when moving to a restricted category" dorestricted_category =Fabricate(:category_with_definition, read_restricted: true, user: user)@@ -3306,6 +3310,7 @@ RSpec.describe Topic dodescribe "featured link" dobefore { SiteSetting.topic_featured_link_enabled = true }+fab!(:topic)it "can validate featured link" dodiff --git a/spec/models/translation_override_spec.rb b/spec/models/translation_override_spec.rbindex 868cb2d7e81..0210f77c9b0 100644--- a/spec/models/translation_override_spec.rb+++ b/spec/models/translation_override_spec.rb@@ -160,11 +160,13 @@ RSpec.describe TranslationOverride do"This has {COUNT, plural, one{one member} other{# members}}.",).for(:value).against(:base)end+it dois_expected.not_to allow_value("This has {COUNT, plural, one{one member} many{# members} other{# members}}.",).for(:value).with_message(/plural case many is not valid/, against: :base)end+it dois_expected.not_to allow_value("This has {COUNT, ").for(:value).with_message(/invalid syntax/,diff --git a/spec/models/upload_reference_spec.rb b/spec/models/upload_reference_spec.rbindex 29fce4dac3d..c529d41e0f1 100644--- a/spec/models/upload_reference_spec.rb+++ b/spec/models/upload_reference_spec.rb@@ -94,6 +94,7 @@ RSpec.describe UploadReference dodescribe "site setting uploads" dolet(:provider) { SiteSettings::DbProvider.new(SiteSetting) }+fab!(:upload)fab!(:upload2, :upload)diff --git a/spec/models/user_avatar_spec.rb b/spec/models/user_avatar_spec.rbindex 88f5ed46afd..9de7854265d 100644--- a/spec/models/user_avatar_spec.rb+++ b/spec/models/user_avatar_spec.rb@@ -6,6 +6,7 @@ RSpec.describe UserAvatar dodescribe "#update_gravatar!" dolet(:temp) { Tempfile.new("test") }+fab!(:upload) { Fabricate(:upload, user: user) }describe "when working" dodiff --git a/spec/models/user_password_spec.rb b/spec/models/user_password_spec.rbindex 0db6be80805..ae015adaf59 100644--- a/spec/models/user_password_spec.rb+++ b/spec/models/user_password_spec.rb@@ -3,6 +3,7 @@RSpec.describe UserPassword dodescribe "#ensure_password_is_hashed" dolet(:password) { SecureRandom.hex }+fab!(:user_password)it "ensures password_hash, password_salt, password_algorithm are saved correctly" dodiff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rbindex 0348716c93d..e594f4da202 100644--- a/spec/models/user_spec.rb+++ b/spec/models/user_spec.rb@@ -376,6 +376,7 @@ RSpec.describe User dodescribe "#user_fields" dofab!(:user_field) { Fabricate(:user_field, show_on_profile: true) }let(:user_field_value) { user.reload.user_fields[user_field.id.to_s] }+fab!(:watched_word) { Fabricate(:watched_word, word: "bad") }before { user.set_user_field(user_field.id, value) }@@ -397,6 +398,7 @@ RSpec.describe User doit { is_expected.to be_valid }end+context "when SiteSetting.disable_watched_word_checking_in_user_fields is true" dobefore { SiteSetting.disable_watched_word_checking_in_user_fields = true }@@ -452,6 +454,7 @@ RSpec.describe User douser.save!expect(user_field_value).to eq "word replaced"end+context "when SiteSetting.disable_watched_word_checking_in_user_fields is true" dobefore { SiteSetting.disable_watched_word_checking_in_user_fields = true }@@ -530,6 +533,7 @@ RSpec.describe User docontext "with a censored word" dolet(:value) { %w[Axe bad Sword] }+before { watched_word.action = WatchedWord.actions[:censor] }it "does not censor the word since it is not user generated-content" do@@ -555,6 +559,7 @@ RSpec.describe User docontext "with a censored word" dolet(:value) { true }+before { watched_word.action = WatchedWord.actions[:censor] }it "does not censor the word since it is not user generated-content" do@@ -588,6 +593,7 @@ RSpec.describe User doFabricate(:user, created_at: 2.days.ago)Fabricate(:user, created_at: 4.days.ago)end+let(:signups_by_day) do{ 1.day.ago.to_date => 2, 2.days.ago.to_date => 1, Time.now.utc.to_date => 1 }end@@ -664,6 +670,7 @@ RSpec.describe User dodescribe "reviewable" dolet(:user) { Fabricate(:user, active: false) }+fab!(:admin)before { Jobs.run_immediately! }@@ -767,6 +774,7 @@ RSpec.describe User dofab!(:posts) { [post1, post2, post3] }fab!(:post_ids) { [post1.id, post2.id, post3.id] }let(:guardian) { Guardian.new(Fabricate(:admin)) }+fab!(:reviewable_queued_post) { Fabricate(:reviewable_queued_post, target_created_by: user) }it "deletes only one batch of posts" do@@ -1502,6 +1510,7 @@ RSpec.describe User docontext "if timezone is provided" docontext "if the timezone is valid" dolet(:timezone) { "Australia/Melbourne" }+context "if no timezone exists on user option" doit "sets the timezone for the user" douser.update_timezone_if_missing(timezone)@@ -1512,6 +1521,7 @@ RSpec.describe User docontext "if the timezone is not valid" dolet(:timezone) { "Jupiter" }+context "if no timezone exists on user option" doit "does not set the timezone for the user" douser.update_timezone_if_missing(timezone)@@ -1717,11 +1727,13 @@ RSpec.describe User doexpect(Fabricate(:user, username: "foo", name: nil).readable_name).to eq("foo")endend+context "when name and username are identical" doit "returns just the username" doexpect(Fabricate(:user, username: "foo", name: "foo").readable_name).to eq("foo")endend+context "when name and username are not identical" doit "returns the name and username" doexpect(Fabricate(:user, username: "foo", name: "Bar Baz").readable_name).to eq(@@ -2049,6 +2061,7 @@ RSpec.describe User docontext "with a UserVisit record" dofab!(:user)let!(:now) { Time.zone.now }+before { user.update_last_seen!(now) }after { reset_last_seen_cache!(user) }@@ -3093,6 +3106,7 @@ RSpec.describe User dodescribe "#email=" dolet(:new_email) { "[email protected]" }+it "sets the primary email" douser.update!(email: new_email)expect(User.find(user.id).email).to eq(new_email)@@ -3456,6 +3470,7 @@ RSpec.describe User dodescribe "#create_or_fetch_secure_identifier" docontext "if the user already has a secure identifier" dolet(:sec_ident) { SecureRandom.hex(20) }+before { user.update(secure_identifier: sec_ident) }it "returns the identifier" dodiff --git a/spec/models/user_stat_spec.rb b/spec/models/user_stat_spec.rbindex 58a5ce7732a..649958337c4 100644--- a/spec/models/user_stat_spec.rb+++ b/spec/models/user_stat_spec.rb@@ -218,6 +218,7 @@ RSpec.describe UserStat dodescribe ".update_distinct_badge_count" dofab!(:user)let(:stat) { user.user_stat }+fab!(:badge1, :badge)fab!(:badge2, :badge)diff --git a/spec/models/user_visit_spec.rb b/spec/models/user_visit_spec.rbindex 475f87b339b..f9347358888 100644--- a/spec/models/user_visit_spec.rb+++ b/spec/models/user_visit_spec.rb@@ -30,6 +30,7 @@ RSpec.describe UserVisit douser.user_visits.create(visited_at: 2.days.ago)user.user_visits.create(visited_at: 4.days.ago)end+let(:visits_by_day) do{ 1.day.ago.to_date => 2, 2.days.ago.to_date => 1, Time.zone.now.to_date => 1 }enddiff --git a/spec/models/watched_word_group_spec.rb b/spec/models/watched_word_group_spec.rbindex 4b106a347fe..63e0c0eab5e 100644--- a/spec/models/watched_word_group_spec.rb+++ b/spec/models/watched_word_group_spec.rb@@ -3,6 +3,7 @@RSpec.describe WatchedWordGroup dofab!(:watched_word_group)let!(:watched_word_1) { watched_word_group.watched_words.first }+fab!(:watched_word_2) { Fabricate(:watched_word, watched_word_group_id: watched_word_group.id) }describe "#create_or_update_members" dodiff --git a/spec/requests/admin/config/fonts_controller_spec.rb b/spec/requests/admin/config/fonts_controller_spec.rbindex 35199dd183b..7770eff4043 100644--- a/spec/requests/admin/config/fonts_controller_spec.rb+++ b/spec/requests/admin/config/fonts_controller_spec.rb@@ -8,6 +8,7 @@ RSpec.describe Admin::Config::FontsController dodescribe "#fonts" docontext "when logged in as an admin" dobefore { sign_in(admin) }+it "updates the fonts and text size" doput "/admin/config/fonts.json",params: {@@ -38,6 +39,7 @@ RSpec.describe Admin::Config::FontsController docontext "when logged in as a moderator" dobefore { sign_in(moderator) }+it "denies access with a 403 response" doput "/admin/config/fonts.json",params: {diff --git a/spec/requests/admin/dashboard_controller_spec.rb b/spec/requests/admin/dashboard_controller_spec.rbindex 715fdf8ea12..28efbf73ea1 100644--- a/spec/requests/admin/dashboard_controller_spec.rb+++ b/spec/requests/admin/dashboard_controller_spec.rb@@ -981,6 +981,7 @@ RSpec.describe Admin::DashboardController docontext "when logged in as an admin" dobefore { sign_in(admin) }+context "when there are no problems" doit "returns an empty array" dopost "/admin/dashboard/problems.json"diff --git a/spec/requests/admin/emojis_controller_spec.rb b/spec/requests/admin/emojis_controller_spec.rbindex 6f503e5f566..c45f145576e 100644--- a/spec/requests/admin/emojis_controller_spec.rb+++ b/spec/requests/admin/emojis_controller_spec.rb@@ -305,11 +305,13 @@ RSpec.describe Admin::EmojiController docontext "when logged in as a moderator" dobefore { sign_in(moderator) }+include_examples "export not allowed"endcontext "when logged in as a non-staff user" dobefore { sign_in(user) }+include_examples "export not allowed"endend@@ -446,11 +448,13 @@ RSpec.describe Admin::EmojiController docontext "when logged in as a moderator" dobefore { sign_in(moderator) }+include_examples "import preview not allowed"endcontext "when logged in as a non-staff user" dobefore { sign_in(user) }+include_examples "import preview not allowed"endend@@ -602,11 +606,13 @@ RSpec.describe Admin::EmojiController docontext "when logged in as a moderator" dobefore { sign_in(moderator) }+include_examples "import confirm not allowed"endcontext "when logged in as a non-staff user" dobefore { sign_in(user) }+include_examples "import confirm not allowed"endenddiff --git a/spec/requests/admin/form_templates_controller_spec.rb b/spec/requests/admin/form_templates_controller_spec.rbindex 3d91ab7f568..c19fcd06771 100644--- a/spec/requests/admin/form_templates_controller_spec.rb+++ b/spec/requests/admin/form_templates_controller_spec.rb@@ -151,6 +151,7 @@ RSpec.describe Admin::FormTemplatesController docontext "when logged in as a non-admin user" dobefore { sign_in(user) }+it "prevents deletion with a 404 response" doexpect dodelete "/admin/customize/form-templates/#{form_template.id}.json"diff --git a/spec/requests/admin/staff_action_logs_controller_spec.rb b/spec/requests/admin/staff_action_logs_controller_spec.rbindex c55a09977b9..32c8ac7944f 100644--- a/spec/requests/admin/staff_action_logs_controller_spec.rb+++ b/spec/requests/admin/staff_action_logs_controller_spec.rb@@ -164,6 +164,7 @@ RSpec.describe Admin::StaffActionLogsController docontext "when staff actions are extended" dolet(:plugin_extended_action) { :confirmed_ham }+before { UserHistory.stubs(:staff_actions).returns([plugin_extended_action]) }after { UserHistory.unstub(:staff_actions) }diff --git a/spec/requests/admin/unknown_reviewables_controller_spec.rb b/spec/requests/admin/unknown_reviewables_controller_spec.rbindex 8765ea1ec42..f8f82583542 100644--- a/spec/requests/admin/unknown_reviewables_controller_spec.rb+++ b/spec/requests/admin/unknown_reviewables_controller_spec.rb@@ -3,6 +3,7 @@RSpec.describe Admin::UnknownReviewablesController dolet(:admin) { Fabricate(:admin) }let(:user) { Fabricate(:user) }+fab!(:reviewable)fab!(:unknown_reviewable) { Fabricate(:reviewable, type: "ReviewablePost") }diff --git a/spec/requests/admin/users_controller_spec.rb b/spec/requests/admin/users_controller_spec.rbindex 2935171ca64..95dc14dbef3 100644--- a/spec/requests/admin/users_controller_spec.rb+++ b/spec/requests/admin/users_controller_spec.rb@@ -2899,6 +2899,7 @@ RSpec.describe Admin::UsersController doexpect(response.status).to eq(200)end+it "should succeed with totp" douser.security_keys.destroy_all@@ -3076,6 +3077,7 @@ RSpec.describe Admin::UsersController dodescribe "#delete_posts_decider" doshared_examples "delete_posts_decider accessible" do |acting_user_role|let(:acting_user) { send(acting_user_role) }+context "when user exists" dofab!(:target_user, :user)@@ -3135,11 +3137,13 @@ RSpec.describe Admin::UsersController docontext "when logged in as an admin" dobefore { sign_in(admin) }+include_examples "delete_posts_decider accessible", :adminendcontext "when logged in as a moderator" dobefore { sign_in(moderator) }+include_examples "delete_posts_decider accessible", :moderatorcontext "when target user is another moderator" dodiff --git a/spec/requests/admin/web_hooks_controller_spec.rb b/spec/requests/admin/web_hooks_controller_spec.rbindex fcbeb482816..09de945211b 100644--- a/spec/requests/admin/web_hooks_controller_spec.rb+++ b/spec/requests/admin/web_hooks_controller_spec.rb@@ -430,6 +430,7 @@ RSpec.describe Admin::WebHooksController doheadersendend+it "modifies the headers & saves the updated headers to the webhook event" doplugin_instance = Plugin::Instance.newplugin_instance.register_modifier(:web_hook_event_headers, &modifier_block)diff --git a/spec/requests/application_controller_spec.rb b/spec/requests/application_controller_spec.rbindex 54cef1e2b2b..9d701f06a06 100644--- a/spec/requests/application_controller_spec.rb+++ b/spec/requests/application_controller_spec.rb@@ -260,6 +260,7 @@ RSpec.describe ApplicationController dodescribe "#redirect_to_second_factor_if_required" dolet(:admin) { Fabricate(:admin) }+fab!(:user) { Fabricate(:user, refresh_auto_groups: true) }before do@@ -722,6 +723,7 @@ RSpec.describe ApplicationController dolet!(:theme) { Fabricate(:theme, user_selectable: true) }let!(:theme2) { Fabricate(:theme, user_selectable: true) }let!(:non_selectable_theme) { Fabricate(:theme, user_selectable: false) }+fab!(:user)fab!(:admin)@@ -1883,6 +1885,7 @@ RSpec.describe ApplicationController dodescribe "#banner_json" dolet(:admin) { Fabricate(:admin) }let(:user) { Fabricate(:user) }+fab!(:banner_topic)fab!(:p1) { Fabricate(:post, topic: banner_topic, raw: "A banner topic") }@@ -1892,6 +1895,7 @@ RSpec.describe ApplicationController docontext "with login_required" dobefore { SiteSetting.login_required = true }+it "does not include banner info for anonymous users" doget "/login"@@ -1914,6 +1918,7 @@ RSpec.describe ApplicationController docontext "with login not required" dobefore { SiteSetting.login_required = false }+it "does include banner info for anonymous users" doget "/login"diff --git a/spec/requests/categories_controller_spec.rb b/spec/requests/categories_controller_spec.rbindex 4bf436623ff..6b96b2b30e5 100644--- a/spec/requests/categories_controller_spec.rb+++ b/spec/requests/categories_controller_spec.rb@@ -3,6 +3,7 @@RSpec.describe CategoriesController dolet!(:admin) { Fabricate(:admin) }let!(:category) { Fabricate(:category, user: admin) }+fab!(:user)describe "#index" dodiff --git a/spec/requests/edit_directory_columns_controller_spec.rb b/spec/requests/edit_directory_columns_controller_spec.rbindex 35014f37727..7475488c8b1 100644--- a/spec/requests/edit_directory_columns_controller_spec.rb+++ b/spec/requests/edit_directory_columns_controller_spec.rb@@ -30,6 +30,7 @@ RSpec.describe EditDirectoryColumnsController dodescribe "#update" dodescribe "when user is an admin or moderator" dobefore { sign_in(admin) }+describe "user saves a new configuration" doit "logs the new information using StaffActionLogger" doexpect { put edit_directory_columns_path(params: payload) }.to change {@@ -56,6 +57,7 @@ RSpec.describe EditDirectoryColumnsController dodescribe "when user is not an admin or moderator" dobefore { sign_in(user) }+describe "user saves a new configuration" doit "does not allow saving" doput edit_directory_columns_path(params: payload)diff --git a/spec/requests/groups_controller_spec.rb b/spec/requests/groups_controller_spec.rbindex 42c4a6e1204..cc5bf6367b5 100644--- a/spec/requests/groups_controller_spec.rb+++ b/spec/requests/groups_controller_spec.rb@@ -6,6 +6,7 @@ RSpec.describe GroupsController dofab!(:other_user, :user)let(:group) { Fabricate(:group, users: [user]) }let(:moderator_group_id) { Group::AUTO_GROUPS[:moderators] }+fab!(:admin)fab!(:moderator)@@ -3388,6 +3389,7 @@ RSpec.describe GroupsController do"Invalid credentials",)end+it "uses the friendly error message functionality to return the message to the user" dopost "/groups/#{group.id}/test_email_settings.json", params: paramsexpect(response.status).to eq(422)@@ -3477,6 +3479,7 @@ RSpec.describe GroupsController docontext "when the protocol is not accepted" dolet(:protocol) { "sigma" }+it "raises an invalid params error" dopost "/groups/#{group.id}/test_email_settings.json", params: paramsexpect(response.status).to eq(400)@@ -3486,6 +3489,7 @@ RSpec.describe GroupsController docontext "when user is a regular user without staff access" dobefore { sign_in(user) }+it "errors if the user does not have access to the group" dopost "/groups/#{group.id}/test_email_settings.json", params: paramsdiff --git a/spec/requests/posts_controller_spec.rb b/spec/requests/posts_controller_spec.rbindex 730eb9e2864..f4ab97e0f1d 100644--- a/spec/requests/posts_controller_spec.rb+++ b/spec/requests/posts_controller_spec.rb@@ -1312,6 +1312,7 @@ RSpec.describe PostsController docontext "when the user still has bookmarks in the topic" dobefore { Fabricate(:bookmark, user: user, bookmarkable: Fabricate(:post, topic: post.topic)) }+it "marks topic_bookmarked as true" dodelete "/posts/#{post.id}/bookmark.json"expect(response.parsed_body["topic_bookmarked"]).to eq(true)@@ -3548,6 +3549,7 @@ RSpec.describe PostsController docontext "with a tagged topic" dolet(:tag) { Fabricate(:tag) }+it "works" doSiteSetting.tagging_enabled = truediff --git a/spec/requests/session_controller_spec.rb b/spec/requests/session_controller_spec.rbindex 43afc71c3da..a5c21bb87f7 100644--- a/spec/requests/session_controller_spec.rb+++ b/spec/requests/session_controller_spec.rb@@ -360,6 +360,7 @@ RSpec.describe SessionController doexpect(session[:current_user_id]).to eq(nil)endend+context "when using backup code method" doit "does not log in with incorrect backup code" dopost "/session/email-login/#{email_token.token}.json",@@ -390,6 +391,7 @@ RSpec.describe SessionController doexpect(session[:current_user_id]).to eq(user.id)endend+context "when using backup code method" doit "logs in correctly" dopost "/session/email-login/#{email_token.token}.json",@@ -2098,6 +2100,7 @@ RSpec.describe SessionController dodescribe "#sso_provider" dolet(:headers) { { host: Discourse.current_hostname } }let(:logo_fixture) { "http://#{Discourse.current_hostname}/uploads/logo.png" }+fab!(:user) { Fabricate(:user, password: "myfrogs123ADMIN", active: true, admin: true) }before do@@ -2567,6 +2570,7 @@ RSpec.describe SessionController dopost "/session.json", params: { login: user.username, password: "myawesomepassword" }end+it_behaves_like "failed to continue local login"end@@ -2578,6 +2582,7 @@ RSpec.describe SessionController dopost "/session.json", params: { login: user.username, password: "myawesomepassword" }end+it_behaves_like "failed to continue local login"end@@ -2586,6 +2591,7 @@ RSpec.describe SessionController doSiteSetting.enable_local_logins_via_email = falseEmailToken.confirm(email_token.token)end+it "doesn't matter, logs in correctly" dopost "/session.json", params: { login: user.username, password: "myawesomepassword" }expect(response.status).to eq(200)@@ -3554,6 +3560,7 @@ RSpec.describe SessionController doSiteSetting.enable_local_logins = falsepost "/session/forgot_password.json", params: { login: user.username }end+it_behaves_like "failed to continue local login"end@@ -3565,6 +3572,7 @@ RSpec.describe SessionController dopost "/session.json", params: { login: user.username, password: "myawesomepassword" }end+it_behaves_like "failed to continue local login"end@@ -3574,11 +3582,13 @@ RSpec.describe SessionController dopost "/session.json", params: { login: user.username, password: "myawesomepassword" }end+it_behaves_like "failed to continue local login"endcontext "when local logins via email are disabled" dobefore { SiteSetting.enable_local_logins_via_email = false }+it "does not matter, generates a new token for a made up username" doexpect dopost "/session/forgot_password.json", params: { login: user.username }diff --git a/spec/requests/static_controller_spec.rb b/spec/requests/static_controller_spec.rbindex 31a75696807..f4279c1b817 100644--- a/spec/requests/static_controller_spec.rb+++ b/spec/requests/static_controller_spec.rb@@ -128,6 +128,7 @@ RSpec.describe StaticController doexpect(response.status).to eq(404)endend+it "rejects fallback paths that traverse outside the fallback directory" doDir.mktmpdir do |tmpdir|fallback_dir = File.join(tmpdir, "fallback_assets")@@ -511,6 +512,7 @@ RSpec.describe StaticController doexpect(response).to redirect_to("/page/login/1")endend+context "when the redirect path is invalid" doit "redirects to the root URL" dopost "/login.json", params: { redirect: "test" }diff --git a/spec/requests/tags_controller_spec.rb b/spec/requests/tags_controller_spec.rbindex 51ad98844e3..27d5e92d633 100644--- a/spec/requests/tags_controller_spec.rb+++ b/spec/requests/tags_controller_spec.rb@@ -216,6 +216,7 @@ RSpec.describe TagsController docontext "with tags_listed_by_group enabled" dobefore { SiteSetting.tags_listed_by_group = true }+include_examples "retrieves the right tags"it "does not list tags of a visible group when they are restricted to a category the user can't see" do@@ -317,6 +318,7 @@ RSpec.describe TagsController docontext "with tags_listed_by_group disabled" dobefore { SiteSetting.tags_listed_by_group = false }+include_examples "retrieves the right tags"it "hides tags only used in personal messages from category tag lists for regular users" do@@ -2367,6 +2369,7 @@ RSpec.describe TagsController dodescribe "with `SiteSetting.force_lowercase_tags = false" dobefore { SiteSetting.force_lowercase_tags = false }+it "does not fail if tags already exist" doFabricate(:tag, name: "tag1")Fabricate(:tag, name: "CAPITALTAG2")diff --git a/spec/requests/theme_javascripts_controller_spec.rb b/spec/requests/theme_javascripts_controller_spec.rbindex ae445e4b099..5322b94fd21 100644--- a/spec/requests/theme_javascripts_controller_spec.rb+++ b/spec/requests/theme_javascripts_controller_spec.rb@@ -18,6 +18,7 @@ RSpec.describe ThemeJavascriptsController dolet(:javascript_cache) doJavascriptCache.create!(content: 'console.log("hello");', theme_field: theme_field)end+before { clear_disk_cache }after { clear_disk_cache }diff --git a/spec/requests/topics_controller_spec.rb b/spec/requests/topics_controller_spec.rbindex 0a5d786d41f..f3abd87c736 100644--- a/spec/requests/topics_controller_spec.rb+++ b/spec/requests/topics_controller_spec.rb@@ -3902,6 +3902,7 @@ RSpec.describe TopicsController dolet(:deleted_private_topic) { @deleted_private_topic }let!(:nonexistent_topic_id) { Topic.last.id + 10_000 }+fab!(:secure_accessible_topic) { Fabricate(:topic, category: accessible_category) }shared_examples "various scenarios" do |expected, request_json:|@@ -3942,6 +3943,7 @@ RSpec.describe TopicsController docontext "when anonymous with login required" dobefore { SiteSetting.login_required = true }+expected = {normal_topic: 302,secure_topic: 302,@@ -3957,6 +3959,7 @@ RSpec.describe TopicsController docontext "when anonymous with login required, requesting json" dobefore { SiteSetting.login_required = true }+expected = {normal_topic: 403,secure_topic: 403,@@ -4054,6 +4057,7 @@ RSpec.describe TopicsController docontext "when anonymous with login required" dobefore { SiteSetting.login_required = true }+expected = {normal_topic: 302,secure_topic: 302,@@ -5238,6 +5242,7 @@ RSpec.describe TopicsController dofab!(:topic_2, :topic)before { sign_in(user) }+let!(:operation) { { type: "change_category", category_id: "1", silent: true } }let!(:topic_ids) { [1, 2, 3] }@@ -7018,6 +7023,7 @@ RSpec.describe TopicsController docontext "when logged in as a TL4 user" dobefore { SiteSetting.enable_category_group_moderation = true }+it "raises an error if the user can't see the topic" douser.update!(trust_level: TrustLevel[4])sign_in(user)diff --git a/spec/requests/uploads_controller_spec.rb b/spec/requests/uploads_controller_spec.rbindex b964d4866ff..362884bce08 100644--- a/spec/requests/uploads_controller_spec.rb+++ b/spec/requests/uploads_controller_spec.rb@@ -751,6 +751,7 @@ RSpec.describe UploadsController docontext "when the upload is an attachment file" dobefore { upload.update(original_filename: "test.pdf") }+it "redirects to the signed_url_for_path" dosign_in(user)get secure_urldiff --git a/spec/requests/user_badges_controller_spec.rb b/spec/requests/user_badges_controller_spec.rbindex 5e57202789d..b1c771d1c95 100644--- a/spec/requests/user_badges_controller_spec.rb+++ b/spec/requests/user_badges_controller_spec.rb@@ -93,6 +93,7 @@ RSpec.describe UserBadgesController dofab!(:private_message_post)let(:topic) { post.topic }let(:private_message_topic) { private_message_post.topic }+fab!(:group)fab!(:private_category) { Fabricate(:private_category, group: group) }fab!(:restricted_topic) { Fabricate(:topic, category: private_category) }diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rbindex 4f994b8d317..26fc3cb8fd9 100644--- a/spec/requests/users_controller_spec.rb+++ b/spec/requests/users_controller_spec.rb@@ -162,6 +162,7 @@ RSpec.describe UsersController doexpect(response.parsed_body["redirect_to"]).to eq(destination_url)endend+context "when destination URL doesn't have a query" doit "should redirect to the URL" dodestination_url = "http://thisisasite.com/somepath"@@ -1029,6 +1030,7 @@ RSpec.describe UsersController doendafter { DiscoursePluginRegistry.reset! }+it "creates User record" doparams = {username: "foobar",@@ -1596,6 +1598,7 @@ RSpec.describe UsersController docontext "when honeypot value is wrong" dobefore { UsersController.any_instance.stubs(:honeypot_value).returns("abc") }+let(:create_params) do{name: @user.name,@@ -1605,11 +1608,13 @@ RSpec.describe UsersController dopassword_confirmation: "wrong",}end+include_examples "honeypot fails"endcontext "when challenge answer is wrong" dobefore { UsersController.any_instance.stubs(:challenge_value).returns("abc") }+let(:create_params) do{name: @user.name,@@ -1619,6 +1624,7 @@ RSpec.describe UsersController dochallenge: "abc",}end+include_examples "honeypot fails"end@@ -1658,6 +1664,7 @@ RSpec.describe UsersController dolet(:create_params) do{ name: @user.name, username: @user.username, password: "", email: @user.email }end+include_examples "failed signup"end@@ -1670,6 +1677,7 @@ RSpec.describe UsersController doemail: @user.email,}end+include_examples "failed signup"end@@ -1688,6 +1696,7 @@ RSpec.describe UsersController docontext "when password param is missing" dolet(:create_params) { { name: @user.name, username: @user.username, email: @user.email } }+include_examples "failed signup"end@@ -1695,7 +1704,9 @@ RSpec.describe UsersController dolet(:create_params) do{ name: @user.name, username: "Reserved", email: @user.email, password: "strongpassword" }end+before { SiteSetting.reserved_usernames = "a|reserved|b" }+include_examples "failed signup"end@@ -1708,6 +1719,7 @@ RSpec.describe UsersController dopassword: "strongpassword",}end+include_examples "failed signup"end@@ -1762,6 +1774,7 @@ RSpec.describe UsersController dolet(:create_params) do{ name: @user.name, password: "watwatwat", username: @user.username, email: @user.email }end+include_examples "failed signup"end@@ -2049,6 +2062,7 @@ RSpec.describe UsersController docontext "while logged in" dolet(:old_username) { "OrigUsername" }let(:new_username) { "#{old_username}1234" }+fab!(:user) { Fabricate(:user, username: "OrigUsername", refresh_auto_groups: true) }before do@@ -2251,11 +2265,13 @@ RSpec.describe UsersController docontext "when username is available" dobefore { get "/u/check_username.json", params: { username: "BruceWayne" } }+include_examples "when username is available"endcontext "when username is unavailable" dobefore { get "/u/check_username.json", params: { username: user1.username } }+include_examples "when username is unavailable"end@@ -2264,6 +2280,7 @@ RSpec.describe UsersController docontext "when checking a reserved username" dobefore { get "/u/check_username.json", params: { username: "reserved" } }+include_examples "when username is unavailable"end@@ -2273,11 +2290,13 @@ RSpec.describe UsersController docontext "when user already exists" dofab!(:user) { Fabricate(:user, username: "reserved") }before { get "/u/check_username.json", params: { username: "reserved" } }+include_examples "when username is unavailable"endcontext "when user does not exist" dobefore { get "/u/check_username.json", params: { username: "reserved" } }+include_examples "when username is available"endend@@ -2293,6 +2312,7 @@ RSpec.describe UsersController docontext "when has invalid characters" dobefore { get "/u/check_username.json", params: { username: "bad username" } }+include_examples "checking an invalid username"it "should return the invalid characters message" do@@ -2308,6 +2328,7 @@ RSpec.describe UsersController dousername: SecureRandom.alphanumeric(SiteSetting.max_username_length.to_i + 1),}end+include_examples "checking an invalid username"it 'should return the "too long" message' do@@ -2326,6 +2347,7 @@ RSpec.describe UsersController doget "/u/check_username.json", params: { username: "HanSolo" }end+include_examples "when username is available"end@@ -2337,6 +2359,7 @@ RSpec.describe UsersController doget "/u/check_username.json", params: { username: "HanSolo" }end+include_examples "when username is unavailable"end@@ -2347,6 +2370,7 @@ RSpec.describe UsersController doget "/u/check_username.json", params: { username: "HanSolo", for_user_id: user.id }end+include_examples "when username is available"endend@@ -3806,6 +3830,7 @@ RSpec.describe UsersController docontext "without an existing email_token" dolet(:user) { post_user }+before douser.email_tokens.each { |t| t.destroy }user.reload@@ -4570,6 +4595,7 @@ RSpec.describe UsersController dodescribe "#update_primary_email" dolet(:user_email) { user1.primary_email }+fab!(:other_email) { Fabricate(:secondary_email, user: user1) }it "requires login" do@@ -6576,6 +6602,7 @@ RSpec.describe UsersController dosecond_factor_token: "123456",}end+it "shows a helpful error message to the user" doexpect(response.parsed_body["error"]).to eq(I18n.t("login.invalid_second_factor_code"))end@@ -6586,6 +6613,7 @@ RSpec.describe UsersController docreate_totppost "/users/enable_second_factor_totp.json", params: { second_factor_token: "123456" }end+it "shows a helpful error message to the user" doexpect(response.parsed_body["error"]).to eq(I18n.t("login.missing_second_factor_name"))end@@ -6596,6 +6624,7 @@ RSpec.describe UsersController docreate_totppost "/users/enable_second_factor_totp.json", params: { name: "test" }end+it "shows a helpful error message to the user" doexpect(response.parsed_body["error"]).to eq(I18n.t("login.missing_second_factor_code"))end@@ -6670,6 +6699,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" doput "/users/second_factor.json",params: {@@ -6715,6 +6745,7 @@ RSpec.describe UsersController do.stubs(:server_session).returns("confirmed-session-#{user1.id}" => "true")end+it "should allow second factor backup for the user to be disabled" doput "/users/second_factor.json",params: {@@ -7054,6 +7085,7 @@ RSpec.describe UsersController dodescribe "#delete_passkey" dobefore { SiteSetting.enable_passkeys = true }+fab!(:passkey) { Fabricate(:passkey_with_random_credential, user: user1) }it "fails if user does not have a confirmed session" dodiff --git a/spec/requests/users_email_controller_spec.rb b/spec/requests/users_email_controller_spec.rbindex 24146d90b45..ca9b0b514ca 100644--- a/spec/requests/users_email_controller_spec.rb+++ b/spec/requests/users_email_controller_spec.rb@@ -5,6 +5,7 @@ require "rotp"RSpec.describe UsersEmailController dofab!(:user)let!(:email_token) { Fabricate(:email_token, user: user) }+fab!(:moderator)describe "#confirm-new-email" dodiff --git a/spec/serializers/basic_group_serializer_spec.rb b/spec/serializers/basic_group_serializer_spec.rbindex 807d0d83749..c4d6e23d29a 100644--- a/spec/serializers/basic_group_serializer_spec.rb+++ b/spec/serializers/basic_group_serializer_spec.rb@@ -4,6 +4,7 @@ RSpec.describe BasicGroupSerializer dosubject(:serializer) { described_class.new(group, scope: guardian, root: false) }let(:guardian) { Guardian.new }+fab!(:group)describe "#display_name" dodiff --git a/spec/serializers/basic_user_serializer_spec.rb b/spec/serializers/basic_user_serializer_spec.rbindex 8de8c01b048..3669a0c5dd0 100644--- a/spec/serializers/basic_user_serializer_spec.rb+++ b/spec/serializers/basic_user_serializer_spec.rb@@ -18,6 +18,7 @@ RSpec.describe BasicUserSerializer dolet(:serializer) doPostActionUserSerializer.new(post_action, scope: Guardian.new(user), root: false)end+it "returns the user correctly" doexpect(serializer.user.username).to eq(user.username)enddiff --git a/spec/serializers/found_user_serializer_spec.rb b/spec/serializers/found_user_serializer_spec.rbindex 36965f8ea77..0899b72e936 100644--- a/spec/serializers/found_user_serializer_spec.rb+++ b/spec/serializers/found_user_serializer_spec.rb@@ -73,6 +73,7 @@ RSpec.describe FoundUserSerializer docontext "when status is disabled in site settings" dobefore { SiteSetting.enable_user_status = false }+let(:serializer) { FoundUserSerializer.new(user, root: false, include_status: true) }it "doesn't add user status" dodiff --git a/spec/serializers/reviewable_note_serializer_spec.rb b/spec/serializers/reviewable_note_serializer_spec.rbindex d7c6ac07334..e2e199bcc2d 100644--- a/spec/serializers/reviewable_note_serializer_spec.rb+++ b/spec/serializers/reviewable_note_serializer_spec.rb@@ -12,12 +12,14 @@ RSpec.describe ReviewableNoteSerializer doenddescribe "serialization" dolet(:json) { serialized_note(note) }+it "includes basic attributes" doexpect(json[:id]).to eq(note.id)expect(json[:content]).to eq("Test note content")expect(json[:created_at]).to be_presentexpect(json[:updated_at]).to be_presentend+it "includes user information" doexpect(json[:user]).to be_presentexpect(json[:user][:id]).to eq(admin.id)diff --git a/spec/serializers/reviewable_score_serializer_spec.rb b/spec/serializers/reviewable_score_serializer_spec.rbindex b075824b9ee..d38f4726301 100644--- a/spec/serializers/reviewable_score_serializer_spec.rb+++ b/spec/serializers/reviewable_score_serializer_spec.rb@@ -124,6 +124,7 @@ RSpec.describe ReviewableScoreSerializer dolet(:link) do"<a href=\"#{Discourse.base_url}/admin/customize/watched_words\">#{I18n.t("reviewables.reasons.links.watched_word")}</a>"end+it "tries to guess the watched words if they weren't recorded at the time of flagging" doraw = "I'm a post with some bad words like 'bad' and 'words'."reviewable.target = Fabricate(:post, raw:)diff --git a/spec/serializers/user_serializer_spec.rb b/spec/serializers/user_serializer_spec.rbindex cd009ecc68c..a0b9cfcea38 100644--- a/spec/serializers/user_serializer_spec.rb+++ b/spec/serializers/user_serializer_spec.rb@@ -81,6 +81,7 @@ RSpec.describe UserSerializer dofab!(:user)let(:serializer) { UserSerializer.new(user, scope: scope, root: false) }let(:json) { serializer.as_json }+fab!(:upload)fab!(:upload2, :upload)@@ -321,6 +322,7 @@ RSpec.describe UserSerializer dodescribe "second_factor_enabled" dolet(:scope) { Guardian.new(user) }+it "is false by default" doexpect(json[:second_factor_enabled]).to eq(false)enddiff --git a/spec/services/design_wizard/apply_spec.rb b/spec/services/design_wizard/apply_spec.rbindex d26af6f352f..511e1c078f2 100644--- a/spec/services/design_wizard/apply_spec.rb+++ b/spec/services/design_wizard/apply_spec.rb@@ -12,31 +12,37 @@ RSpec.describe DesignWizard::Apply dodescribe described_class::Contract, type: :model doit { is_expected.to validate_presence_of(:theme_id) }it { is_expected.to validate_inclusion_of(:theme_id).in_array(Theme::CORE_THEMES.values) }+it dois_expected.to validate_inclusion_of(:base_font).in_array(BaseFontSetting.values.map { |font| font[:value] },).allow_nilend+it dois_expected.to validate_inclusion_of(:heading_font).in_array(BaseFontSetting.values.map { |font| font[:value] },).allow_nilend+it dois_expected.to validate_inclusion_of(:homepage).in_array(%w[latest new hot categories],).allow_nilend+it dois_expected.to validate_inclusion_of(:category_page_style).in_array(CategoryPageStyle.values.map { |style| style[:value] },).allow_nilend+it dois_expected.to validate_inclusion_of(:welcome_banner_location).in_array(WelcomeBannerLocation.values.map { |location| location[:value] },).allow_nilend+it dois_expected.to validate_inclusion_of(:search_experience).in_array(SearchExperienceSiteSetting.values.map { |experience| experience[:value] },diff --git a/spec/services/email_settings_validator_spec.rb b/spec/services/email_settings_validator_spec.rbindex ba9bd0672fd..0943b46e52c 100644--- a/spec/services/email_settings_validator_spec.rb+++ b/spec/services/email_settings_validator_spec.rb@@ -237,6 +237,7 @@ RSpec.describe EmailSettingsValidator docontext "when the domain is not provided" dolet(:domain) { nil }+it "gets the domain from the host" donet_smtp_stub.expects(:start).with("gmail.com", username, password, :plain)described_class.validate_smtp(diff --git a/spec/services/groups/create_spec.rb b/spec/services/groups/create_spec.rbindex 82e03c82029..0227ff8d164 100644--- a/spec/services/groups/create_spec.rb+++ b/spec/services/groups/create_spec.rb@@ -7,22 +7,27 @@ RSpec.describe Groups::Create dolet(:attributes) { {} }it { is_expected.to validate_presence_of :name }+it dois_expected.to validate_inclusion_of(:mentionable_level).in_array(Group::ALIAS_LEVELS.values)end+it dois_expected.to validate_inclusion_of(:messageable_level).in_array(Group::ALIAS_LEVELS.values)end+it dois_expected.to validate_inclusion_of(:visibility_level).in_array(Group.visibility_levels.values,)end+it dois_expected.to validate_inclusion_of(:members_visibility_level).in_array(Group.visibility_levels.values,)end+it dois_expected.to validate_inclusion_of(:default_notification_level).in_array(GroupUser.notification_levels.values,diff --git a/spec/services/inline_uploads_spec.rb b/spec/services/inline_uploads_spec.rbindex 6220b13b242..9d1ee64361a 100644--- a/spec/services/inline_uploads_spec.rb+++ b/spec/services/inline_uploads_spec.rb@@ -762,8 +762,10 @@ RSpec.describe InlineUploads doexpect(raw).to eq("look at this:\n")endend+context "when raw has an image URL with a square bracket in filename" dolet!(:image_upload) { Fabricate(:image_upload, original_filename: "image]1.jpg") }+it "does not make broken markdown" doorigin = "http://foo.bar/#{image_upload.original_filename}"raw =diff --git a/spec/services/post_alerter_spec.rb b/spec/services/post_alerter_spec.rbindex 2818faff1f5..3ddbd0b94af 100644--- a/spec/services/post_alerter_spec.rb+++ b/spec/services/post_alerter_spec.rb@@ -757,6 +757,7 @@ RSpec.describe PostAlerter dolet(:post) docreate_post_with_alerts(raw: "Hello @here how are you?", user: tl2_user, topic: topic)end+fab!(:other_post) { Fabricate(:post, topic: topic) }before { Jobs.run_immediately! }@@ -813,6 +814,7 @@ RSpec.describe PostAlerter doFabricate(:group, name: "group", mentionable_level: Group::ALIAS_LEVELS[:everyone])endlet(:post) { create_post_with_alerts(raw: "Hello @group how are you?") }+before { group.add(evil_trout) }it "notifies users correctly" do@@ -980,6 +982,7 @@ RSpec.describe PostAlerter do%i[watching tracking regular].each do |notification_level|context "when notification level is '#{notification_level}'" dobefore { set_topic_notification_level(alice, pm_topic, notification_level) }+let(:expected_notification) donotification_level == :watching ? :private_message : :mentionedenddiff --git a/spec/services/problem_check/starttls_disabled_spec.rb b/spec/services/problem_check/starttls_disabled_spec.rbindex 854f89fb767..da757cbfdcb 100644--- a/spec/services/problem_check/starttls_disabled_spec.rb+++ b/spec/services/problem_check/starttls_disabled_spec.rb@@ -6,11 +6,13 @@ RSpec.describe ProblemCheck::StarttlsDisabled dodescribe ".call" docontext "with STARTTLS enabled" dobefore { GlobalSetting.stubs(:smtp_enable_start_tls).returns(true) }+it { expect(check).to be_chill_about_it }endcontext "with STARTTLS disabled" dobefore { GlobalSetting.stubs(:smtp_enable_start_tls).returns(false) }+it doexpect(check).to have_a_problem.with_priority("high").with_message(I18n.t("dashboard.problem.#{check.identifier}"),diff --git a/spec/services/push_notification_pusher_spec.rb b/spec/services/push_notification_pusher_spec.rbindex 6e2d8ed9ea0..5d890a87a71 100644--- a/spec/services/push_notification_pusher_spec.rb+++ b/spec/services/push_notification_pusher_spec.rb@@ -295,6 +295,7 @@ RSpec.describe PushNotificationPusher dopayloadendend+it "Allows modifications to the payload passed to the translation" doplugin_instance = Plugin::Instance.newplugin_instance.register_modifier(:push_notification_pusher_title_payload, &modifier_block)diff --git a/spec/services/themes/bulk_destroy_spec.rb b/spec/services/themes/bulk_destroy_spec.rbindex a979c5329ea..35d4027eae3 100644--- a/spec/services/themes/bulk_destroy_spec.rb+++ b/spec/services/themes/bulk_destroy_spec.rb@@ -5,6 +5,7 @@ RSpec.describe Themes::BulkDestroy doit { is_expected.to validate_presence_of(:theme_ids) }it { is_expected.to allow_values([1], (1..50).to_a).for(:theme_ids) }it { is_expected.not_to allow_values([], (1..51).to_a).for(:theme_ids) }+it dois_expected.not_to allow_values([1, 0, -3]).for(:theme_ids).with_message(/must all be positive/,diff --git a/spec/services/user/action/trigger_post_action_spec.rb b/spec/services/user/action/trigger_post_action_spec.rbindex b497809906f..be12e0f576f 100644--- a/spec/services/user/action/trigger_post_action_spec.rb+++ b/spec/services/user/action/trigger_post_action_spec.rb@@ -28,6 +28,7 @@ RSpec.describe User::Action::TriggerPostAction docontext "when post_action is 'none'" dolet(:post_action) { "none" }+it "does nothing" doexpect { action }.not_to change { Post.count }enddiff --git a/spec/services/user/silence_spec.rb b/spec/services/user/silence_spec.rbindex fca97d415cd..e7e67441f74 100644--- a/spec/services/user/silence_spec.rb+++ b/spec/services/user/silence_spec.rb@@ -6,11 +6,13 @@ RSpec.describe User::Silence doit { is_expected.to validate_presence_of(:reason) }it { is_expected.to validate_presence_of(:silenced_till) }it { is_expected.to validate_length_of(:reason).is_at_most(300) }+it dois_expected.to validate_length_of(:other_user_ids).as_array.is_at_most(User::MAX_SIMILAR_USERS,)end+it dois_expected.to validate_inclusion_of(:post_action).in_array(%w[delete delete_replies edit none],diff --git a/spec/services/user/suspend_spec.rb b/spec/services/user/suspend_spec.rbindex 4dde0c01e75..1fcfaca3d0f 100644--- a/spec/services/user/suspend_spec.rb+++ b/spec/services/user/suspend_spec.rb@@ -6,11 +6,13 @@ RSpec.describe User::Suspend doit { is_expected.to validate_presence_of(:reason) }it { is_expected.to validate_presence_of(:suspend_until) }it { is_expected.to validate_length_of(:reason).is_at_most(300) }+it dois_expected.to validate_length_of(:other_user_ids).as_array.is_at_most(User::MAX_SIMILAR_USERS,)end+it dois_expected.to validate_inclusion_of(:post_action).in_array(%w[delete delete_replies delete_all edit none],diff --git a/spec/services/user_anonymizer_spec.rb b/spec/services/user_anonymizer_spec.rbindex 262934eecdd..e323a4ffcfe 100644--- a/spec/services/user_anonymizer_spec.rb+++ b/spec/services/user_anonymizer_spec.rb@@ -27,6 +27,7 @@ RSpec.describe UserAnonymizer dolet(:original_email) { "[email protected]" }let(:user) { Fabricate(:user, username: "edward", email: original_email) }+fab!(:another_user, :evil_trout)it "changes username" dodiff --git a/spec/services/username_changer_spec.rb b/spec/services/username_changer_spec.rbindex 51705f777e8..9c9f3dfa20b 100644--- a/spec/services/username_changer_spec.rb+++ b/spec/services/username_changer_spec.rb@@ -377,6 +377,7 @@ RSpec.describe UsernameChanger docontext "when using Unicode usernames" dobefore { SiteSetting.unicode_usernames = true }+let(:user) { Fabricate(:user, username: "թռչուն") }it "it correctly updates mentions" dodiff --git a/spec/system/admin_backups_spec.rb b/spec/system/admin_backups_spec.rbindex 27d49419ba1..d8920935714 100644--- a/spec/system/admin_backups_spec.rb+++ b/spec/system/admin_backups_spec.rb@@ -32,6 +32,7 @@ describe "Admin Backups Page" doroot_directory + "/" + RailsMultisite::ConnectionManagement.current_db,)end+after { teardown_local_backups(root_directory: root_directory) }it "shows a list of backups" dodiff --git a/spec/system/admin_color_palettes_config_area_spec.rb b/spec/system/admin_color_palettes_config_area_spec.rbindex 5df0568150d..1c5d14eb1fd 100644--- a/spec/system/admin_color_palettes_config_area_spec.rb+++ b/spec/system/admin_color_palettes_config_area_spec.rb@@ -299,6 +299,7 @@ describe "Admin Color Palettes Config Area Page" dodark_color_scheme: default_dark_scheme,)end+it "sorts schemes in order: selectable, custom, current default theme, alphabetical for horizon theme" doSiteSetting.default_theme_id = Theme.horizon_theme.idconfig_area.visitdiff --git a/spec/system/admin_logo_spec.rb b/spec/system/admin_logo_spec.rbindex 20a72613073..f4191179744 100644--- a/spec/system/admin_logo_spec.rb+++ b/spec/system/admin_logo_spec.rb@@ -12,6 +12,7 @@ describe "Admin Logo Page" dodescribe "primary section" dolet(:primary_section_logos) { %i[logo logo_dark large_icon favicon logo_small logo_small_dark] }+it "can upload images and dark versions" dologo_page.visit@@ -64,6 +65,7 @@ describe "Admin Logo Page" dodescribe "mobile section" dolet(:mobile_section_logos) { %i[mobile_logo mobile_logo_dark manifest_icon apple_touch_icon] }+it "can upload images and dark versions" dologo_page.visitlogo_page.form.expand_mobile_section@@ -113,6 +115,7 @@ describe "Admin Logo Page" dodescribe "email section" dolet(:email_section_logos) { %i[digest_logo] }+it "can upload images" dologo_page.visitlogo_page.form.expand_email_section@@ -156,6 +159,7 @@ describe "Admin Logo Page" dodescribe "social media section" dolet(:social_media_section_logos) { %i[opengraph_image] }+it "can upload images" dologo_page.visitlogo_page.form.expand_social_media_sectiondiff --git a/spec/system/admin_site_setting_bulk_action_spec.rb b/spec/system/admin_site_setting_bulk_action_spec.rbindex 9eea573bb42..ea38e258bb7 100644--- a/spec/system/admin_site_setting_bulk_action_spec.rb+++ b/spec/system/admin_site_setting_bulk_action_spec.rb@@ -4,6 +4,7 @@ describe "Admin Site Setting Bulk Action" dolet(:settings_page) { PageObjects::Pages::AdminSiteSettings.new }let(:banner) { PageObjects::Components::AdminChangesBanner.new }let(:dialog) { PageObjects::Components::Dialog.new }+fab!(:admin)before { sign_in(admin) }diff --git a/spec/system/admin_site_setting_category_spec.rb b/spec/system/admin_site_setting_category_spec.rbindex 4747c288831..bb1a32f4d0a 100644--- a/spec/system/admin_site_setting_category_spec.rb+++ b/spec/system/admin_site_setting_category_spec.rb@@ -2,6 +2,7 @@describe "Admin site setting category" dolet(:settings_page) { PageObjects::Pages::AdminSiteSettings.new }+fab!(:admin)fab!(:category)diff --git a/spec/system/admin_site_setting_enum_spec.rb b/spec/system/admin_site_setting_enum_spec.rbindex 1c604ccef10..eece901ee74 100644--- a/spec/system/admin_site_setting_enum_spec.rb+++ b/spec/system/admin_site_setting_enum_spec.rb@@ -2,6 +2,7 @@describe "Admin site setting enum" dolet(:settings_page) { PageObjects::Pages::AdminSiteSettings.new }+fab!(:admin)before { sign_in(admin) }diff --git a/spec/system/admin_site_setting_group_spec.rb b/spec/system/admin_site_setting_group_spec.rbindex 73554cd46b3..6db60d6fedc 100644--- a/spec/system/admin_site_setting_group_spec.rb+++ b/spec/system/admin_site_setting_group_spec.rb@@ -2,6 +2,7 @@describe "Admin site setting group" dolet(:settings_page) { PageObjects::Pages::AdminSiteSettings.new }+fab!(:admin)fab!(:group)diff --git a/spec/system/admin_site_setting_label_formatting_spec.rb b/spec/system/admin_site_setting_label_formatting_spec.rbindex 1c201cee060..4a9b1668fb8 100644--- a/spec/system/admin_site_setting_label_formatting_spec.rb+++ b/spec/system/admin_site_setting_label_formatting_spec.rb@@ -2,6 +2,7 @@describe "Admin Site Setting Formatting" dolet(:settings_page) { PageObjects::Pages::AdminSiteSettings.new }+fab!(:admin)before { sign_in(admin) }diff --git a/spec/system/admin_site_setting_locale_spec.rb b/spec/system/admin_site_setting_locale_spec.rbindex 374cff4ebe0..2b4e8bdadf7 100644--- a/spec/system/admin_site_setting_locale_spec.rb+++ b/spec/system/admin_site_setting_locale_spec.rb@@ -2,6 +2,7 @@describe "Admin Site Setting Locales" dolet(:settings_page) { PageObjects::Pages::AdminSiteSettings.new }+fab!(:admin)before dodiff --git a/spec/system/admin_site_setting_requires_confirmation_spec.rb b/spec/system/admin_site_setting_requires_confirmation_spec.rbindex fefccab1111..298e2266ef7 100644--- a/spec/system/admin_site_setting_requires_confirmation_spec.rb+++ b/spec/system/admin_site_setting_requires_confirmation_spec.rb@@ -3,6 +3,7 @@describe "Admin Site Setting Requires Confirmation" dolet(:settings_page) { PageObjects::Pages::AdminSiteSettings.new }let(:dialog) { PageObjects::Components::Dialog.new }+fab!(:admin)before dodiff --git a/spec/system/admin_site_setting_search_spec.rb b/spec/system/admin_site_setting_search_spec.rbindex fda0ba7a1b0..778b53cd415 100644--- a/spec/system/admin_site_setting_search_spec.rb+++ b/spec/system/admin_site_setting_search_spec.rb@@ -2,6 +2,7 @@describe "Admin Site Setting Search" dolet(:settings_page) { PageObjects::Pages::AdminSiteSettings.new }+fab!(:admin)before dodiff --git a/spec/system/admin_site_setting_string_spec.rb b/spec/system/admin_site_setting_string_spec.rbindex fcfbfaf8f6e..2e6eff2cdd3 100644--- a/spec/system/admin_site_setting_string_spec.rb+++ b/spec/system/admin_site_setting_string_spec.rb@@ -2,6 +2,7 @@describe "Admin site setting string" dolet(:settings_page) { PageObjects::Pages::AdminSiteSettings.new }+fab!(:admin)before { sign_in(admin) }diff --git a/spec/system/admin_site_setting_topic_chooser_spec.rb b/spec/system/admin_site_setting_topic_chooser_spec.rbindex fbc17a2be6b..22c459eca51 100644--- a/spec/system/admin_site_setting_topic_chooser_spec.rb+++ b/spec/system/admin_site_setting_topic_chooser_spec.rb@@ -3,6 +3,7 @@describe "Admin Site Setting Topic Selector Component" dolet(:settings_page) { PageObjects::Pages::AdminSiteSettings.new }let(:banner) { PageObjects::Components::AdminChangesBanner.new }+fab!(:admin)fab!(:topic) { Fabricate(:topic, title: "Moderator guide", fancy_title: "Moderator guide") }fab!(:post) { Fabricate(:post, topic: topic) }diff --git a/spec/system/admin_whats_new_spec.rb b/spec/system/admin_whats_new_spec.rbindex ac6158bfe35..93065365024 100644--- a/spec/system/admin_whats_new_spec.rb+++ b/spec/system/admin_whats_new_spec.rb@@ -3,6 +3,7 @@describe "Admin What's New Page" dolet(:whats_new_page) { PageObjects::Pages::AdminWhatsNew.new }let(:sidebar) { PageObjects::Components::NavigationMenu::Sidebar.new }+fab!(:admin)before dodiff --git a/spec/system/categories_page_spec.rb b/spec/system/categories_page_spec.rbindex b13d281ce5b..a56845a0a2d 100644--- a/spec/system/categories_page_spec.rb+++ b/spec/system/categories_page_spec.rb@@ -6,6 +6,7 @@ RSpec.describe "Categories Page" dofab!(:subcategory) { Fabricate(:category, parent_category: category) }fab!(:topics) { Fabricate.times(3, :topic_with_op, category: subcategory) }let(:category_page) { PageObjects::Pages::Category.new }+before { CategoryFeaturedTopic.feature_topics }describe "hashtag icons in category descriptions" do@@ -28,6 +29,7 @@ RSpec.describe "Categories Page" dodescribe "subcategories_with_featured_topics" dobefore { SiteSetting.desktop_category_page_style = "subcategories_with_featured_topics" }+it "displays subcategories and topics" docategory_page.visit_categoriesdiff --git a/spec/system/composer/default_to_subcategory_spec.rb b/spec/system/composer/default_to_subcategory_spec.rbindex 05ea591d200..12f4365d946 100644--- a/spec/system/composer/default_to_subcategory_spec.rb+++ b/spec/system/composer/default_to_subcategory_spec.rb@@ -24,11 +24,13 @@ describe "Default to Subcategory when parent Category doesn't allow posting" dodescribe "logged in user" dobefore { sign_in(user) }+describe "default_subcategory_on_read_only_category setting enabled and can't post on parent category" dobefore { SiteSetting.default_subcategory_on_read_only_category = true }describe "default_composer_category set" dobefore { SiteSetting.default_composer_category = default_latest_category.id }+describe "Can't post on parent category" dodescribe "Category has subcategory" doit "should have 'New Topic' button enabled and default Subcategory set in the composer" do@@ -40,6 +42,7 @@ describe "Default to Subcategory when parent Category doesn't allow posting" doexpect(select_kit).to have_selected_value(subcategory.id)endend+describe "Category does not have subcategory" doit "should have the 'New Topic' button enabled and no category set in the composer" docategory_page.visit(category_with_no_subcategory)@@ -53,6 +56,7 @@ describe "Default to Subcategory when parent Category doesn't allow posting" doendendend+describe "Can post on home page" doit "should have the default category set in the composer" dopage.visit("latest")@@ -70,6 +74,7 @@ describe "Default to Subcategory when parent Category doesn't allow posting" doSiteSetting.default_composer_category = ""SiteSetting.allow_uncategorized_topics = falseend+describe "Can't post on parent category" dodescribe "Category does not have subcategory" doit "opens composer with no category selected" do@@ -83,6 +88,7 @@ describe "Default to Subcategory when parent Category doesn't allow posting" doendendend+describe "Can post on home page" doit "composer should open" dopage.visit("latest")diff --git a/spec/system/composer/post_validation_spec.rb b/spec/system/composer/post_validation_spec.rbindex c9079ce3502..63082c889c7 100644--- a/spec/system/composer/post_validation_spec.rb+++ b/spec/system/composer/post_validation_spec.rb@@ -35,11 +35,13 @@ describe "Composer Post Validations" dodescribe "trust level 0 user" dobefore { sign_in(tl0_user) }+include_examples "post length validation"enddescribe "trust level 1 user" dobefore { sign_in(tl1_user) }+include_examples "post length validation"enddiff --git a/spec/system/composer/prosemirror_images_spec.rb b/spec/system/composer/prosemirror_images_spec.rbindex 413d7bafdf6..1ff841d9d5a 100644--- a/spec/system/composer/prosemirror_images_spec.rb+++ b/spec/system/composer/prosemirror_images_spec.rb@@ -168,6 +168,7 @@ describe "Composer - ProseMirror - Images" dodescribe "auto-grid functionality with enable_auto_grid_images" dobefore { SiteSetting.enable_auto_grid_images = true }+it "automatically wraps 3+ uploaded images in a grid" doopen_composerfile_path_1 = file_from_fixtures("logo.png", "images").pathdiff --git a/spec/system/composer/prosemirror_pasting_spec.rb b/spec/system/composer/prosemirror_pasting_spec.rbindex eff60a5e1a1..acaf591e9af 100644--- a/spec/system/composer/prosemirror_pasting_spec.rb+++ b/spec/system/composer/prosemirror_pasting_spec.rb@@ -128,6 +128,7 @@ describe "Composer - ProseMirror - Pasting content" docontext "when unauthorized to upload" dobefore { SiteSetting.authorized_extensions = "" }+it "allows pasting text" docdp.allow_clipboardopen_composerdiff --git a/spec/system/discourse_connect_provider_spec.rb b/spec/system/discourse_connect_provider_spec.rbindex beda6baca36..9ec0870282a 100644--- a/spec/system/discourse_connect_provider_spec.rb+++ b/spec/system/discourse_connect_provider_spec.rb@@ -11,6 +11,7 @@ describe "Discourse Connect Provider" dofab!(:user) { Fabricate(:user, username: "john", password: "supersecurepassword") }let(:login_form) { PageObjects::Pages::Login.new }let!(:return_url) { "http://localhost:#{sso_port}/test/url" }+before doSiteSetting.enable_discourse_connect_provider = trueSiteSetting.discourse_connect_provider_secrets = "localhost|Test"@@ -71,6 +72,7 @@ describe "Discourse Connect Provider" docontext "with two-factor authentication" dolet!(:user_second_factor) { Fabricate(:user_second_factor_totp, user: user) }let!(:user_second_factor_backup) { Fabricate(:user_second_factor_backup, user: user) }+fab!(:other_user) { Fabricate(:user, username: "jane", password: "supersecurepassword") }it "redirects back to the return_sso_url" dodiff --git a/spec/system/discourse_connect_spec.rb b/spec/system/discourse_connect_spec.rbindex 48d93758383..7b2b4553c20 100644--- a/spec/system/discourse_connect_spec.rb+++ b/spec/system/discourse_connect_spec.rb@@ -46,6 +46,7 @@ describe "Discourse Connect" docontext "when visiting /" dobefore { visit "/" }+it_behaves_like "shows the homepage"end@@ -60,6 +61,7 @@ describe "Discourse Connect" docontext "when visiting /login" dobefore { visit "/login" }+it_behaves_like "redirects to SSO"endend@@ -69,6 +71,7 @@ describe "Discourse Connect" docontext "when visiting /" dobefore { visit "/" }+it_behaves_like "shows the homepage"end@@ -83,6 +86,7 @@ describe "Discourse Connect" docontext "when visiting /login" dobefore { visit "/login" }+it_behaves_like "redirects to SSO"end@@ -106,6 +110,7 @@ describe "Discourse Connect" docontext "when visiting /" dobefore { visit "/" }+it_behaves_like "shows the login splash"end@@ -120,6 +125,7 @@ describe "Discourse Connect" docontext "when visiting /login" dobefore { visit "/login" }+it_behaves_like "redirects to SSO"endend@@ -129,11 +135,13 @@ describe "Discourse Connect" docontext "when visiting /" dobefore { visit "/" }+it_behaves_like "redirects to SSO"endcontext "when visiting /login" dobefore { visit "/login" }+it_behaves_like "redirects to SSO"endenddiff --git a/spec/system/edit_category_general_spec.rb b/spec/system/edit_category_general_spec.rbindex 48bacb03c3c..6f1c2b7b206 100644--- a/spec/system/edit_category_general_spec.rb+++ b/spec/system/edit_category_general_spec.rb@@ -5,6 +5,7 @@ describe "Edit Category General" dofab!(:category)let(:category_page) { PageObjects::Pages::Category.new }let(:form) { PageObjects::Components::FormKit.new(".form-kit") }+before { sign_in(admin) }context "when changing background color" dodiff --git a/spec/system/emojis/emoji_deny_list_spec.rb b/spec/system/emojis/emoji_deny_list_spec.rbindex 9bead921167..e001652dce4 100644--- a/spec/system/emojis/emoji_deny_list_spec.rb+++ b/spec/system/emojis/emoji_deny_list_spec.rb@@ -4,12 +4,14 @@ describe "Emoji deny list" dolet(:topic_page) { PageObjects::Pages::Topic.new }let(:composer) { PageObjects::Components::Composer.new }let(:emoji_picker) { PageObjects::Components::EmojiPicker.new }+fab!(:admin)before { sign_in(admin) }describe "when editing admin settings" dobefore { SiteSetting.emoji_deny_list = "" }+let(:site_settings_page) { PageObjects::Pages::AdminSiteSettings.new }it "allows admin to update emoji deny list" dodiff --git a/spec/system/groups/group_members_spec.rb b/spec/system/groups/group_members_spec.rbindex fa1ae0dd822..0235afdfb2a 100644--- a/spec/system/groups/group_members_spec.rb+++ b/spec/system/groups/group_members_spec.rb@@ -2,6 +2,7 @@describe "Group members" dolet(:group_page) { PageObjects::Pages::Group.new }+fab!(:admin)fab!(:group)diff --git a/spec/system/groups/group_spec.rb b/spec/system/groups/group_spec.rbindex dbe5e60d967..172c5696985 100644--- a/spec/system/groups/group_spec.rb+++ b/spec/system/groups/group_spec.rb@@ -5,6 +5,7 @@ describe "Group" dolet(:group_index_page) { PageObjects::Pages::GroupIndex.new }let(:group_form_page) { PageObjects::Pages::GroupForm.new }let(:dialog) { PageObjects::Components::Dialog.new }+fab!(:admin)fab!(:group)@@ -93,6 +94,7 @@ describe "Group" dodescribe "update default notification level" dolet(:default_notifications_modal) { PageObjects::Modals::GroupDefaultNotifications.new }+fab!(:user1, :user)fab!(:user2, :user)diff --git a/spec/system/header_spec.rb b/spec/system/header_spec.rbindex 4761cf24ea9..87b87399e89 100644--- a/spec/system/header_spec.rb+++ b/spec/system/header_spec.rb@@ -3,6 +3,7 @@RSpec.describe "Glimmer Header" dolet(:header) { PageObjects::Pages::Header.new }let(:search) { PageObjects::Pages::Search.new }+fab!(:current_user, :user)fab!(:topic)diff --git a/spec/system/locale_spec.rb b/spec/system/locale_spec.rbindex a579c120e6b..fa218a48492 100644--- a/spec/system/locale_spec.rb+++ b/spec/system/locale_spec.rb@@ -64,6 +64,7 @@ RSpec.describe "Locale choice" do},)end+after { JsLocaleHelper.clear_cache! }it "handles fallback correctly" dodiff --git a/spec/system/login_spec.rb b/spec/system/login_spec.rbindex e2b3a716a1d..380bdea83c3 100644--- a/spec/system/login_spec.rb+++ b/spec/system/login_spec.rb@@ -306,6 +306,7 @@ shared_examples "login scenarios" docontext "with two-factor authentication" dolet!(:user_second_factor) { Fabricate(:user_second_factor_totp, user: user) }let!(:user_second_factor_backup) { Fabricate(:user_second_factor_backup, user: user) }+fab!(:other_user) { Fabricate(:user, username: "jane", password: "supersecurepassword") }before dodiff --git a/spec/system/post_menu_spec.rb b/spec/system/post_menu_spec.rbindex 3273b576c96..3e9ae9dd13d 100644--- a/spec/system/post_menu_spec.rb+++ b/spec/system/post_menu_spec.rb@@ -149,6 +149,7 @@ describe "Post menu" doexpect(topic_page).to have_post_action_button(post, :admin)expect(topic_page).to have_post_action_button(post2, :admin)end+it "does not display the admin button when the group is not allowed" doSiteSetting.change_post_ownership_allowed_groups = ""sign_in(allowed_group_user)diff --git a/spec/system/request_tracker_spec.rb b/spec/system/request_tracker_spec.rbindex 566ffb48382..b578b206a01 100644--- a/spec/system/request_tracker_spec.rb+++ b/spec/system/request_tracker_spec.rb@@ -965,6 +965,7 @@ describe "Request tracking" docontext "when logged in" dobefore { sign_in(user) }+let(:expected_username) { user.username }include_examples "logs piggyback and beacon entries on home and topic"diff --git a/spec/system/search_menu_hashtag_spec.rb b/spec/system/search_menu_hashtag_spec.rbindex e97e4c43ac7..349390a076e 100644--- a/spec/system/search_menu_hashtag_spec.rb+++ b/spec/system/search_menu_hashtag_spec.rb@@ -2,6 +2,7 @@describe "Search menu hashtag autocomplete" dolet(:search_page) { PageObjects::Pages::Search.new }+fab!(:user)fab!(:category) { Fabricate(:category, name: "UX", slug: "ux") }fab!(:tag) { Fabricate(:tag, name: "design") }diff --git a/spec/system/social_authentication_spec.rb b/spec/system/social_authentication_spec.rbindex 54ad458edd7..e2d50c2920e 100644--- a/spec/system/social_authentication_spec.rb+++ b/spec/system/social_authentication_spec.rb@@ -206,6 +206,7 @@ shared_examples "social authentication scenarios" doSiteSetting.linkedin_oidc_client_secret = "abcde"SiteSetting.enable_linkedin_oidc_logins = trueend+after { reset_omniauth_config(:linkedin_oidc) }it "fills the signup form" do@@ -249,6 +250,7 @@ shared_examples "social authentication scenarios" doSiteSetting.auth_overrides_name = trueSiteSetting.auth_overrides_username = trueend+after { reset_omniauth_config(:google_oauth2) }it "fills the signup form and disables the inputs" do@@ -273,6 +275,7 @@ shared_examples "social authentication scenarios" doSiteSetting.enable_google_oauth2_logins = trueSiteSetting.auth_skip_create_confirm = trueend+after { reset_omniauth_config(:google_oauth2) }it "creates the account directly" do@@ -300,6 +303,7 @@ shared_examples "social authentication scenarios" doSiteSetting.enable_google_oauth2_logins = trueSiteSetting.enable_local_logins = falseend+after { reset_omniauth_config(:google_oauth2) }context "when login is required" do@@ -564,6 +568,7 @@ shared_examples "social authentication scenarios" doSiteSetting.linkedin_oidc_client_secret = "abcde"SiteSetting.enable_linkedin_oidc_logins = trueend+after { reset_omniauth_config(:linkedin_oidc) }it "logs in user" dodiff --git a/spec/system/user_page/hide_from_public_spec.rb b/spec/system/user_page/hide_from_public_spec.rbindex c7439de717c..caf71fbdcba 100644--- a/spec/system/user_page/hide_from_public_spec.rb+++ b/spec/system/user_page/hide_from_public_spec.rb@@ -2,6 +2,7 @@describe "hide_user_profiles_from_public" dolet(:user) { Fabricate(:user) }+before { SiteSetting.hide_user_profiles_from_public = true }it "displays an error when navigating straight to a profile" dodiff --git a/spec/system/user_page/user_invites_spec.rb b/spec/system/user_page/user_invites_spec.rbindex 0556b9e40a0..4614715116d 100644--- a/spec/system/user_page/user_invites_spec.rb+++ b/spec/system/user_page/user_invites_spec.rb@@ -40,6 +40,7 @@ describe "User invites" dodescribe "expired invites" dolet(:user_invite_expired_page) { PageObjects::Pages::UserInvitedExpired.new }+it "correctly shows expired invites" douser_invite_expired_page.visit(user)expect(user_invite_expired_page.invites_list.size).to eq(invites_expired.size)diff --git a/spec/system/welcome_banner_spec.rb b/spec/system/welcome_banner_spec.rbindex 6c3c335bd93..bd67fae4fd4 100644--- a/spec/system/welcome_banner_spec.rb+++ b/spec/system/welcome_banner_spec.rb@@ -174,6 +174,7 @@ describe "Welcome banner" docontext "for text color setting" dolet(:red) { "#ff0000" }+before { SiteSetting.welcome_banner_text_color = red }it "doesn't set text color without background image" dodiff --git a/themes/horizon/spec/system/horizon_high_level_spec.rb b/themes/horizon/spec/system/horizon_high_level_spec.rbindex aba7a8df99f..a1cd9200d3d 100644--- a/themes/horizon/spec/system/horizon_high_level_spec.rb+++ b/themes/horizon/spec/system/horizon_high_level_spec.rb@@ -20,6 +20,7 @@ describe "Horizon theme | High level" dolet(:topic_page) { PageObjects::Pages::Topic.new }let(:sidebar) { PageObjects::Components::NavigationMenu::Sidebar.new }let(:palette_selector) { PageObjects::Components::UserColorPaletteSelector.new }+fab!(:incorrect_scheme) doFabricate(:color_scheme, name: "Incorrect Scheme", user_selectable: true)enddiff --git a/themes/horizon/spec/system/sidebar_topic_button_spec.rb b/themes/horizon/spec/system/sidebar_topic_button_spec.rbindex 6bf566c3412..9e03e5780af 100644--- a/themes/horizon/spec/system/sidebar_topic_button_spec.rb+++ b/themes/horizon/spec/system/sidebar_topic_button_spec.rb@@ -2,6 +2,7 @@RSpec.describe "Sidebar New Topic Button" dobefore { upload_theme }+fab!(:group)fab!(:user) { Fabricate(:user, trust_level: 3, groups: [group]) }fab!(:category)