diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2019-04-17 16:20:36 +0300 |
---|---|---|
committer | Steve Azzopardi <sazzopardi@gitlab.com> | 2019-05-07 17:39:02 +0300 |
commit | 61cb27b01daa1ba7016d8dc4bf5f0e3472756bc5 (patch) | |
tree | a4bdb0e814efcf817e8fb49fa3c1cd51f81a902d /spec/features/merge_request/user_sees_merge_widget_spec.rb | |
parent | 224c1462ded09432f5ab055c79119e8f4a5f3856 (diff) |
Fixes empty block in MR widget
This commit prevents the pipeline block to be rendered
when no pipeline information is provided
Diffstat (limited to 'spec/features/merge_request/user_sees_merge_widget_spec.rb')
-rw-r--r-- | spec/features/merge_request/user_sees_merge_widget_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/features/merge_request/user_sees_merge_widget_spec.rb b/spec/features/merge_request/user_sees_merge_widget_spec.rb index 40ba676ff92..a32c6bdcf8f 100644 --- a/spec/features/merge_request/user_sees_merge_widget_spec.rb +++ b/spec/features/merge_request/user_sees_merge_widget_spec.rb @@ -670,4 +670,26 @@ describe 'Merge request > User sees merge widget', :js do end end end + + context 'when MR has pipeline but user does not have permission' do + let(:sha) { project.commit(merge_request.source_branch).sha } + let!(:pipeline) { create(:ci_pipeline_without_jobs, status: 'success', sha: sha, project: project, ref: merge_request.source_branch) } + + before do + project.update( + visibility_level: Gitlab::VisibilityLevel::PUBLIC, + public_builds: false + ) + merge_request.update!(head_pipeline: pipeline) + sign_out(:user) + + visit project_merge_request_path(project, merge_request) + end + + it 'renders a CI pipeline error' do + within '.ci-widget' do + expect(page).to have_content('Could not retrieve the pipeline status.') + end + end + end end |