Welcome to mirror list, hosted at ThFree Co, Russian Federation.

access_control_ce_shared_examples.rb « protected_tags « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f308b4ad372b1c9c00bbacfcb195a5d017ada77b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

RSpec.shared_examples "protected tags > access control > CE" do
  ProtectedRef::AccessLevel.human_access_levels.each do |(access_type_id, access_type_name)|
    it "allows creating protected tags that #{access_type_name} can create" do
      visit project_protected_tags_path(project)

      set_protected_tag_name('master')
      set_allowed_to('create', access_type_name)
      click_on_protect

      expect(ProtectedTag.count).to eq(1)
      expect(ProtectedTag.last.create_access_levels.map(&:access_level)).to eq([access_type_id])
    end

    it "allows updating protected tags so that #{access_type_name} can create them" do
      visit project_protected_tags_path(project)

      set_protected_tag_name('master')
      set_allowed_to('create', 'No one')
      click_on_protect

      expect(ProtectedTag.count).to eq(1)

      set_allowed_to('create', access_type_name, form: '.protected-tags-list')

      wait_for_requests

      expect(ProtectedTag.last.create_access_levels.map(&:access_level)).to include(access_type_id)
    end
  end
end