Sha256: ba5c1ade663ccd5e907fe868c59edc9194e0a8f7ac9d4daf6c0f64a150ef7139

Contents?: true

Size: 643 Bytes

Versions: 6

Compression:

Stored size: 643 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) }
    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

6 entries across 6 versions & 2 rubygems

Version Path
decidim-comments-0.0.8.1 lib/decidim/comments/test/factories.rb
decidim-0.0.8.1 decidim-comments/lib/decidim/comments/test/factories.rb
decidim-comments-0.0.7 lib/decidim/comments/test/factories.rb
decidim-0.0.7 decidim-comments/lib/decidim/comments/test/factories.rb
decidim-comments-0.0.6 lib/decidim/comments/test/factories.rb
decidim-0.0.6 decidim-comments/lib/decidim/comments/test/factories.rb