Commit e5242ad5 authored by Frédéric Caplette's avatar Frédéric Caplette Committed by Jose Ivan Vargas

Adds pipeline editor link on root Ci config files

- Adds pipeline editor button on root config file
- This takes the user to ci/editor on master branch by default
parent e3d22298
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
- else - else
= edit_blob_button(@project, @ref, @path, blob: blob) = edit_blob_button(@project, @ref, @path, blob: blob)
= ide_edit_button(@project, @ref, @path, blob: blob) = ide_edit_button(@project, @ref, @path, blob: blob)
- if can_view_pipeline_editor?(@project) && @path == @project.ci_config_path_or_default
= link_to "Pipeline Editor", project_ci_pipeline_editor_path(@project), class: "btn gl-button btn-confirm-secondary gl-ml-3"
.btn-group{ role: "group", class: ("gl-ml-3" if current_user) }> .btn-group{ role: "group", class: ("gl-ml-3" if current_user) }>
= render_if_exists 'projects/blob/header_file_locks_link' = render_if_exists 'projects/blob/header_file_locks_link'
- if current_user - if current_user
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'User views pipeline editor button on root ci config file', :js do
include BlobSpecHelpers
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :public, :repository) }
context "when the ci config is the root file" do
before do
stub_feature_flags(consolidated_edit_button: false)
project.add_developer(user)
sign_in(user)
end
it 'shows the button to the Pipeline Editor' do
project.update!(ci_config_path: '.my-config.yml')
project.repository.create_file(user, project.ci_config_path_or_default, 'test', message: 'testing', branch_name: 'master')
visit project_blob_path(project, File.join('master', '.my-config.yml'))
expect(page).to have_content('Pipeline Editor')
end
it 'does not shows the Pipeline Editor button' do
project.repository.create_file(user, '.my-sub-config.yml', 'test', message: 'testing', branch_name: 'master')
visit project_blob_path(project, File.join('master', '.my-sub-config.yml'))
expect(page).not_to have_content('Pipeline Editor')
end
end
context "when user cannot collaborate" do
before do
stub_feature_flags(consolidated_edit_button: false)
sign_in(user)
end
it 'does not shows the Pipeline Editor button' do
visit project_blob_path(project, File.join('master', '.my-config.yml'))
expect(page).not_to have_content('Pipeline Editor')
end
end
end
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