Sha256: 60a8ab7e9fe05587e83abda0039eb8509e7305497d4ea654dc4ca5f5e2e28fa8
Contents?: true
Size: 1.21 KB
Versions: 1
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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-0.1.0 | decidim-comments/spec/types/commentable_mutation_type_spec.rb |