summaryrefslogtreecommitdiff
path: root/spec/features/projects/commit
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-02-07 19:14:19 +0000
committerRobert Speicher <robert@gitlab.com>2017-02-07 19:14:19 +0000
commit58eae0961ea6e2147a288cda8a56a51303bbf13b (patch)
tree0bbd873650dfc889af8df7e197397959d774d411 /spec/features/projects/commit
parentd3aaa1a2a0313b7132479d4211e406fde5bc9324 (diff)
parent0fdf54ddf5894ec1057b7351140fdce4f0df0ed1 (diff)
downloadgitlab-ce-58eae0961ea6e2147a288cda8a56a51303bbf13b.tar.gz
Merge branch 'route-map' into 'master'
Add 'View on [env]' link to blobs and individual files in diffs See merge request !8867
Diffstat (limited to 'spec/features/projects/commit')
-rw-r--r--spec/features/projects/commit/cherry_pick_spec.rb89
1 files changed, 89 insertions, 0 deletions
diff --git a/spec/features/projects/commit/cherry_pick_spec.rb b/spec/features/projects/commit/cherry_pick_spec.rb
new file mode 100644
index 00000000000..7baf7913424
--- /dev/null
+++ b/spec/features/projects/commit/cherry_pick_spec.rb
@@ -0,0 +1,89 @@
+require 'spec_helper'
+include WaitForAjax
+
+describe 'Cherry-pick Commits' do
+ let(:group) { create(:group) }
+ let(:project) { create(:project, namespace: group) }
+ let(:master_pickable_commit) { project.commit('7d3b0f7cff5f37573aea97cebfd5692ea1689924') }
+ let(:master_pickable_merge) { project.commit('e56497bb5f03a90a51293fc6d516788730953899') }
+
+ before do
+ login_as :user
+ project.team << [@user, :master]
+ visit namespace_project_commit_path(project.namespace, project, master_pickable_commit.id)
+ end
+
+ context "I cherry-pick a commit" do
+ it do
+ find("a[href='#modal-cherry-pick-commit']").click
+ expect(page).not_to have_content('v1.0.0') # Only branches, not tags
+ page.within('#modal-cherry-pick-commit') do
+ uncheck 'create_merge_request'
+ click_button 'Cherry-pick'
+ end
+ expect(page).to have_content('The commit has been successfully cherry-picked.')
+ end
+ end
+
+ context "I cherry-pick a merge commit" do
+ it do
+ find("a[href='#modal-cherry-pick-commit']").click
+ page.within('#modal-cherry-pick-commit') do
+ uncheck 'create_merge_request'
+ click_button 'Cherry-pick'
+ end
+ expect(page).to have_content('The commit has been successfully cherry-picked.')
+ end
+ end
+
+ context "I cherry-pick a commit that was previously cherry-picked" do
+ it do
+ find("a[href='#modal-cherry-pick-commit']").click
+ page.within('#modal-cherry-pick-commit') do
+ uncheck 'create_merge_request'
+ click_button 'Cherry-pick'
+ end
+ visit namespace_project_commit_path(project.namespace, project, master_pickable_commit.id)
+ find("a[href='#modal-cherry-pick-commit']").click
+ page.within('#modal-cherry-pick-commit') do
+ uncheck 'create_merge_request'
+ click_button 'Cherry-pick'
+ end
+ expect(page).to have_content('Sorry, we cannot cherry-pick this commit automatically.')
+ end
+ end
+
+ context "I cherry-pick a commit in a new merge request" do
+ it do
+ find("a[href='#modal-cherry-pick-commit']").click
+ page.within('#modal-cherry-pick-commit') do
+ click_button 'Cherry-pick'
+ end
+ expect(page).to have_content('The commit has been successfully cherry-picked. You can now submit a merge request to get this change into the original branch.')
+ end
+ end
+
+ context "I cherry-pick a commit from a different branch", js: true do
+ it do
+ find('.header-action-buttons a.dropdown-toggle').click
+ find(:css, "a[href='#modal-cherry-pick-commit']").click
+
+ page.within('#modal-cherry-pick-commit') do
+ click_button 'master'
+ end
+
+ wait_for_ajax
+
+ page.within('#modal-cherry-pick-commit .dropdown-menu .dropdown-content') do
+ click_link 'feature'
+ end
+
+ page.within('#modal-cherry-pick-commit') do
+ uncheck 'create_merge_request'
+ click_button 'Cherry-pick'
+ end
+
+ expect(page).to have_content('The commit has been successfully cherry-picked.')
+ end
+ end
+end