Sha256: 226b9373d104448a0f6762e5dbad7eaf07e6a6c9866f52665f7da8aeb4fd3127

Contents?: true

Size: 894 Bytes

Versions: 10

Compression:

Stored size: 894 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

shared_examples_for "authorable interface" do
  describe "author" do
    describe "with a regular user" do
      let(:author) { create(:user, organization: model.participatory_space.organization) }
      let(:query) { "{ author { name } }" }

      before do
        model.update(author: author, user_group: nil)
      end

      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, organization: model.participatory_space.organization) }
      let(:query) { "{ author { name } }" }

      before do
        model.update(user_group: user_group, author: nil)
      end

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
decidim-core-0.13.1 lib/decidim/core/test/shared_examples/authorable_interface_examples.rb
decidim-core-0.12.2 lib/decidim/core/test/shared_examples/authorable_interface_examples.rb
decidim-core-0.13.0 lib/decidim/core/test/shared_examples/authorable_interface_examples.rb
decidim-core-0.12.1 lib/decidim/core/test/shared_examples/authorable_interface_examples.rb
decidim-core-0.13.0.pre1 lib/decidim/core/test/shared_examples/authorable_interface_examples.rb
decidim-core-0.12.0 lib/decidim/core/test/shared_examples/authorable_interface_examples.rb
decidim-core-0.11.2 lib/decidim/core/test/shared_examples/authorable_interface_examples.rb
decidim-core-0.12.0.pre lib/decidim/core/test/shared_examples/authorable_interface_examples.rb
decidim-core-0.11.1 lib/decidim/core/test/shared_examples/authorable_interface_examples.rb
decidim-core-0.11.0.pre1 lib/decidim/core/test/shared_examples/authorable_interface_examples.rb