Sha256: 2ee34d5060d66a480b58be8cf8b6745b7a54c750979c9ab99179ec856a65566c

Contents?: true

Size: 648 Bytes

Versions: 4

Compression:

Stored size: 648 Bytes

Contents

# frozen_string_literal: true

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) }
    root_commentable { commentable }
    body { Faker::Lorem.paragraph }
  end

  factory :comment_vote, class: "Decidim::Comments::CommentVote" do
    comment { build(:comment) }
    author { build(:user, organization: comment.organization) }
    weight { [-1, 1].sample }

    trait :up_vote do
      weight { 1 }
    end

    trait :down_vote do
      weight { -1 }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-comments-0.14.4 lib/decidim/comments/test/factories.rb
decidim-comments-0.14.3 lib/decidim/comments/test/factories.rb
decidim-comments-0.14.2 lib/decidim/comments/test/factories.rb
decidim-comments-0.14.1 lib/decidim/comments/test/factories.rb