Sha256: 1f255620b2dd786ca8c00fc433d9308784b83fa35703ea0c0aa118fc9ac1a51b
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true require "spec_helper" require "decidim/api/test/type_context" module Decidim module Comments describe CommentMutationType do include_context "graphql type" let(:model) { create(:comment) } describe "upVote" do let(:query) { "{ upVote { upVoted } }" } before do allow(Decidim::Comments::VoteComment).to receive(:call).with(model, current_user, weight: 1).and_return(model) end it "should call UpVoteComment command" do expect(model).to receive(:up_voted_by?).with(current_user).and_return(true) expect(response["upVote"]).to include("upVoted" => true) end end describe "downVote" do let(:query) { "{ downVote { downVoted } }" } before do allow(Decidim::Comments::VoteComment).to receive(:call).with(model, current_user, weight: -1).and_return(model) end it "should call UpVoteComment command" do expect(model).to receive(:down_voted_by?).with(current_user).and_return(true) expect(response["downVote"]).to include("downVoted" => true) 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/comment_mutation_type_spec.rb |