2016-08-12 10:23:00 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
feature 'Pipelines for Merge Requests', feature: true, js: true do
|
|
|
|
include WaitForAjax
|
|
|
|
|
|
|
|
given(:user) { create(:user) }
|
|
|
|
given(:merge_request) { create(:merge_request) }
|
|
|
|
given(:project) { merge_request.target_project }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
|
|
|
login_as user
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with pipelines' do
|
|
|
|
let!(:pipeline) do
|
|
|
|
create(:ci_empty_pipeline,
|
|
|
|
project: merge_request.source_project,
|
|
|
|
ref: merge_request.source_branch,
|
|
|
|
sha: merge_request.diff_head_sha)
|
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
visit namespace_project_merge_request_path(project.namespace, project, merge_request)
|
|
|
|
end
|
|
|
|
|
2016-08-15 16:53:09 -04:00
|
|
|
scenario 'user visits merge request pipelines tab' do
|
2016-08-12 10:23:00 -04:00
|
|
|
page.within('.merge-request-tabs') do
|
|
|
|
click_link('Pipelines')
|
|
|
|
end
|
|
|
|
wait_for_ajax
|
|
|
|
|
|
|
|
expect(page).to have_selector('.pipeline-actions')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'without pipelines' do
|
|
|
|
before do
|
|
|
|
visit namespace_project_merge_request_path(project.namespace, project, merge_request)
|
|
|
|
end
|
|
|
|
|
2016-08-15 16:53:09 -04:00
|
|
|
scenario 'user visits merge request page' do
|
2016-08-12 10:23:00 -04:00
|
|
|
page.within('.merge-request-tabs') do
|
2016-08-17 09:49:16 -04:00
|
|
|
expect(page).to have_no_link('Pipelines')
|
2016-08-12 10:23:00 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|