summaryrefslogtreecommitdiff
path: root/spec/requests/api/issues_spec.rb
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2014-08-14 10:17:52 +0200
committerRobert Schilling <rschilling@student.tugraz.at>2014-08-14 10:17:52 +0200
commitcbc90565b55d89704d64bc48db323b82b739a873 (patch)
treef6bb4220068bafab7a1b1a57d2b13631a553c4a2 /spec/requests/api/issues_spec.rb
parent04ad197bcc41a26da2c2a80c5b4ffbfad2c296ee (diff)
downloadgitlab-ce-cbc90565b55d89704d64bc48db323b82b739a873.tar.gz
Do label validation for issues/merge requests API
Diffstat (limited to 'spec/requests/api/issues_spec.rb')
-rw-r--r--spec/requests/api/issues_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb
index dff7f20cb32..d8e8e4f5035 100644
--- a/spec/requests/api/issues_spec.rb
+++ b/spec/requests/api/issues_spec.rb
@@ -5,6 +5,10 @@ describe API::API, api: true do
let(:user) { create(:user) }
let!(:project) { create(:project, namespace: user.namespace ) }
let!(:issue) { create(:issue, author: user, assignee: user, project: project) }
+ let!(:label) do
+ create(:label, title: 'label', color: '#FFAABB', project: project)
+ end
+
before { project.team << [user, :reporter] }
describe "GET /issues" do
@@ -68,6 +72,14 @@ describe API::API, api: true do
post api("/projects/#{project.id}/issues", user), labels: 'label, label2'
response.status.should == 400
end
+
+ it 'should return 405 on invalid label names' do
+ post api("/projects/#{project.id}/issues", user),
+ title: 'new issue',
+ labels: 'label, ?'
+ response.status.should == 405
+ json_response['message'].should == 'Label names invalid'
+ end
end
describe "PUT /projects/:id/issues/:issue_id to update only title" do
@@ -84,6 +96,14 @@ describe API::API, api: true do
title: 'updated title'
response.status.should == 404
end
+
+ it 'should return 405 on invalid label names' do
+ put api("/projects/#{project.id}/issues/#{issue.id}", user),
+ title: 'updated title',
+ labels: 'label, ?'
+ response.status.should == 405
+ json_response['message'].should == 'Label names invalid'
+ end
end
describe "PUT /projects/:id/issues/:issue_id to update state and label" do