summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/features/tags/developer_creates_tag_spec.rb (renamed from spec/features/tags/master_creates_tag_spec.rb)7
-rw-r--r--spec/features/tags/developer_deletes_tag_spec.rb (renamed from spec/features/tags/master_deletes_tag_spec.rb)7
-rw-r--r--spec/features/tags/developer_updates_tag_spec.rb (renamed from spec/features/tags/master_updates_tag_spec.rb)7
-rw-r--r--spec/features/tags/developer_views_tags_spec.rb (renamed from spec/features/tags/master_views_tags_spec.rb)7
-rw-r--r--spec/lib/gitlab/checks/tag_check_spec.rb5
-rw-r--r--spec/lib/gitlab/git_access_spec.rb2
-rw-r--r--spec/policies/project_policy_spec.rb2
-rw-r--r--spec/requests/api/tags_spec.rb2
-rw-r--r--spec/support/shared_examples/policies/project_policy_shared_examples.rb1
9 files changed, 22 insertions, 18 deletions
diff --git a/spec/features/tags/master_creates_tag_spec.rb b/spec/features/tags/developer_creates_tag_spec.rb
index f80ddd050d7..b2ad7ed8f3f 100644
--- a/spec/features/tags/master_creates_tag_spec.rb
+++ b/spec/features/tags/developer_creates_tag_spec.rb
@@ -1,11 +1,12 @@
require 'spec_helper'
-describe 'Maintainer creates tag' do
+describe 'Developer creates tag' do
let(:user) { create(:user) }
- let(:project) { create(:project, :repository, namespace: user.namespace) }
+ let(:group) { create(:group) }
+ let(:project) { create(:project, :repository, namespace: group) }
before do
- project.add_maintainer(user)
+ project.add_developer(user)
sign_in(user)
end
diff --git a/spec/features/tags/master_deletes_tag_spec.rb b/spec/features/tags/developer_deletes_tag_spec.rb
index bdbbe645779..dc4c7a4fb0a 100644
--- a/spec/features/tags/master_deletes_tag_spec.rb
+++ b/spec/features/tags/developer_deletes_tag_spec.rb
@@ -1,11 +1,12 @@
require 'spec_helper'
-describe 'Maintainer deletes tag' do
+describe 'Developer deletes tag' do
let(:user) { create(:user) }
- let(:project) { create(:project, :repository, namespace: user.namespace) }
+ let(:group) { create(:group) }
+ let(:project) { create(:project, :repository, namespace: group) }
before do
- project.add_maintainer(user)
+ project.add_developer(user)
sign_in(user)
visit project_tags_path(project)
end
diff --git a/spec/features/tags/master_updates_tag_spec.rb b/spec/features/tags/developer_updates_tag_spec.rb
index d8b5b3c4cc4..1e11fc9e5d5 100644
--- a/spec/features/tags/master_updates_tag_spec.rb
+++ b/spec/features/tags/developer_updates_tag_spec.rb
@@ -1,11 +1,12 @@
require 'spec_helper'
-describe 'Maintainer updates tag' do
+describe 'Developer updates tag' do
let(:user) { create(:user) }
- let(:project) { create(:project, :repository, namespace: user.namespace) }
+ let(:group) { create(:group) }
+ let(:project) { create(:project, :repository, namespace: group) }
before do
- project.add_maintainer(user)
+ project.add_developer(user)
sign_in(user)
visit project_tags_path(project)
end
diff --git a/spec/features/tags/master_views_tags_spec.rb b/spec/features/tags/developer_views_tags_spec.rb
index 36cfeb5ed84..09e644c6b97 100644
--- a/spec/features/tags/master_views_tags_spec.rb
+++ b/spec/features/tags/developer_views_tags_spec.rb
@@ -1,7 +1,8 @@
require 'spec_helper'
-describe 'Maintainer views tags' do
+describe 'Developer views tags' do
let(:user) { create(:user) }
+ let(:group) { create(:group) }
before do
project.add_maintainer(user)
@@ -9,7 +10,7 @@ describe 'Maintainer views tags' do
end
context 'when project has no tags' do
- let(:project) { create(:project_empty_repo) }
+ let(:project) { create(:project_empty_repo, namespace: group) }
before do
visit project_path(project)
@@ -25,7 +26,7 @@ describe 'Maintainer views tags' do
end
context 'when project has tags' do
- let(:project) { create(:project, :repository, namespace: user.namespace) }
+ let(:project) { create(:project, :repository, namespace: group) }
let(:repository) { project.repository }
before do
diff --git a/spec/lib/gitlab/checks/tag_check_spec.rb b/spec/lib/gitlab/checks/tag_check_spec.rb
index b1258270611..80e9eb504ad 100644
--- a/spec/lib/gitlab/checks/tag_check_spec.rb
+++ b/spec/lib/gitlab/checks/tag_check_spec.rb
@@ -8,9 +8,8 @@ describe Gitlab::Checks::TagCheck do
describe '#validate!' do
let(:ref) { 'refs/tags/v1.0.0' }
- it 'raises an error' do
- allow(user_access).to receive(:can_do_action?).with(:push_code).and_return(true)
- expect(user_access).to receive(:can_do_action?).with(:admin_project).and_return(false)
+ it 'raises an error when user does not have access' do
+ allow(user_access).to receive(:can_do_action?).with(:admin_tag).and_return(false)
expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, 'You are not allowed to change existing tags on this project.')
end
diff --git a/spec/lib/gitlab/git_access_spec.rb b/spec/lib/gitlab/git_access_spec.rb
index 634c370d211..b9c21b3a7bd 100644
--- a/spec/lib/gitlab/git_access_spec.rb
+++ b/spec/lib/gitlab/git_access_spec.rb
@@ -831,7 +831,7 @@ describe Gitlab::GitAccess do
push_master: true,
push_protected_branch: false,
push_remove_protected_branch: false,
- push_tag: false,
+ push_tag: true,
push_new_tag: true,
push_all: false,
merge_into_protected_branch: false
diff --git a/spec/policies/project_policy_spec.rb b/spec/policies/project_policy_spec.rb
index 4b723a52b51..fd82150c12a 100644
--- a/spec/policies/project_policy_spec.rb
+++ b/spec/policies/project_policy_spec.rb
@@ -36,7 +36,7 @@ describe ProjectPolicy do
let(:developer_permissions) do
%i[
- admin_milestone admin_merge_request update_merge_request create_commit_status
+ admin_tag admin_milestone admin_merge_request update_merge_request create_commit_status
update_commit_status create_build update_build create_pipeline
update_pipeline create_merge_request_from create_wiki push_code
resolve_note create_container_image update_container_image destroy_container_image
diff --git a/spec/requests/api/tags_spec.rb b/spec/requests/api/tags_spec.rb
index d898319e709..c4f4a2cb889 100644
--- a/spec/requests/api/tags_spec.rb
+++ b/spec/requests/api/tags_spec.rb
@@ -10,7 +10,7 @@ describe API::Tags do
let(:current_user) { nil }
before do
- project.add_maintainer(user)
+ project.add_developer(user)
end
describe 'GET /projects/:id/repository/tags' do
diff --git a/spec/support/shared_examples/policies/project_policy_shared_examples.rb b/spec/support/shared_examples/policies/project_policy_shared_examples.rb
index 7a71e2ee370..13b7ade658b 100644
--- a/spec/support/shared_examples/policies/project_policy_shared_examples.rb
+++ b/spec/support/shared_examples/policies/project_policy_shared_examples.rb
@@ -17,6 +17,7 @@ RSpec.shared_examples 'archived project policies' do
upload_file
resolve_note
award_emoji
+ admin_tag
]
end