TagName サニタイズ(#281) (#289)

#281

#281

Merge remote-tracking branch 'origin/main' into feature/281

#281

#281 テストまだ通ってないので要確認

Co-authored-by: miteruzo <miteruzo@naver.com>
Reviewed-on: #289
This commit was merged in pull request #289.
This commit is contained in:
2026-03-12 21:58:16 +09:00
parent 176519b929
commit d772cceb5e
16 changed files with 351 additions and 27 deletions
+11 -1
View File
@@ -1,12 +1,22 @@
FactoryBot.define do
factory :tag do
transient do
name { nil }
end
category { :general }
post_count { 0 }
association :tag_name
after(:build) do |tag, evaluator|
tag.name = evaluator.name if evaluator.name.present?
end
trait :nico do
category { :nico }
tag_name { association(:tag_name, name: "nico:#{ SecureRandom.hex(4) }") }
transient do
name { "nico:#{ SecureRandom.hex(4) }" }
end
end
end
end