Sha256: 00ac99d3c3d2b7310757b19c81dbe723897f94e164b384681963388e8d1e1402

Contents?: true

Size: 680 Bytes

Versions: 2

Compression:

Stored size: 680 Bytes

Contents

# frozen_string_literal: true
require "decidim/core/test/factories"
require "decidim/admin/test/factories"

FactoryGirl.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

2 entries across 2 versions & 2 rubygems

Version Path
decidim-comments-0.1.0 lib/decidim/comments/test/factories.rb
decidim-0.1.0 decidim-comments/lib/decidim/comments/test/factories.rb