Sha256: 000fe11b0eadf20263bc851217cce734d7ec8efb617bead9198ba040a5f3da9a

Contents?: true

Size: 839 Bytes

Versions: 7

Compression:

Stored size: 839 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

shared_examples_for "coauthorable interface" do
  describe "author" do
    let(:author) { model.creator_author }

    describe "with a regular user" do
      let(:query) { "{ author { name } }" }

      it "includes the user's ID" do
        expect(response["author"]["name"]).to eq(author.name)
      end
    end

    describe "with a user group" do
      let(:user_group) { create(:user_group, :verified, organization: model.participatory_space.organization, users: [author]) }
      let(:query) { "{ author { name } }" }

      before do
        coauthorship = model.coauthorships.first
        coauthorship.update!(user_group: user_group)
      end

      it "includes the user's ID" do
        expect(response["author"]["name"]).to eq(user_group.name)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-core-0.14.4 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.14.3 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.14.2 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.14.1 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.13.1 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.13.0 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.13.0.pre1 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb