Commit 85b5812bc21623c6a11ed92f482ac8282ec12fc1
1 parent
cc575875
Exists in
spb-stable
and in
3 other branches
moving labels specs to projects_spec file
Showing
2 changed files
with
13 additions
and
26 deletions
Show diff stats
spec/requests/api/labels_spec.rb
... | ... | @@ -1,26 +0,0 @@ |
1 | -require 'spec_helper' | |
2 | - | |
3 | -describe API::API do | |
4 | - include ApiHelpers | |
5 | - before(:each) { ActiveRecord::Base.observers.enable(:user_observer) } | |
6 | - after(:each) { ActiveRecord::Base.observers.disable(:user_observer) } | |
7 | - | |
8 | - let(:user) { create(:user) } | |
9 | - let!(:project) { create(:project, namespace: user.namespace ) } | |
10 | - let!(:issue) { create(:issue, author: user, assignee: user, project: project, :label_list => "label1, label2") } | |
11 | - before { project.team << [user, :reporter] } | |
12 | - | |
13 | - | |
14 | - describe "GET /projects/:id/labels" do | |
15 | - it "should return project labels" do | |
16 | - get api("/projects/#{project.id}/labels", user) | |
17 | - response.status.should == 200 | |
18 | - json_response.should be_an Array | |
19 | - json_response.first['name'].should == 'label1' | |
20 | - json_response.last['name'].should == 'label2' | |
21 | - end | |
22 | - end | |
23 | - | |
24 | - | |
25 | -end | |
26 | - |
spec/requests/api/projects_spec.rb
... | ... | @@ -13,6 +13,7 @@ describe API::API do |
13 | 13 | let(:snippet) { create(:project_snippet, author: user, project: project, title: 'example') } |
14 | 14 | let(:users_project) { create(:users_project, user: user, project: project, project_access: UsersProject::MASTER) } |
15 | 15 | let(:users_project2) { create(:users_project, user: user3, project: project, project_access: UsersProject::DEVELOPER) } |
16 | + let(:issue_with_labels) { create(:issue, author: user, assignee: user, project: project, :label_list => "label1, label2") } | |
16 | 17 | |
17 | 18 | describe "GET /projects" do |
18 | 19 | before { project } |
... | ... | @@ -632,4 +633,16 @@ describe API::API do |
632 | 633 | end |
633 | 634 | end |
634 | 635 | end |
636 | + | |
637 | + describe "GET /projects/:id/labels" do | |
638 | + before { issue_with_labels } | |
639 | + | |
640 | + it "should return project labels" do | |
641 | + get api("/projects/#{project.id}/labels", user) | |
642 | + response.status.should == 200 | |
643 | + json_response.should be_an Array | |
644 | + json_response.first['name'].should == issue_with_labels.labels.first.name | |
645 | + json_response.last['name'].should == issue_with_labels.labels.last.name | |
646 | + end | |
647 | + end | |
635 | 648 | end | ... | ... |