2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
require 'spec_helper'
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Merge requests > User merges immediately', :js do
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:project) { create(:project, :public, :repository) }
|
2018-03-17 18:26:18 +05:30
|
|
|
let(:user) { project.creator }
|
2017-09-10 17:25:29 +05:30
|
|
|
let!(:merge_request) do
|
2017-08-17 22:00:37 +05:30
|
|
|
create(:merge_request_with_diffs, source_project: project,
|
|
|
|
author: user,
|
2017-09-10 17:25:29 +05:30
|
|
|
title: 'Bug NS-04',
|
|
|
|
head_pipeline: pipeline,
|
|
|
|
source_branch: pipeline.ref)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
2020-10-24 23:57:45 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:pipeline) do
|
|
|
|
create(:ci_pipeline, project: project,
|
2017-09-10 17:25:29 +05:30
|
|
|
ref: 'master',
|
|
|
|
sha: project.repository.commit('master').id)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
context 'when there is active pipeline for merge request' do
|
|
|
|
before do
|
2018-03-17 18:26:18 +05:30
|
|
|
create(:ci_build, pipeline: pipeline)
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2018-03-17 18:26:18 +05:30
|
|
|
sign_in(user)
|
|
|
|
visit project_merge_request_path(project, merge_request)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'enables merge immediately' do
|
2019-03-02 22:35:43 +05:30
|
|
|
wait_for_requests
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
page.within '.mr-widget-body' do
|
|
|
|
find('.dropdown-toggle').click
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
Sidekiq::Testing.fake! do
|
|
|
|
click_link 'Merge immediately'
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(find('.accept-merge-request.btn-info')).to have_content('Merge in progress')
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
wait_for_requests
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|