Sha256: 069ee078b2449f97699b2553ca8d8b69465f0df9fb38c9ad85bb00f57d330e03

Contents?: true

Size: 894 Bytes

Versions: 14

Compression:

Stored size: 894 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 "returns the user's name as the author name" 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 returns the user group's name as the author name" do
        expect(response["author"]["name"]).to eq(user_group.name)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
decidim-core-0.20.1 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.20.0 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.19.1 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.18.1 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.19.0 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.17.2 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.18.0 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.17.1 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.16.1 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.17.0 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.16.0 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.15.2 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.15.1 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb
decidim-core-0.15.0 lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb