2019-07-25 05:24:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-08-29 07:56:52 +00:00
|
|
|
require 'spec_helper'
|
2016-11-21 14:16:57 +00:00
|
|
|
|
2016-12-06 14:42:11 +00:00
|
|
|
# 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.
|
2017-08-01 18:03:07 +00:00
|
|
|
# Please do not remove ":js".
|
2020-06-16 18:09:01 +00:00
|
|
|
RSpec.describe 'Merge request > User sees MR with deleted source branch', :js do
|
2017-08-01 18:03:07 +00:00
|
|
|
let(:project) { create(:project, :public, :repository) }
|
|
|
|
let(:merge_request) { create(:merge_request, source_project: project) }
|
|
|
|
let(:user) { project.creator }
|
2016-11-21 14:16:57 +00:00
|
|
|
|
|
|
|
before do
|
|
|
|
merge_request.update!(source_branch: 'this-branch-does-not-exist')
|
2017-08-01 18:03:07 +00:00
|
|
|
sign_in(user)
|
|
|
|
visit project_merge_request_path(project, merge_request)
|
2016-11-21 14:16:57 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows a message about missing source branch' do
|
2017-08-01 18:03:07 +00:00
|
|
|
expect(page).to have_content('Source branch does not exist.')
|
2016-11-21 14:16:57 +00:00
|
|
|
end
|
|
|
|
|
2016-12-28 20:24:05 +00:00
|
|
|
it 'still contains Discussion, Commits and Changes tabs' do
|
2016-11-21 14:16:57 +00:00
|
|
|
within '.merge-request-details' do
|
2019-12-03 03:06:35 +00:00
|
|
|
expect(page).to have_content('Overview')
|
2016-12-28 20:24:05 +00:00
|
|
|
expect(page).to have_content('Commits')
|
|
|
|
expect(page).to have_content('Changes')
|
2016-11-21 14:16:57 +00:00
|
|
|
end
|
2016-12-28 20:24:05 +00:00
|
|
|
|
2019-12-03 03:06:35 +00:00
|
|
|
expect(page).to have_content('Source branch does not exist.')
|
|
|
|
|
2016-12-28 20:24:05 +00:00
|
|
|
click_on 'Changes'
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2016-12-28 20:24:05 +00:00
|
|
|
|
2018-08-07 21:10:15 +00:00
|
|
|
expect(page).to have_selector('.diffs.tab-pane .file-holder')
|
2016-11-21 14:16:57 +00:00
|
|
|
end
|
|
|
|
end
|