summaryrefslogtreecommitdiff
path: root/spec/requests/api/runners_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-02 21:07:38 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-02 21:07:38 +0000
commit9d54184f308893338967b18874dedebf38acf89e (patch)
tree100e32c6d4b34deac52d9e98a083361d89804b50 /spec/requests/api/runners_spec.rb
parentd5b5f5e6e1474d5526add9033c9754b8e395841f (diff)
downloadgitlab-ce-9d54184f308893338967b18874dedebf38acf89e.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/runners_spec.rb')
-rw-r--r--spec/requests/api/runners_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/requests/api/runners_spec.rb b/spec/requests/api/runners_spec.rb
index 8daba204d50..7bad30d107d 100644
--- a/spec/requests/api/runners_spec.rb
+++ b/spec/requests/api/runners_spec.rb
@@ -6,6 +6,7 @@ describe API::Runners do
let(:admin) { create(:user, :admin) }
let(:user) { create(:user) }
let(:user2) { create(:user) }
+ let(:group_maintainer) { create(:user) }
let(:project) { create(:project, creator_id: user.id) }
let(:project2) { create(:project, creator_id: user.id) }
@@ -20,6 +21,7 @@ describe API::Runners do
before do
# Set project access for users
+ create(:group_member, :maintainer, user: group_maintainer, group: group)
create(:project_member, :maintainer, user: user, project: project)
create(:project_member, :maintainer, user: user, project: project2)
create(:project_member, :reporter, user: user2, project: project)
@@ -525,6 +527,20 @@ describe API::Runners do
end.to change { Ci::Runner.project_type.count }.by(-1)
end
+ it 'does not delete group runner with maintainer access' do
+ delete api("/runners/#{group_runner.id}", group_maintainer)
+
+ expect(response).to have_http_status(403)
+ end
+
+ it 'deletes group runner with owner access' do
+ expect do
+ delete api("/runners/#{group_runner.id}", user)
+
+ expect(response).to have_http_status(204)
+ end.to change { Ci::Runner.group_type.count }.by(-1)
+ end
+
it_behaves_like '412 response' do
let(:request) { api("/runners/#{project_runner.id}", user) }
end