A platform for community discussion. Free, open, simple.
DEV: Fix tags_locale_detection_backfill spec flakes (#39553)
Jarek Radosz580a15afb868
diff --git a/plugins/discourse-ai/spec/jobs/scheduled/posts_locale_detection_backfill_spec.rb b/plugins/discourse-ai/spec/jobs/scheduled/posts_locale_detection_backfill_spec.rbindex 1115db44a8f..2fe52a69bfb 100644--- a/plugins/discourse-ai/spec/jobs/scheduled/posts_locale_detection_backfill_spec.rb+++ b/plugins/discourse-ai/spec/jobs/scheduled/posts_locale_detection_backfill_spec.rb@@ -6,11 +6,7 @@ describe Jobs::PostsLocaleDetectionBackfill dofab!(:post) { Fabricate(:post, locale: nil) }before do- fake_llm = assign_fake_provider_to(:ai_default_llm_model)-- # Update the locale detector agent (ID -27) with the fake LLM- locale_detector = AiAgent.find_by(id: -27)- locale_detector.update!(default_llm_id: fake_llm.id) if locale_detector+ assign_fake_provider_to(:ai_default_llm_model)enable_current_pluginSiteSetting.ai_translation_enabled = truediff --git a/plugins/discourse-ai/spec/jobs/scheduled/topics_locale_detection_backfill_spec.rb b/plugins/discourse-ai/spec/jobs/scheduled/topics_locale_detection_backfill_spec.rbindex 8735fb77195..10d4c7c1fe7 100644--- a/plugins/discourse-ai/spec/jobs/scheduled/topics_locale_detection_backfill_spec.rb+++ b/plugins/discourse-ai/spec/jobs/scheduled/topics_locale_detection_backfill_spec.rb@@ -6,11 +6,7 @@ describe Jobs::TopicsLocaleDetectionBackfill dofab!(:topic) { Fabricate(:topic, locale: nil) }before do- fake_llm = assign_fake_provider_to(:ai_default_llm_model)-- # Update the locale detector agent (ID -27) with the fake LLM- locale_detector = AiAgent.find_by(id: -27)- locale_detector.update!(default_llm_id: fake_llm.id) if locale_detector+ assign_fake_provider_to(:ai_default_llm_model)enable_current_pluginSiteSetting.ai_translation_enabled = truediff --git a/plugins/discourse-ai/spec/plugin_helper.rb b/plugins/discourse-ai/spec/plugin_helper.rbindex 9ac1e685732..340664c0a40 100644--- a/plugins/discourse-ai/spec/plugin_helper.rb+++ b/plugins/discourse-ai/spec/plugin_helper.rb@@ -20,4 +20,7 @@ module DiscourseAi::ChatBotHelperendend-RSpec.configure { |config| config.include DiscourseAi::ChatBotHelper }+RSpec.configure do |config|+ config.include DiscourseAi::ChatBotHelper+ config.before { AiAgent.agent_cache.flush! }+end