Sha256: 3d60fc4f838d5318fa50048c2aa61b9a537ebe3df4aa6585b6889b85359b3735

Contents?: true

Size: 1.39 KB

Versions: 20

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

require "spec_helper"
require "decidim/api/test/type_context"

module Decidim
  module Comments
    describe CommentableType do
      include_context "graphql type"

      let(:model) { create(:dummy_resource) }
      let!(:comments) { create_list(:comment, 3, commentable: model) }

      describe "acceptsNewComments" do
        let(:query) { "{ acceptsNewComments }" }

        it "returns the 'accepts_new_comments?' method value" do
          expect(response).to include("acceptsNewComments" => model.accepts_new_comments?)
        end
      end

      describe "commentsHaveAlignment" do
        let(:query) { "{ commentsHaveAlignment }" }

        it "returns the 'comments_have_alignment?' method value" do
          expect(response).to include("commentsHaveAlignment" => model.comments_have_alignment?)
        end
      end

      describe "commentsHaveVotes" do
        let(:query) { "{ commentsHaveVotes }" }

        it "returns the 'comments_have_votes?' method value" do
          expect(response).to include("commentsHaveVotes" => model.comments_have_votes?)
        end
      end

      describe "comments" do
        let(:query) { "{ comments { id } }" }

        it "returns the commentable comments" do
          model.comments.each do |comment|
            expect(response["comments"]).to include("id" => comment.id.to_s)
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
decidim-0.6.8 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.6.7 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.6.6 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.6.5 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.6.4 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.6.3 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.6.2 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.6.1 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.6.0 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.5.1 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.5.0 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.4.4 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.4.3 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.4.2 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.4.1 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.4.0 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.3.2 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.3.1 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.3.0 decidim-comments/spec/types/commentable_type_spec.rb
decidim-0.2.0 decidim-comments/spec/types/commentable_type_spec.rb