2021-01-29 00:20:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
RSpec.describe IntegrationPolicy, :models do
|
2021-01-29 00:20:46 +05:30
|
|
|
let_it_be(:user) { create(:user) }
|
2021-04-29 21:17:54 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
let(:project) { integration.project }
|
|
|
|
|
|
|
|
subject(:policy) { Ability.policy_for(user, integration) }
|
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
context 'when the integration is a prometheus_integration' do
|
|
|
|
let(:integration) { create(:prometheus_integration) }
|
2021-01-29 00:20:46 +05:30
|
|
|
|
|
|
|
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
|