summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/policies/resource_access_token_shared_examples.rb
blob: 7710e756e5b97730cfa246818c70c4160a710df6 (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 'Self-managed Core resource access tokens' do
  before do
    allow(::Gitlab).to receive(:com?).and_return(false)
  end

  context 'with owner' do
    let(:current_user) { owner }

    it { is_expected.to be_allowed(:admin_resource_access_tokens) }
  end

  context 'with developer' do
    let(:current_user) { developer }

    it { is_expected.not_to be_allowed(:admin_resource_access_tokens) }
  end
end

RSpec.shared_examples 'GitLab.com Core resource access tokens' do
  before do
    allow(::Gitlab).to receive(:com?).and_return(true)
    stub_ee_application_setting(should_check_namespace_plan: true)
  end

  context 'with owner' do
    let(:current_user) { owner }

    it { is_expected.not_to be_allowed(:admin_resource_access_tokens) }
  end
end