summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorMateusz Bajorski <ematib@gmail.com>2017-12-26 12:53:42 +0100
committerMateusz Bajorski <ematib@gmail.com>2017-12-26 19:29:54 +0100
commit896b9a6828b798ce796e0697cfa878c39c7ef829 (patch)
tree6b39675698accc2e162445699b4bdc5d03e30fcd /spec/controllers
parent29749f92b7f86d45af41509262601e47ee848d92 (diff)
downloadgitlab-ce-896b9a6828b798ce796e0697cfa878c39c7ef829.tar.gz
Fix when branch creation fails don't post system note
Closes #24347
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/projects/branches_controller_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/controllers/projects/branches_controller_spec.rb b/spec/controllers/projects/branches_controller_spec.rb
index 91894661ccb..734396ddf7b 100644
--- a/spec/controllers/projects/branches_controller_spec.rb
+++ b/spec/controllers/projects/branches_controller_spec.rb
@@ -148,6 +148,20 @@ describe Projects::BranchesController do
end
end
+ context 'when create branch service fails' do
+ let(:branch) { "./invalid-branch-name" }
+
+ it "doesn't post a system note" do
+ expect(SystemNoteService).not_to receive(:new_issue_branch)
+
+ post :create,
+ namespace_id: project.namespace,
+ project_id: project,
+ branch_name: branch,
+ issue_iid: issue.iid
+ end
+ end
+
context 'without issue feature access' do
before do
project.update!(visibility_level: Gitlab::VisibilityLevel::PUBLIC)