lib/decidim/comments/test/factories.rb in decidim-comments-0.14.4 vs lib/decidim/comments/test/factories.rb in decidim-comments-0.15.0
- old
+ new
@@ -6,9 +6,22 @@
factory :comment, class: "Decidim::Comments::Comment" do
author { build(:user, organization: commentable.organization) }
commentable { build(:dummy_resource) }
root_commentable { commentable }
body { Faker::Lorem.paragraph }
+
+ trait :comment_on_comment do
+ author { build(:user, organization: root_commentable.organization) }
+ commentable do
+ build(
+ :comment,
+ author: author,
+ root_commentable: root_commentable,
+ commentable: root_commentable
+ )
+ end
+ root_commentable { build(:dummy_resource) }
+ end
end
factory :comment_vote, class: "Decidim::Comments::CommentVote" do
comment { build(:comment) }
author { build(:user, organization: comment.organization) }