Sha256: 42af5c6bf04c31b91473b9cca3148890532da14383c12bc9b5ac7f205dcad97c

Contents?: true

Size: 909 Bytes

Versions: 1

Compression:

Stored size: 909 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"
require "decidim/api/test/type_context"

module Decidim
  module Api
    describe MutationType do
      include_context "graphql type"

      describe "commentable" do
        let!(:commentable) { create(:dummy_resource) }
        let(:query) do
          "{ commentable(id: \"#{commentable.id}\", type: \"#{commentable.commentable_type}\") { id } }"
        end

        it "should fetch the commentable given its id and commentable_type" do
          expect(response["commentable"]).to include("id" => commentable.id.to_s)
        end
      end

      describe "comment" do
        let!(:comment) { create(:comment) }
        let(:query) { "{ comment(id: \"#{comment.id}\") { id } }" }

        it "should fetch the comment given its id" do
          expect(response["comment"]).to include("id" => comment.id.to_s)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-0.1.0 decidim-comments/spec/types/mutation_type_spec.rb