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
|
|
|
|
2023-03-17 16:20:25 +05:30
|
|
|
RSpec.describe 'Merge requests > User merges immediately', :js, feature_category: :code_review_workflow 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
|
|
|
|
|
2022-07-16 23:28:13 +05:30
|
|
|
page.within '[data-testid="ready_to_merge_state"]' do
|
2017-08-17 22:00:37 +05:30
|
|
|
find('.dropdown-toggle').click
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
Sidekiq::Testing.fake! do
|
2021-01-29 00:20:46 +05:30
|
|
|
click_button 'Merge immediately'
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
2022-07-16 23:28:13 +05:30
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
expect(find('[data-testid="merging-state"]')).to have_content('Merging!')
|
2022-07-16 23:28:13 +05:30
|
|
|
|
|
|
|
wait_for_requests
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|