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
|
|
|
|
|
|
|
# This test serves as a regression test for a bug that caused an error
|
|
|
|
# message to be shown by JavaScript when the source branch was deleted.
|
2018-03-17 18:26:18 +05:30
|
|
|
# Please do not remove ":js".
|
|
|
|
describe 'Merge request > User sees MR with deleted source branch', :js do
|
|
|
|
let(:project) { create(:project, :public, :repository) }
|
|
|
|
let(:merge_request) { create(:merge_request, source_project: project) }
|
|
|
|
let(:user) { project.creator }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
merge_request.update!(source_branch: 'this-branch-does-not-exist')
|
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 'shows a message about missing source branch' do
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(page).to have_content('Source branch does not exist.')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'still contains Discussion, Commits and Changes tabs' do
|
|
|
|
within '.merge-request-details' do
|
2020-01-01 13:55:28 +05:30
|
|
|
expect(page).to have_content('Overview')
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_content('Commits')
|
|
|
|
expect(page).to have_content('Changes')
|
|
|
|
end
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
expect(page).to have_content('Source branch does not exist.')
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
click_on 'Changes'
|
2017-09-10 17:25:29 +05:30
|
|
|
wait_for_requests
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-11-20 20:47:30 +05:30
|
|
|
expect(page).to have_selector('.diffs.tab-pane .file-holder')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|