Extended UTs for the new cherry-pick message format

This commit is contained in:
Saverio Miroddi 2017-08-16 13:18:07 +02:00
parent ae5e806f12
commit 919c0c7ba7
2 changed files with 28 additions and 1 deletions

View File

@ -195,6 +195,30 @@ eos
it { expect(data[:removed]).to eq([]) }
end
describe '#cherry_pick_message' do
let(:regular_commit) { project.commit('video') }
let(:merge_commit) { project.commit('wip') }
context 'of a regular commit' do
it { expect(regular_commit.cherry_pick_message(project, 'master')).to include("\n\n(cherry picked from commit 88790590ed1337ab189bccaa355f068481c90bec)") }
end
context 'of a merge commit' do
it do
expected_appended_text = <<~STR.rstrip
(cherry picked from commit b9238ee5bf1d7359dd3b8c89fd76c1c7f8b75aba)
6d664995 This commit will be fixupped against
64117577 fixup! This commit will be fixupped against
STR
expect(merge_commit.cherry_pick_message(project, 'master')).to include(expected_appended_text)
end
end
end
describe '#reverts_commit?' do
let(:another_commit) { double(:commit, revert_description: "This reverts commit #{commit.sha}") }
let(:user) { commit.author }

View File

@ -1344,8 +1344,11 @@ describe Repository, models: true do
it 'cherry-picks the changes' do
expect(repository.blob_at_branch('improve/awesome', 'foo/bar/.gitkeep')).to be_nil
repository.cherry_pick(user, pickable_merge, 'improve/awesome')
cherry_pick_commit_sha = repository.cherry_pick(user, pickable_merge, 'improve/awesome')
cherry_pick_commit_message = project.commit(cherry_pick_commit_sha).message
expect(repository.blob_at_branch('improve/awesome', 'foo/bar/.gitkeep')).not_to be_nil
expect(cherry_pick_commit_message).to include('cherry picked from')
end
end
end