Do not show pipeline schedule button for non-member
This commit is contained in:
parent
4daa6da540
commit
53067cd7b3
3 changed files with 197 additions and 158 deletions
|
@ -12,6 +12,7 @@
|
|||
- schedule_path_proc = ->(scope) { pipeline_schedules_path(@project, scope: scope) }
|
||||
= render "tabs", schedule_path_proc: schedule_path_proc, all_schedules: @all_schedules, scope: @scope
|
||||
|
||||
- if can?(current_user, :create_pipeline_schedule, @project)
|
||||
.nav-controls
|
||||
= link_to new_project_pipeline_schedule_path(@project), class: 'btn btn-create' do
|
||||
%span= _('New schedule')
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Do not show pipeline schedule button for non-member
|
||||
merge_request: 12757
|
||||
author: Takuya Noguchi
|
|
@ -9,9 +9,10 @@ feature 'Pipeline Schedules', :feature, js: true do
|
|||
let(:scope) { nil }
|
||||
let!(:user) { create(:user) }
|
||||
|
||||
context 'logged in as master' do
|
||||
before do
|
||||
project.add_master(user)
|
||||
sign_in(user)
|
||||
gitlab_sign_in(user)
|
||||
end
|
||||
|
||||
describe 'GET /projects/pipeline_schedules' do
|
||||
|
@ -194,6 +195,39 @@ feature 'Pipeline Schedules', :feature, js: true do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'logged in as non-member' do
|
||||
before do
|
||||
gitlab_sign_in(user)
|
||||
end
|
||||
|
||||
describe 'GET /projects/pipeline_schedules' do
|
||||
before do
|
||||
visit_pipelines_schedules
|
||||
end
|
||||
|
||||
describe 'The view' do
|
||||
it 'does not show create schedule button' do
|
||||
expect(page).not_to have_link('New schedule')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'not logged in' do
|
||||
describe 'GET /projects/pipeline_schedules' do
|
||||
before do
|
||||
visit_pipelines_schedules
|
||||
end
|
||||
|
||||
describe 'The view' do
|
||||
it 'does not show create schedule button' do
|
||||
expect(page).not_to have_link('New schedule')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def visit_new_pipeline_schedule
|
||||
visit new_project_pipeline_schedule_path(project, pipeline_schedule)
|
||||
|
|
Loading…
Reference in a new issue