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

cascading_settings_shared_examples.rb « features « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 395f4fc54e0e5043b326af46aba87ae5aa999fc1 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# frozen_string_literal: true

RSpec.shared_examples 'a cascading setting' do
  context 'when setting is enforced by an ancestor group' do
    before do
      visit group_path

      page.within form_group_selector do
        find(setting_field_selector).check
        find('[data-testid="enforce-for-all-subgroups-checkbox"]').check
      end

      click_save_button
    end

    shared_examples 'subgroup settings are disabled' do
      it 'disables setting in subgroups' do
        visit subgroup_path

        expect(find("#{setting_field_selector}[disabled]")).to be_checked
      end
    end

    include_examples 'subgroup settings are disabled'

    context 'when use_traversal_ids_for_ancestors is disabled' do
      before do
        stub_feature_flags(use_traversal_ids_for_ancestors: false)
      end

      include_examples 'subgroup settings are disabled'
    end

    it 'does not show enforcement checkbox in subgroups' do
      visit subgroup_path

      expect(page).not_to have_selector '[data-testid="enforce-for-all-subgroups-checkbox"]'
    end

    it 'displays lock icon with popover', :js do
      visit subgroup_path

      page.within form_group_selector do
        find('[data-testid="cascading-settings-lock-icon"]').click
      end

      page.within '[data-testid="cascading-settings-lock-popover"]' do
        expect(page).to have_text 'This setting has been enforced by an owner of Foo bar.'
        expect(page).to have_link 'Foo bar', href: setting_path
      end
    end
  end
end