diff options
author | Ábner Silva de Oliveira <abner.silva@gmail.com> | 2014-03-21 13:18:19 +0400 |
---|---|---|
committer | Ábner Silva de Oliveira <abner.silva@gmail.com> | 2014-03-21 13:25:25 +0400 |
commit | 44aa6b90ddde3a7babc6ed9f50d73040d6184789 (patch) | |
tree | 1f1107a5b6c1535f5e2635c88d95a4f4b5a7cbe6 /spec | |
parent | fb919a631c16f0046c5599a9e9e9fa38ff4a699a (diff) |
added api method to return labels of a given project
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/labels_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/requests/api/labels_spec.rb b/spec/requests/api/labels_spec.rb new file mode 100644 index 00000000000..ba5efb6c603 --- /dev/null +++ b/spec/requests/api/labels_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe API::API do + include ApiHelpers + before(:each) { ActiveRecord::Base.observers.enable(:user_observer) } + after(:each) { ActiveRecord::Base.observers.disable(:user_observer) } + + let(:user) { create(:user) } + let!(:project) { create(:project, namespace: user.namespace ) } + let!(:issue) { create(:issue, author: user, assignee: user, project: project, :label_list => "label1, label2") } + before { project.team << [user, :reporter] } + + + describe "GET /projects/:id/labels" do + it "should return project labels" do + get api("/projects/#{project.id}/labels", user) + response.status.should == 200 + json_response.should be_an Array + json_response.first['name'].should == 'label1' + json_response.last['name'].should == 'label2' + end + end + + +end + |