diff options
Diffstat (limited to 'spec/features/merge_request')
-rw-r--r-- | spec/features/merge_request/user_sees_merge_widget_spec.rb | 46 |
1 files changed, 16 insertions, 30 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 3f2a676462b..d19835741e3 100644 --- a/spec/features/merge_request/user_sees_merge_widget_spec.rb +++ b/spec/features/merge_request/user_sees_merge_widget_spec.rb @@ -189,26 +189,20 @@ describe 'Merge request > User sees merge widget', :js do visit project_merge_request_path(project, merge_request) end - it 'shows head pipeline information' do - within '.ci-widget-content' do - expect(page).to have_content("Pipeline ##{pipeline.id} pending " \ - "for #{pipeline.short_sha} " \ - "on #{merge_request.to_reference} " \ - "with #{merge_request.source_branch}") + shared_examples 'pipeline widget' do + it 'shows head pipeline information' do + within '.ci-widget-content' do + expect(page).to have_content("Detached merge request pipeline ##{pipeline.id} pending for #{pipeline.short_sha}") + end end end + include_examples 'pipeline widget' + context 'when source project is a forked project' do let(:source_project) { fork_project(project, user, repository: true) } - it 'shows head pipeline information' do - within '.ci-widget-content' do - expect(page).to have_content("Pipeline ##{pipeline.id} pending " \ - "for #{pipeline.short_sha} " \ - "on #{merge_request.to_reference} " \ - "with #{merge_request.source_branch}") - end - end + include_examples 'pipeline widget' end end @@ -234,29 +228,21 @@ describe 'Merge request > User sees merge widget', :js do visit project_merge_request_path(project, merge_request) end - it 'shows head pipeline information' do - within '.ci-widget-content' do - expect(page).to have_content("Pipeline ##{pipeline.id} pending " \ - "for #{pipeline.short_sha} " \ - "on #{merge_request.to_reference} " \ - "with #{merge_request.source_branch} " \ - "into #{merge_request.target_branch}") + shared_examples 'pipeline widget' do + it 'shows head pipeline information' do + within '.ci-widget-content' do + expect(page).to have_content("Merged result pipeline ##{pipeline.id} pending for #{pipeline.short_sha}") + end end end + include_examples 'pipeline widget' + context 'when source project is a forked project' do let(:source_project) { fork_project(project, user, repository: true) } let(:merge_sha) { source_project.commit.sha } - it 'shows head pipeline information' do - within '.ci-widget-content' do - expect(page).to have_content("Pipeline ##{pipeline.id} pending " \ - "for #{pipeline.short_sha} " \ - "on #{merge_request.to_reference} " \ - "with #{merge_request.source_branch} " \ - "into #{merge_request.target_branch}") - end - end + include_examples 'pipeline widget' end end |