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

service_policy_spec.rb « policies « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 84c74ca7e31a2c3d39dc19e815290051fc3f91ef (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe ServicePolicy, :models do
  let_it_be(:user) { create(:user) }

  let(:project) { integration.project }

  subject(:policy) { Ability.policy_for(user, integration) }

  context 'when the integration is a prometheus_service' do
    let(:integration) { create(:prometheus_service) }

    describe 'rules' do
      it { is_expected.to be_disallowed :admin_project }

      context 'when maintainer' do
        before do
          project.add_maintainer(user)
        end

        it { is_expected.to be_allowed :admin_project }
      end
    end
  end
end