fab local

This commit is contained in:
Nat 2025-03-26 22:08:24 +08:00
parent 2e287b661e
commit bb05cb7b46
No known key found for this signature in database
GPG Key ID: 4938B35D927EC773
1 changed files with 7 additions and 9 deletions

View File

@ -8,26 +8,24 @@ RSpec.describe CopySolvedTopicCustomFieldToDiscourseSolvedSolvedTopics, type: :m
describe "handling duplicates" do
it "ensures only unique topic_id and answer_post_id are inserted" do
topic = Fabricate(:topic)
topic1 = Fabricate(:topic)
post1 = Fabricate(:post, topic: topic)
Fabricate(
:topic_custom_field,
topic: topic,
TopicCustomField.create!(
topic_id: topic.id,
name: "accepted_answer_post_id",
value: post1.id.to_s,
)
# explicit duplicate
Fabricate(
:topic_custom_field,
topic: topic,
TopicCustomField.create!(
topic_id: topic1.id,
name: "accepted_answer_post_id",
value: post1.id.to_s,
)
second_topic = Fabricate(:topic)
post2 = Fabricate(:post, topic: second_topic)
Fabricate(
:topic_custom_field,
topic: second_topic,
TopicCustomField.create!(
topic_id: second_topic.id,
name: "accepted_answer_post_id",
value: post2.id.to_s,
)