Sha256: 706980b14d2819b46f610ede8c541e1bdb59d14e383fdef86c89f51e875e63d2
Contents?: true
Size: 1.21 KB
Versions: 11
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true require "spec_helper" require "decidim/api/test/type_context" module Decidim module Comments describe CommentableMutationType do include_context "graphql type" let(:participatory_process) { create(:participatory_process, organization: current_organization) } let(:feature) { create(:feature, participatory_process: participatory_process) } let(:model) { create(:dummy_resource, feature: feature) } let(:body) { "test" } let(:alignment) { 1 } describe "addComment" do let(:query) do "{ addComment(body: \"#{body}\", alignment: #{alignment}) { body } }" end it "calls CreateComment command" do params = { "comment" => { "body" => body, "alignment" => alignment, "user_group_id" => nil } } expect(Decidim::Comments::CommentForm).to receive(:from_params).with(params).and_call_original expect(Decidim::Comments::CreateComment).to receive(:call).with( an_instance_of(Decidim::Comments::CommentForm), current_user, model ).and_call_original expect(response["addComment"]).to include("body" => body) end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems