blob: 1b7478ae2cffc613f311acf2b61d4d1c84514e3f (
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
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe ProjectHookPolicy, feature_category: :webhooks do
let_it_be(:user) { create(:user) }
let(:hook) { create(:project_hook) }
subject(:policy) { described_class.new(user, hook) }
context 'when the user is not a maintainer' do
before do
hook.project.add_developer(user)
end
it "cannot read and destroy web-hooks" do
expect(policy).to be_disallowed(:destroy_web_hook)
end
end
context 'when the user is a maintainer' do
before do
hook.project.add_maintainer(user)
end
it "can read and destroy web-hooks" do
expect(policy).to be_allowed(:destroy_web_hook)
end
end
end
|