2017-08-01 14:03:07 -04:00
|
|
|
require 'rails_helper'
|
2017-01-22 07:37:05 -05:00
|
|
|
|
2017-08-01 14:03:07 -04:00
|
|
|
describe 'Merge requests > User merges immediately', :js do
|
2017-07-26 17:52:10 -04:00
|
|
|
let(:project) { create(:project, :public, :repository) }
|
2017-08-01 14:03:07 -04:00
|
|
|
let(:user) { project.creator }
|
2017-03-22 15:36:14 -04:00
|
|
|
let!(:merge_request) do
|
2017-01-22 07:37:05 -05:00
|
|
|
create(:merge_request_with_diffs, source_project: project,
|
|
|
|
author: user,
|
2017-03-22 15:36:14 -04:00
|
|
|
title: 'Bug NS-04',
|
|
|
|
head_pipeline: pipeline,
|
|
|
|
source_branch: pipeline.ref)
|
2017-01-22 07:37:05 -05:00
|
|
|
end
|
|
|
|
let(:pipeline) do
|
|
|
|
create(:ci_pipeline, project: project,
|
2017-03-22 15:36:14 -04:00
|
|
|
ref: 'master',
|
|
|
|
sha: project.repository.commit('master').id)
|
2017-01-22 07:37:05 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'when there is active pipeline for merge request' do
|
|
|
|
before do
|
2017-08-01 14:03:07 -04:00
|
|
|
create(:ci_build, pipeline: pipeline)
|
2018-07-11 10:36:08 -04:00
|
|
|
project.add_maintainer(user)
|
2017-08-01 14:03:07 -04:00
|
|
|
sign_in(user)
|
|
|
|
visit project_merge_request_path(project, merge_request)
|
2017-01-22 07:37:05 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'enables merge immediately' do
|
|
|
|
page.within '.mr-widget-body' do
|
|
|
|
find('.dropdown-toggle').click
|
|
|
|
|
2017-05-16 16:54:41 -04:00
|
|
|
Sidekiq::Testing.fake! do
|
|
|
|
click_link 'Merge immediately'
|
2017-01-22 07:37:05 -05:00
|
|
|
|
2017-05-16 16:54:41 -04:00
|
|
|
expect(find('.accept-merge-request.btn-info')).to have_content('Merge in progress')
|
2017-03-22 09:18:00 -04:00
|
|
|
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
2017-05-16 16:54:41 -04:00
|
|
|
end
|
2017-01-22 07:37:05 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|