このコミットが含まれているのは:
2026-09-26 20:23:11 +09:00
コミット 5abb6cca98
39個のファイルの変更、1005行の追加、377行の削除
+17 -1
ファイルの表示
@@ -1,5 +1,21 @@
FactoryBot.define do
factory :tag_name do
name { "tag-#{SecureRandom.hex(4)}" }
language_code { 'ja' }
script_code { 'Jpan' }
primary_flg { true }
sequence(:name) { |number| "tag-#{ SecureRandom.hex(4) }-#{ number }" }
trait :alias do
primary_flg { false }
after(:create) do |tag_name|
owner = tag_name.canonical&.tag
raise ArgumentError, 'alias requires a canonical tag' unless owner
# The alias validation still rejects tag_id; its contract is tested separately.
tag_name.update_columns(tag_id: owner.id)
tag_name.association(:tag).reset
end
end
end
end
+5
ファイルの表示
@@ -6,10 +6,15 @@ FactoryBot.define do
category { :general }
post_count { 0 }
association :tag_name
after(:build) do |tag, evaluator|
tag.name = evaluator.name if evaluator.name.present?
end
after(:create) do |tag|
tag.tag_name.update!(tag:) if tag.tag_name.tag_id != tag.id
end
end
end