2017-01-22 12:37:05 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-06-29 04:13:10 +00:00
|
|
|
feature 'Merge immediately', :js do
|
2017-01-22 12:37:05 +00:00
|
|
|
let(:user) { create(:user) }
|
2017-07-26 21:52:10 +00:00
|
|
|
let(:project) { create(:project, :public, :repository) }
|
2017-01-22 12:37:05 +00:00
|
|
|
|
2017-03-22 19:36:14 +00:00
|
|
|
let!(:merge_request) do
|
2017-01-22 12:37:05 +00:00
|
|
|
create(:merge_request_with_diffs, source_project: project,
|
|
|
|
author: user,
|
2017-03-22 19:36:14 +00:00
|
|
|
title: 'Bug NS-04',
|
|
|
|
head_pipeline: pipeline,
|
|
|
|
source_branch: pipeline.ref)
|
2017-01-22 12:37:05 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
let(:pipeline) do
|
|
|
|
create(:ci_pipeline, project: project,
|
2017-03-22 19:36:14 +00:00
|
|
|
ref: 'master',
|
|
|
|
sha: project.repository.commit('master').id)
|
2017-01-22 12:37:05 +00:00
|
|
|
end
|
|
|
|
|
2017-06-14 18:18:56 +00:00
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
|
|
|
end
|
2017-01-22 12:37:05 +00:00
|
|
|
|
|
|
|
context 'when there is active pipeline for merge request' do
|
|
|
|
background do
|
|
|
|
create(:ci_build, pipeline: pipeline)
|
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
2017-06-21 23:44:10 +00:00
|
|
|
sign_in user
|
2017-07-06 16:20:50 +00:00
|
|
|
visit project_merge_request_path(merge_request.project, merge_request)
|
2017-01-22 12:37:05 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'enables merge immediately' do
|
|
|
|
page.within '.mr-widget-body' do
|
|
|
|
find('.dropdown-toggle').click
|
|
|
|
|
2017-05-16 20:54:41 +00:00
|
|
|
Sidekiq::Testing.fake! do
|
|
|
|
click_link 'Merge immediately'
|
2017-01-22 12:37:05 +00:00
|
|
|
|
2017-05-16 20:54:41 +00:00
|
|
|
expect(find('.accept-merge-request.btn-info')).to have_content('Merge in progress')
|
2017-03-22 13:18:00 +00:00
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2017-05-16 20:54:41 +00:00
|
|
|
end
|
2017-01-22 12:37:05 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|