summaryrefslogtreecommitdiff
path: root/spec/models/commit_spec.rb
diff options
context:
space:
mode:
authorSaverio Miroddi <saverio.pub2@gmail.com>2017-08-16 13:18:07 +0200
committerSaverio Miroddi <saverio.pub2@gmail.com>2017-08-16 13:18:07 +0200
commit919c0c7ba7369970bf57e9388333af120b74203d (patch)
treecb6eaa5abf89af56821682bfc7761cc82a614441 /spec/models/commit_spec.rb
parentae5e806f128e8e737948f4286da92526c74c316e (diff)
downloadgitlab-ce-919c0c7ba7369970bf57e9388333af120b74203d.tar.gz
Extended UTs for the new cherry-pick message format
Diffstat (limited to 'spec/models/commit_spec.rb')
-rw-r--r--spec/models/commit_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb
index c18c635d811..9711222b3a1 100644
--- a/spec/models/commit_spec.rb
+++ b/spec/models/commit_spec.rb
@@ -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 }