Sha256: 3c8bc30055f003efd570526a88df087ec7b423cac997765bdad09d0c7e9bb1f5

Contents?: true

Size: 1.21 KB

Versions: 41

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

require "spec_helper"

shared_context "when it's a comment event" do
  include Decidim::ComponentPathHelper
  include Decidim::SanitizeHelper

  include_context "when a simple event"

  let(:resource) { comment.commentable }

  let(:comment) { create :comment }
  let(:comment_author) { comment.author }
  let(:normalized_comment_author) { comment.author }
  let(:comment_author_name) { decidim_html_escape comment.author.name }

  let(:extra) { { comment_id: comment.id } }
  let(:resource_title) { decidim_html_escape(translated(resource.title)) }
  let(:user_group) do
    user_group = create(:user_group, :verified, organization: organization, users: [comment_author])
    comment.update!(user_group: user_group)
    user_group
  end
end

shared_examples_for "a comment event" do
  it_behaves_like "a simple event"

  describe "author" do
    it "returns the comment author" do
      if defined? user_group_author
        expect(subject.author).to eq(user_group_author)
      else
        expect(subject.author).to eq(comment_author)
      end
    end
  end

  describe "resource_text" do
    it "outputs the comment body" do
      expect(subject.resource_text).to eq comment.formatted_body
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
decidim-comments-0.26.10 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.26.9 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.27.5 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.26.8 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.27.4 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.27.3 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.26.7 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.26.5 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.27.2 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.27.1 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.26.4 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.27.0 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.26.3 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.27.0.rc2 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.27.0.rc1 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.26.2 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.26.1 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.26.0 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.26.0.rc2 lib/decidim/comments/test/shared_examples/comment_event.rb
decidim-comments-0.26.0.rc1 lib/decidim/comments/test/shared_examples/comment_event.rb