From 689ba22db0a84049a5874995a826760229986c7b Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Tue, 25 Oct 2022 06:33:36 +0800 Subject: [PATCH] DEV: Remove harded id when fabricating in tests (#18729) (#18730) Hardcoding ids always lead to sadness for our test suite --- spec/components/topic_view_spec.rb | 2 +- spec/serializers/post_serializer_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/components/topic_view_spec.rb b/spec/components/topic_view_spec.rb index e01540f4040..60466fbaa04 100644 --- a/spec/components/topic_view_spec.rb +++ b/spec/components/topic_view_spec.rb @@ -996,7 +996,7 @@ RSpec.describe TopicView do subject(:topic_view) { described_class.new(topic, user) } let(:topic) { Fabricate(:topic) } - let(:user) { Fabricate(:user, id: 1) } + let(:user) { Fabricate(:user) } let(:category) { topic.category } before do diff --git a/spec/serializers/post_serializer_spec.rb b/spec/serializers/post_serializer_spec.rb index 3699efbab8a..e00d98725a4 100644 --- a/spec/serializers/post_serializer_spec.rb +++ b/spec/serializers/post_serializer_spec.rb @@ -107,7 +107,7 @@ describe PostSerializer do end context "with a hidden post with add_raw enabled" do - let(:user) { Fabricate(:user, id: -99999) } + let(:user) { Fabricate(:user) } let(:raw) { "Raw contents of the post." } context "with a public post" do