Sha256: 92a515afef3db7fd46d5eaacaa04c625869dd69c466327f9480f427e7b55c770

Contents?: true

Size: 1.02 KB

Versions: 46

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

# When using these shared examples, make sure there are no prior requests within
# the same group of examples where this is included. Otherwise you may end up
# in race conditions that cause these to fail as explained at:
# https://github.com/decidim/decidim/pull/6161
shared_examples "editable content for admins" do
  describe "edit link" do
    before do
      relogin_as user
      visit target_path
    end

    context "when I'm an admin user" do
      let(:user) { create(:user, :admin, :confirmed, organization: organization) }

      it "has a link to edit the content at the admin" do
        within ".topbar" do
          expect(page).to have_link("Edit", href: /admin/)
        end
      end
    end

    context "when I'm a regular user" do
      let(:user) { create(:user, :confirmed, organization: organization) }

      it "does not have a link to edit the content at the admin" do
        within ".topbar" do
          expect(page).not_to have_link("Edit")
        end
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
decidim-core-0.27.9 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.27.8 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.27.7 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.27.6 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.26.10 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.26.9 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.27.5 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.26.8 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.27.4 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.27.3 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.26.7 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.26.5 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.27.2 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.27.1 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.26.4 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.27.0 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.26.3 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.27.0.rc2 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.27.0.rc1 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb
decidim-core-0.26.2 lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb