Commit 2e9517af authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '34907-dont-show-pipeline-schedule-button-for-non-member' into 'master'

Do not show pipeline schedule button for non-member

Closes #34907

See merge request !12757
parents 2a5d2ecf 53067cd7
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
- schedule_path_proc = ->(scope) { pipeline_schedules_path(@project, scope: scope) } - schedule_path_proc = ->(scope) { pipeline_schedules_path(@project, scope: scope) }
= render "tabs", schedule_path_proc: schedule_path_proc, all_schedules: @all_schedules, 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 .nav-controls
= link_to new_project_pipeline_schedule_path(@project), class: 'btn btn-create' do = link_to new_project_pipeline_schedule_path(@project), class: 'btn btn-create' do
%span= _('New schedule') %span= _('New schedule')
......
---
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 ...@@ -9,9 +9,10 @@ feature 'Pipeline Schedules', :feature, js: true do
let(:scope) { nil } let(:scope) { nil }
let!(:user) { create(:user) } let!(:user) { create(:user) }
context 'logged in as master' do
before do before do
project.add_master(user) project.add_master(user)
sign_in(user) gitlab_sign_in(user)
end end
describe 'GET /projects/pipeline_schedules' do describe 'GET /projects/pipeline_schedules' do
...@@ -194,6 +195,39 @@ feature 'Pipeline Schedules', :feature, js: true do ...@@ -194,6 +195,39 @@ feature 'Pipeline Schedules', :feature, js: true do
end end
end 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 def visit_new_pipeline_schedule
visit new_project_pipeline_schedule_path(project, pipeline_schedule) visit new_project_pipeline_schedule_path(project, pipeline_schedule)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment