2018-03-17 18:26:18 +05:30
|
|
|
require 'rails_helper'
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
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
|
|
|
|
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)
|
|
|
|
project.add_master(user)
|
|
|
|
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
|
|
|
|
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
|