BigW Consortium Gitlab

Commit 919c0c7b by Saverio Miroddi

Extended UTs for the new cherry-pick message format

parent ae5e806f
...@@ -195,6 +195,30 @@ eos ...@@ -195,6 +195,30 @@ eos
it { expect(data[:removed]).to eq([]) } it { expect(data[:removed]).to eq([]) }
end 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 describe '#reverts_commit?' do
let(:another_commit) { double(:commit, revert_description: "This reverts commit #{commit.sha}") } let(:another_commit) { double(:commit, revert_description: "This reverts commit #{commit.sha}") }
let(:user) { commit.author } let(:user) { commit.author }
......
...@@ -1344,8 +1344,11 @@ describe Repository, models: true do ...@@ -1344,8 +1344,11 @@ describe Repository, models: true do
it 'cherry-picks the changes' do it 'cherry-picks the changes' do
expect(repository.blob_at_branch('improve/awesome', 'foo/bar/.gitkeep')).to be_nil 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(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 end
end end
......
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