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
|
|
|
|
|
|
|
|
let(:user) { create(:user) }
|
2017-03-27 16:20:27 -04:00
|
|
|
let(:target_project) { create(:project, :repository) }
|
|
|
|
let(:source_project) { create(:project, :repository, forked_from_project: target_project) }
|
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)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows commits from source project' do
|
|
|
|
render
|
|
|
|
|
|
|
|
commit = source_project.commit(merge_request.source_branch)
|
2017-06-29 13:06:35 -04:00
|
|
|
href = project_commit_path(source_project, commit)
|
2016-10-05 06:08:16 -04:00
|
|
|
|
|
|
|
expect(rendered).to have_link(Commit.truncate_sha(commit.sha), href: href)
|
|
|
|
end
|
|
|
|
end
|