blob: c90d9802300b52b93afcfbe7fd1846f80f7c10b4 (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::GitAccessDesign do
include DesignManagementTestHelpers
let_it_be(:project) { create(:project) }
let_it_be(:user) { project.first_owner }
let(:protocol) { 'web' }
let(:actor) { user }
subject(:access) do
described_class.new(actor, project, protocol, authentication_abilities: [:read_project, :download_code, :push_code])
end
describe '#check' do
subject { access.check('git-receive-pack', ::Gitlab::GitAccess::ANY) }
before do
enable_design_management
end
context 'when the user is allowed to manage designs' do
it do
is_expected.to be_a(::Gitlab::GitAccessResult::Success)
end
end
context 'when the user is not allowed to manage designs' do
let_it_be(:user) { create(:user) }
it 'raises an error' do
expect { subject }.to raise_error(::Gitlab::GitAccess::ForbiddenError)
end
end
context 'when the protocol is not web' do
let(:protocol) { 'https' }
it 'raises an error' do
expect { subject }.to raise_error(::Gitlab::GitAccess::ForbiddenError)
end
end
end
end
|