From a65c3ba079e5faabed9b8f23a276d07a879d6995 Mon Sep 17 00:00:00 2001 From: Selase Krakani <849886+s3lase@users.noreply.github.com> Date: Fri, 2 Dec 2022 03:28:05 +0000 Subject: [PATCH] FIX: Fix failing spec caused by unpersisted user instance (#19288) Active Record's `to_sql` method seems to return an empty string instead of the expected SQL query when called on a query involving an unpersisted model instance. This replaces the admin `user` used in the specs with a persisted instance. --- spec/components/search_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/components/search_spec.rb b/spec/components/search_spec.rb index f47ca2438ea..deb26f6d29f 100644 --- a/spec/components/search_spec.rb +++ b/spec/components/search_spec.rb @@ -953,7 +953,7 @@ describe Search do context 'post searching' do before do SiteSetting.tagging_enabled = true - DiscourseTagging.tag_topic_by_names(post.topic, Guardian.new(Fabricate.build(:admin)), [tag.name, uppercase_tag.name]) + DiscourseTagging.tag_topic_by_names(post.topic, Guardian.new(admin), [tag.name, uppercase_tag.name]) post.topic.save end