Sha256: 724ac3f55e4779099c2c9f9c993fe60e11124091bc019bb2cffaab738e7c9493

Contents?: true

Size: 641 Bytes

Versions: 21

Compression:

Stored size: 641 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

21 entries across 21 versions & 1 rubygems

Version Path
decidim-comments-0.13.1 lib/decidim/comments/test/factories.rb
decidim-comments-0.12.2 lib/decidim/comments/test/factories.rb
decidim-comments-0.13.0 lib/decidim/comments/test/factories.rb
decidim-comments-0.12.1 lib/decidim/comments/test/factories.rb
decidim-comments-0.13.0.pre1 lib/decidim/comments/test/factories.rb
decidim-comments-0.12.0 lib/decidim/comments/test/factories.rb
decidim-comments-0.11.2 lib/decidim/comments/test/factories.rb
decidim-comments-0.12.0.pre lib/decidim/comments/test/factories.rb
decidim-comments-0.11.1 lib/decidim/comments/test/factories.rb
decidim-comments-0.11.0.pre1 lib/decidim/comments/test/factories.rb
decidim-comments-0.10.1 lib/decidim/comments/test/factories.rb
decidim-comments-0.10.0 lib/decidim/comments/test/factories.rb
decidim-comments-0.9.3 lib/decidim/comments/test/factories.rb
decidim-comments-0.9.2 lib/decidim/comments/test/factories.rb
decidim-comments-0.9.1 lib/decidim/comments/test/factories.rb
decidim-comments-0.9.0 lib/decidim/comments/test/factories.rb
decidim-comments-0.8.4 lib/decidim/comments/test/factories.rb
decidim-comments-0.8.3 lib/decidim/comments/test/factories.rb
decidim-comments-0.8.2 lib/decidim/comments/test/factories.rb
decidim-comments-0.8.1 lib/decidim/comments/test/factories.rb