lib/decidim/comments/test/factories.rb in decidim-comments-0.28.0 vs lib/decidim/comments/test/factories.rb in decidim-comments-0.28.1

- old
+ new

@@ -2,12 +2,15 @@ require "decidim/core/test/factories" FactoryBot.define do factory :comment, class: "Decidim::Comments::Comment" do - author { build(:user, organization: commentable.organization) } - commentable { build(:dummy_resource) } + transient do + skip_injection { false } + end + author { build(:user, organization: commentable.organization, skip_injection:) } + commentable { build(:dummy_resource, skip_injection:) } root_commentable { commentable } body { Decidim::Faker::Localized.paragraph } participatory_space { commentable.try(:participatory_space) } after(:build) do |comment, evaluator| @@ -23,25 +26,29 @@ created_at { 1.day.ago } deleted_at { 1.hour.ago } end trait :comment_on_comment do - author { build(:user, organization: root_commentable.organization) } + author { build(:user, organization: root_commentable.organization, skip_injection:) } commentable do build( :comment, author:, root_commentable:, - commentable: root_commentable + commentable: root_commentable, + skip_injection: ) end - root_commentable { build(:dummy_resource) } + root_commentable { build(:dummy_resource, skip_injection:) } end end factory :comment_vote, class: "Decidim::Comments::CommentVote" do - comment { build(:comment) } - author { build(:user, organization: comment.organization) } + transient do + skip_injection { false } + end + comment { build(:comment, skip_injection:) } + author { build(:user, organization: comment.organization, skip_injection:) } weight { [-1, 1].sample } trait :up_vote do weight { 1 } end