summaryrefslogtreecommitdiff
path: root/spec/policies/alert_management/http_integration_policy_spec.rb
blob: 8e8348ad7f5b2a2428d1c0791437f04677c4517b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe AlertManagement::HttpIntegrationPolicy, :models do
  let(:integration) { create(:alert_management_http_integration) }
  let(:project) { integration.project }
  let(:user) { create(:user) }

  subject(:policy) { described_class.new(user, integration) }

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

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

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