debian-mirror-gitlab/spec/lib/gitlab/git_access_design_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

47 lines
1.2 KiB
Ruby
Raw Normal View History

2020-05-24 23:13:21 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::GitAccessDesign do
2020-05-24 23:13:21 +05:30
include DesignManagementTestHelpers
let_it_be(:project) { create(:project) }
2022-04-04 11:22:00 +05:30
let_it_be(:user) { project.first_owner }
2021-06-08 01:23:25 +05:30
2020-05-24 23:13:21 +05:30
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