Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 14:10:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 14:10:13 +0300
commit0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch)
tree7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /spec/lib/gitlab/git_access_wiki_spec.rb
parent72123183a20411a36d607d70b12d57c484394c8e (diff)
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'spec/lib/gitlab/git_access_wiki_spec.rb')
-rw-r--r--spec/lib/gitlab/git_access_wiki_spec.rb36
1 files changed, 33 insertions, 3 deletions
diff --git a/spec/lib/gitlab/git_access_wiki_spec.rb b/spec/lib/gitlab/git_access_wiki_spec.rb
index de3e674c3a7..11c19c7d3f0 100644
--- a/spec/lib/gitlab/git_access_wiki_spec.rb
+++ b/spec/lib/gitlab/git_access_wiki_spec.rb
@@ -18,7 +18,7 @@ RSpec.describe Gitlab::GitAccessWiki do
redirected_path: redirected_path)
end
- RSpec.shared_examples 'wiki access by level' do
+ RSpec.shared_examples 'download wiki access by level' do
where(:project_visibility, :project_member?, :wiki_access_level, :wiki_repo?, :expected_behavior) do
[
# Private project - is a project member
@@ -103,7 +103,7 @@ RSpec.describe Gitlab::GitAccessWiki do
subject { access.check('git-upload-pack', Gitlab::GitAccess::ANY) }
context 'when actor is a user' do
- it_behaves_like 'wiki access by level'
+ it_behaves_like 'download wiki access by level'
end
context 'when the actor is a deploy token' do
@@ -116,6 +116,36 @@ RSpec.describe Gitlab::GitAccessWiki do
subject { access.check('git-upload-pack', changes) }
+ context 'when the wiki feature is enabled' do
+ let(:wiki_access_level) { ProjectFeature::ENABLED }
+
+ it { expect { subject }.not_to raise_error }
+ end
+
+ context 'when the wiki feature is disabled' do
+ let(:wiki_access_level) { ProjectFeature::DISABLED }
+
+ it { expect { subject }.to raise_wiki_forbidden }
+ end
+
+ context 'when the wiki feature is private' do
+ let(:wiki_access_level) { ProjectFeature::PRIVATE }
+
+ it { expect { subject }.to raise_wiki_forbidden }
+ end
+ end
+
+ context 'when the actor is a deploy key' do
+ let_it_be(:actor) { create(:deploy_key) }
+ let_it_be(:deploy_key_project) { create(:deploy_keys_project, project: project, deploy_key: actor) }
+ 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 }
@@ -140,7 +170,7 @@ RSpec.describe Gitlab::GitAccessWiki do
subject { access.check('git-upload-pack', changes) }
- it_behaves_like 'wiki access by level'
+ it_behaves_like 'download wiki access by level'
end
end