2016-10-05 06:08:16 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-06-13 18:12:31 -04:00
|
|
|
describe 'projects/merge_requests/_commits.html.haml' do
|
2016-10-05 06:08:16 -04:00
|
|
|
include Devise::Test::ControllerHelpers
|
2017-09-29 04:04:50 -04:00
|
|
|
include ProjectForksHelper
|
2016-10-05 06:08:16 -04:00
|
|
|
|
|
|
|
let(:user) { create(:user) }
|
2017-09-29 04:04:50 -04:00
|
|
|
let(:target_project) { create(:project, :public, :repository) }
|
|
|
|
let(:source_project) { fork_project(target_project, user, repository: true) }
|
2016-10-05 06:08:16 -04:00
|
|
|
|
|
|
|
let(:merge_request) do
|
|
|
|
create(:merge_request, :simple,
|
|
|
|
source_project: source_project,
|
|
|
|
target_project: target_project,
|
|
|
|
author: user)
|
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
controller.prepend_view_path('app/views/projects')
|
|
|
|
|
|
|
|
assign(:merge_request, merge_request)
|
|
|
|
assign(:commits, merge_request.commits)
|
2018-08-21 13:47:04 -04:00
|
|
|
assign(:hidden_commit_count, 0)
|
2016-10-05 06:08:16 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows commits from source project' do
|
|
|
|
render
|
|
|
|
|
2017-12-01 14:08:30 -05:00
|
|
|
commit = merge_request.commits.first # HEAD
|
|
|
|
href = diffs_project_merge_request_path(target_project, merge_request, commit_id: commit)
|
2016-10-05 06:08:16 -04:00
|
|
|
|
2018-04-06 09:35:07 -04:00
|
|
|
expect(rendered).to have_link(href: href)
|
2016-10-05 06:08:16 -04:00
|
|
|
end
|
2018-08-21 13:47:04 -04:00
|
|
|
|
|
|
|
context 'when there are hidden commits' do
|
|
|
|
before do
|
|
|
|
assign(:hidden_commit_count, 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows notice about omitted commits' do
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to match(/1 additional commit has been omitted to prevent performance issues/)
|
|
|
|
end
|
|
|
|
end
|
2016-10-05 06:08:16 -04:00
|
|
|
end
|