2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-08-29 03:56:52 -04:00
|
|
|
require 'spec_helper'
|
2017-01-22 07:37:05 -05:00
|
|
|
|
2020-06-16 14:09:01 -04:00
|
|
|
RSpec.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
|
2020-08-10 23:11:00 -04:00
|
|
|
|
2017-01-22 07:37:05 -05:00
|
|
|
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
|
2019-01-16 05:11:51 -05:00
|
|
|
wait_for_requests
|
|
|
|
|
2017-01-22 07:37:05 -05:00
|
|
|
page.within '.mr-widget-body' do
|
|
|
|
find('.dropdown-toggle').click
|
|
|
|
|
2017-05-16 16:54:41 -04:00
|
|
|
Sidekiq::Testing.fake! do
|
2020-10-22 08:08:41 -04:00
|
|
|
click_button '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
|