Commit ffa2c5d4 authored by Valery Sizov's avatar Valery Sizov Committed by Eric Eastwood

Add spec for Repository#ff_merge (ported from EE)

parent dd35c1d5
...@@ -1308,6 +1308,34 @@ describe Repository, models: true do ...@@ -1308,6 +1308,34 @@ describe Repository, models: true do
end end
end end
describe '#ff_merge' do
before do
repository.add_branch(user, 'ff-target', 'feature~5')
end
it 'merges the code and return the commit id' do
merge_request = create(:merge_request, source_branch: 'feature', target_branch: 'ff-target', source_project: project)
merge_commit_id = repository.ff_merge(user,
merge_request.diff_head_sha,
merge_request.target_branch,
merge_request: merge_request)
merge_commit = repository.commit(merge_commit_id)
expect(merge_commit).to be_present
expect(repository.blob_at(merge_commit.id, 'files/ruby/feature.rb')).to be_present
end
it 'sets the `in_progress_merge_commit_sha` flag for the given merge request' do
merge_request = create(:merge_request, source_branch: 'feature', target_branch: 'ff-target', source_project: project)
merge_commit_id = repository.ff_merge(user,
merge_request.diff_head_sha,
merge_request.target_branch,
merge_request: merge_request)
expect(merge_request.in_progress_merge_commit_sha).to eq(merge_commit_id)
end
end
describe '#revert' do describe '#revert' do
let(:new_image_commit) { repository.commit('33f3729a45c02fc67d00adb1b8bca394b0e761d9') } let(:new_image_commit) { repository.commit('33f3729a45c02fc67d00adb1b8bca394b0e761d9') }
let(:update_image_commit) { repository.commit('2f63565e7aac07bcdadb654e253078b727143ec4') } let(:update_image_commit) { repository.commit('2f63565e7aac07bcdadb654e253078b727143ec4') }
......
...@@ -47,7 +47,8 @@ describe MergeRequestEntity do ...@@ -47,7 +47,8 @@ describe MergeRequestEntity do
:cancel_merge_when_pipeline_succeeds_path, :cancel_merge_when_pipeline_succeeds_path,
:create_issue_to_resolve_discussions_path, :create_issue_to_resolve_discussions_path,
:source_branch_path, :target_branch_commits_path, :source_branch_path, :target_branch_commits_path,
:target_branch_tree_path, :commits_count, :merge_ongoing) :target_branch_tree_path, :commits_count, :merge_ongoing,
:ff_only_enabled)
end end
it 'has email_patches_path' do it 'has email_patches_path' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment