Sha256: 2b5eef578bb612afa12a233fb325aa144af2a898f7ce4b55873752f38761c2b8

Contents?: true

Size: 1002 Bytes

Versions: 7

Compression:

Stored size: 1002 Bytes

Contents

# frozen_string_literal: true

RSpec.shared_context "when creating a comment" do
  let(:organization) { create(:organization) }
  let(:participatory_process) { create(:participatory_process, organization:) }
  let(:component) { create(:component, participatory_space: participatory_process) }
  let(:user) { create(:user, organization:) }
  let(:author) { create(:user, organization:) }
  let(:dummy_resource) { create :dummy_resource, component: }
  let(:commentable) { dummy_resource }
  let(:body) { Faker::Lorem.paragraph }
  let(:alignment) { 1 }
  let(:user_group_id) { nil }
  let(:form_params) do
    {
      "comment" => {
        "body" => body,
        "alignment" => alignment,
        "user_group_id" => user_group_id,
        "commentable" => commentable
      }
    }
  end
  let(:form) do
    Decidim::Comments::CommentForm.from_params(
      form_params
    ).with_context(
      current_organization: organization
    )
  end
  let(:command) { described_class.new(form, author) }
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-comments-0.28.4 lib/decidim/comments/test/shared_examples/create_comment_context.rb
decidim-comments-0.28.3 lib/decidim/comments/test/shared_examples/create_comment_context.rb
decidim-comments-0.28.2 lib/decidim/comments/test/shared_examples/create_comment_context.rb
decidim-comments-0.28.1 lib/decidim/comments/test/shared_examples/create_comment_context.rb
decidim-comments-0.28.0 lib/decidim/comments/test/shared_examples/create_comment_context.rb
decidim-comments-0.28.0.rc5 lib/decidim/comments/test/shared_examples/create_comment_context.rb
decidim-comments-0.28.0.rc4 lib/decidim/comments/test/shared_examples/create_comment_context.rb