2019-12-21 20:55:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-09-29 09:46:39 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe 'projects/merge_requests/show.html.haml' do
|
2020-06-23 00:09:42 +05:30
|
|
|
before do
|
|
|
|
allow(view).to receive(:experiment_enabled?).and_return(false)
|
|
|
|
end
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
include_context 'merge request show action'
|
2016-09-29 09:46:39 +05:30
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
describe 'merge request assignee sidebar' do
|
|
|
|
context 'when assignee is allowed to merge' do
|
|
|
|
it 'does not show a warning icon' do
|
2020-10-24 23:57:45 +05:30
|
|
|
closed_merge_request.update!(assignee_id: user.id)
|
2019-02-15 15:39:39 +05:30
|
|
|
project.add_maintainer(user)
|
|
|
|
assign(:issuable_sidebar, serialize_issuable_sidebar(user, project, closed_merge_request))
|
|
|
|
|
|
|
|
render
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
expect(rendered).not_to have_css('.merge-icon')
|
2019-02-15 15:39:39 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-09-29 09:46:39 +05:30
|
|
|
context 'when the merge request is closed' do
|
|
|
|
it 'shows the "Reopen" button' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_css('a', visible: true, text: 'Reopen')
|
|
|
|
expect(rendered).to have_css('a', visible: false, text: 'Close')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not show the "Reopen" button when the source project does not exist' do
|
|
|
|
unlink_project.execute
|
|
|
|
closed_merge_request.reload
|
2018-11-18 11:00:15 +05:30
|
|
|
preload_view_requirements
|
2016-09-29 09:46:39 +05:30
|
|
|
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to have_css('a', visible: false, text: 'Reopen')
|
|
|
|
expect(rendered).to have_css('a', visible: false, text: 'Close')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|