summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-04-20 14:28:43 +0200
committerDouwe Maan <douwe@selenight.nl>2016-04-20 14:28:43 +0200
commit5dba777695a69e71ab0db5131ce424cb9145bd06 (patch)
treefe5c8e5a25a8b0f8d110dbc96ea0423468bf7502
parentb016d4356d38996b81a813f13e259f218131539b (diff)
downloadgitlab-ce-5dba777695a69e71ab0db5131ce424cb9145bd06.tar.gz
-rw-r--r--spec/features/merge_requests/cherry_pick_spec.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/features/merge_requests/cherry_pick_spec.rb b/spec/features/merge_requests/cherry_pick_spec.rb
new file mode 100644
index 00000000000..82bc5226d07
--- /dev/null
+++ b/spec/features/merge_requests/cherry_pick_spec.rb
@@ -0,0 +1,44 @@
+require 'spec_helper'
+
+describe 'Cherry-pick Merge Requests' do
+ let(:user) { create(:user) }
+ let(:project) { create(:project) }
+ let(:merge_request) { create(:merge_request_with_diffs, source_project: project, author: user) }
+
+ before do
+ login_as user
+ project.team << [user, :master]
+ end
+
+ context "Viewing a merged merge request" do
+ before do
+ service = MergeRequests::MergeService.new(project, user)
+
+ perform_enqueued_jobs do
+ service.execute(merge_request)
+ end
+ end
+
+ # Fast-forward merge, or merged before GitLab 8.5.
+ context "Without a merge commit" do
+ before do
+ merge_request.merge_commit_sha = nil
+ merge_request.save
+ end
+
+ it "doesn't show a Cherry-pick button" do
+ visit namespace_project_merge_request_path(project.namespace, project, merge_request)
+
+ expect(page).not_to have_link "Cherry-pick"
+ end
+ end
+
+ context "With a merge commit" do
+ it "shows a Cherry-pick button" do
+ visit namespace_project_merge_request_path(project.namespace, project, merge_request)
+
+ expect(page).to have_link "Cherry-pick"
+ end
+ end
+ end
+end