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 describe "handling duplicates" do
it "ensures only unique topic_id and answer_post_id are inserted" do it "ensures only unique topic_id and answer_post_id are inserted" do
topic = Fabricate(:topic) topic = Fabricate(:topic)
topic1 = Fabricate(:topic)
post1 = Fabricate(:post, topic: topic) post1 = Fabricate(:post, topic: topic)
Fabricate( TopicCustomField.create!(
:topic_custom_field, topic_id: topic.id,
topic: topic,
name: "accepted_answer_post_id", name: "accepted_answer_post_id",
value: post1.id.to_s, value: post1.id.to_s,
) )
# explicit duplicate # explicit duplicate
Fabricate( TopicCustomField.create!(
:topic_custom_field, topic_id: topic1.id,
topic: topic,
name: "accepted_answer_post_id", name: "accepted_answer_post_id",
value: post1.id.to_s, value: post1.id.to_s,
) )
second_topic = Fabricate(:topic) second_topic = Fabricate(:topic)
post2 = Fabricate(:post, topic: second_topic) post2 = Fabricate(:post, topic: second_topic)
Fabricate( TopicCustomField.create!(
:topic_custom_field, topic_id: second_topic.id,
topic: second_topic,
name: "accepted_answer_post_id", name: "accepted_answer_post_id",
value: post2.id.to_s, value: post2.id.to_s,
) )