summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorJacopo <beschi.jacopo@gmail.com>2017-10-14 11:32:24 +0200
committerJacopo <beschi.jacopo@gmail.com>2017-10-18 09:45:27 +0200
commit26ec874f77b00124615ff55d48ca79f7631a6c15 (patch)
tree9bb210ddef0a63672a6491b054fb4bd4074dd614 /spec/requests
parent9ac5338b8eb361927ad068486398b92acb0c287e (diff)
downloadgitlab-ce-26ec874f77b00124615ff55d48ca79f7631a6c15.tar.gz
Get Project Branch API shows an helpful error message on invalid refname
In API v4 when requesting a branch with an invalid refname shows an helpful error message: 'The branch refname is invalid'.
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/branches_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb
index 16b12446ed4..e433597f58b 100644
--- a/spec/requests/api/branches_spec.rb
+++ b/spec/requests/api/branches_spec.rb
@@ -110,6 +110,15 @@ describe API::Branches do
end
end
+ context 'when the branch refname is invalid' do
+ let(:branch_name) { 'branch*' }
+ let(:message) { 'The branch refname is invalid' }
+
+ it_behaves_like '400 response' do
+ let(:request) { get api(route, current_user) }
+ end
+ end
+
context 'when repository is disabled' do
include_context 'disabled repository'
@@ -234,6 +243,15 @@ describe API::Branches do
end
end
+ context 'when the branch refname is invalid' do
+ let(:branch_name) { 'branch*' }
+ let(:message) { 'The branch refname is invalid' }
+
+ it_behaves_like '400 response' do
+ let(:request) { put api(route, current_user) }
+ end
+ end
+
context 'when repository is disabled' do
include_context 'disabled repository'
@@ -359,6 +377,15 @@ describe API::Branches do
end
end
+ context 'when the branch refname is invalid' do
+ let(:branch_name) { 'branch*' }
+ let(:message) { 'The branch refname is invalid' }
+
+ it_behaves_like '400 response' do
+ let(:request) { put api(route, current_user) }
+ end
+ end
+
context 'when repository is disabled' do
include_context 'disabled repository'
@@ -520,6 +547,15 @@ describe API::Branches do
expect(response).to have_gitlab_http_status(404)
end
+ context 'when the branch refname is invalid' do
+ let(:branch_name) { 'branch*' }
+ let(:message) { 'The branch refname is invalid' }
+
+ it_behaves_like '400 response' do
+ let(:request) { delete api("/projects/#{project.id}/repository/branches/#{branch_name}", user) }
+ end
+ end
+
it_behaves_like '412 response' do
let(:request) { api("/projects/#{project.id}/repository/branches/#{branch_name}", user) }
end