2019-12-21 20:55:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
describe 'projects/merge_requests/_commits.html.haml', :sidekiq_might_not_need_inline do
|
2017-08-17 22:00:37 +05:30
|
|
|
include Devise::Test::ControllerHelpers
|
2018-03-17 18:26:18 +05:30
|
|
|
include ProjectForksHelper
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
let(:user) { create(:user) }
|
2018-03-17 18:26:18 +05:30
|
|
|
let(:target_project) { create(:project, :public, :repository) }
|
|
|
|
let(:source_project) { fork_project(target_project, user, repository: true) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
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-11-20 20:47:30 +05:30
|
|
|
assign(:hidden_commit_count, 0)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows commits from source project' do
|
|
|
|
render
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
commit = merge_request.commits.first # HEAD
|
|
|
|
href = diffs_project_merge_request_path(target_project, merge_request, commit_id: commit)
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
expect(rendered).to have_link(href: href)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
2018-11-20 20:47:30 +05:30
|
|
|
|
|
|
|
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
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|