summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-12-03 10:11:19 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-03 10:11:19 +0000
commit9a1e9397b4e378e052af12c697a9fbfd70a24bf5 (patch)
treebda9287282dfaefa0c717f092947f79839e07102 /spec/lib/gitlab
parent9fb816facef888b8fcdbc443af304105c480547b (diff)
downloadgitlab-ce-9a1e9397b4e378e052af12c697a9fbfd70a24bf5.tar.gz
Add latest changes from gitlab-org/security/gitlab@14-5-stable-ee
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r--spec/lib/gitlab/git_access_wiki_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git_access_wiki_spec.rb b/spec/lib/gitlab/git_access_wiki_spec.rb
index 5ada8a6ef40..27175dc8c44 100644
--- a/spec/lib/gitlab/git_access_wiki_spec.rb
+++ b/spec/lib/gitlab/git_access_wiki_spec.rb
@@ -79,5 +79,30 @@ RSpec.describe Gitlab::GitAccessWiki do
let(:message) { include('wiki') }
end
end
+
+ context 'when the actor is a deploy token' do
+ let_it_be(:actor) { create(:deploy_token, projects: [project]) }
+ let_it_be(:user) { actor }
+
+ before do
+ project.project_feature.update_attribute(:wiki_access_level, wiki_access_level)
+ end
+
+ subject { access.check('git-upload-pack', changes) }
+
+ context 'when the wiki is enabled' do
+ let(:wiki_access_level) { ProjectFeature::ENABLED }
+
+ it { expect { subject }.not_to raise_error }
+ end
+
+ context 'when the wiki is disabled' do
+ let(:wiki_access_level) { ProjectFeature::DISABLED }
+
+ it_behaves_like 'forbidden git access' do
+ let(:message) { 'You are not allowed to download files from this wiki.' }
+ end
+ end
+ end
end
end