summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-02-16 18:24:56 -0600
committerDouwe Maan <douwe@selenight.nl>2017-03-02 17:41:05 -0600
commit6cc4cf1e151fb8da16796d7bbab16bc8a1ac08b6 (patch)
treedbc7105aa4ecd6498a9354ad6d9c141fb93d277f /spec
parentefff35e96873bd3bea0afceb1d3cd102280813f5 (diff)
downloadgitlab-ce-6cc4cf1e151fb8da16796d7bbab16bc8a1ac08b6.tar.gz
Fix cherry-picking or reverting through an MR
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects/commit_controller_spec.rb12
-rw-r--r--spec/features/projects/commit/cherry_pick_spec.rb1
-rw-r--r--spec/models/repository_spec.rb16
3 files changed, 15 insertions, 14 deletions
diff --git a/spec/controllers/projects/commit_controller_spec.rb b/spec/controllers/projects/commit_controller_spec.rb
index 640baa3a01c..b223a22ae60 100644
--- a/spec/controllers/projects/commit_controller_spec.rb
+++ b/spec/controllers/projects/commit_controller_spec.rb
@@ -166,7 +166,7 @@ describe Projects::CommitController do
post(:revert,
namespace_id: project.namespace,
project_id: project,
- target_branch: 'master',
+ start_branch: 'master',
id: commit.id)
expect(response).to redirect_to namespace_project_commits_path(project.namespace, project, 'master')
@@ -179,7 +179,7 @@ describe Projects::CommitController do
post(:revert,
namespace_id: project.namespace,
project_id: project,
- target_branch: 'master',
+ start_branch: 'master',
id: commit.id)
end
@@ -188,7 +188,7 @@ describe Projects::CommitController do
post(:revert,
namespace_id: project.namespace,
project_id: project,
- target_branch: 'master',
+ start_branch: 'master',
id: commit.id)
expect(response).to redirect_to namespace_project_commit_path(project.namespace, project, commit.id)
@@ -215,7 +215,7 @@ describe Projects::CommitController do
post(:cherry_pick,
namespace_id: project.namespace,
project_id: project,
- target_branch: 'master',
+ start_branch: 'master',
id: master_pickable_commit.id)
expect(response).to redirect_to namespace_project_commits_path(project.namespace, project, 'master')
@@ -228,7 +228,7 @@ describe Projects::CommitController do
post(:cherry_pick,
namespace_id: project.namespace,
project_id: project,
- target_branch: 'master',
+ start_branch: 'master',
id: master_pickable_commit.id)
end
@@ -237,7 +237,7 @@ describe Projects::CommitController do
post(:cherry_pick,
namespace_id: project.namespace,
project_id: project,
- target_branch: 'master',
+ start_branch: 'master',
id: master_pickable_commit.id)
expect(response).to redirect_to namespace_project_commit_path(project.namespace, project, master_pickable_commit.id)
diff --git a/spec/features/projects/commit/cherry_pick_spec.rb b/spec/features/projects/commit/cherry_pick_spec.rb
index 7baf7913424..0b972d2a439 100644
--- a/spec/features/projects/commit/cherry_pick_spec.rb
+++ b/spec/features/projects/commit/cherry_pick_spec.rb
@@ -60,6 +60,7 @@ describe 'Cherry-pick Commits' 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.')
+ expect(page).to have_content("From cherry-pick-#{master_pickable_commit.short_id} into master")
end
end
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index ae203fada12..eb992e1354e 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -1112,16 +1112,16 @@ describe Repository, models: true do
let(:update_image_commit) { repository.commit('2f63565e7aac07bcdadb654e253078b727143ec4') }
context 'when there is a conflict' do
- it 'aborts the operation' do
- expect(repository.revert(user, new_image_commit, 'master')).to eq(false)
+ it 'raises an error' do
+ expect { repository.revert(user, new_image_commit, 'master') }.to raise_error(/Failed to/)
end
end
context 'when commit was already reverted' do
- it 'aborts the operation' do
+ it 'raises an error' do
repository.revert(user, update_image_commit, 'master')
- expect(repository.revert(user, update_image_commit, 'master')).to eq(false)
+ expect { repository.revert(user, update_image_commit, 'master') }.to raise_error(/Failed to/)
end
end
@@ -1148,16 +1148,16 @@ describe Repository, models: true do
let(:pickable_merge) { repository.commit('e56497bb5f03a90a51293fc6d516788730953899') }
context 'when there is a conflict' do
- it 'aborts the operation' do
- expect(repository.cherry_pick(user, conflict_commit, 'master')).to eq(false)
+ it 'raises an error' do
+ expect { repository.cherry_pick(user, conflict_commit, 'master') }.to raise_error(/Failed to/)
end
end
context 'when commit was already cherry-picked' do
- it 'aborts the operation' do
+ it 'raises an error' do
repository.cherry_pick(user, pickable_commit, 'master')
- expect(repository.cherry_pick(user, pickable_commit, 'master')).to eq(false)
+ expect { repository.cherry_pick(user, pickable_commit, 'master') }.to raise_error(/Failed to/)
end
end