2016-04-20 08:28:43 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-05-09 00:15:34 -04:00
|
|
|
describe 'Cherry-pick Merge Requests', js: true do
|
2016-04-20 08:28:43 -04:00
|
|
|
let(:user) { create(:user) }
|
2017-01-18 09:25:12 -05:00
|
|
|
let(:group) { create(:group) }
|
2017-07-26 17:52:10 -04:00
|
|
|
let(:project) { create(:project, :repository, namespace: group) }
|
2016-04-20 08:28:43 -04:00
|
|
|
let(:merge_request) { create(:merge_request_with_diffs, source_project: project, author: user) }
|
|
|
|
|
|
|
|
before do
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in user
|
2016-04-20 08:28:43 -04:00
|
|
|
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
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_merge_request_path(project, merge_request)
|
2016-04-20 08:28:43 -04:00
|
|
|
|
|
|
|
expect(page).not_to have_link "Cherry-pick"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "With a merge commit" do
|
|
|
|
it "shows a Cherry-pick button" do
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_merge_request_path(project, merge_request)
|
2016-04-20 08:28:43 -04:00
|
|
|
|
|
|
|
expect(page).to have_link "Cherry-pick"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|