summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Coda Zabetta <francesco.codazabetta@gmail.com>2016-11-15 11:45:57 +0100
committerFrancesco Coda Zabetta <francesco.codazabetta@gmail.com>2016-11-15 11:45:57 +0100
commit8966c6e33daec5480f19149d2a6102107833afe0 (patch)
treecc53852052ec21bd68e98056a84d8024b2d23e80
parenta58e2f4762d8f0fc52b0a4dc5a65c28258603c11 (diff)
downloadgitlab-ce-8966c6e33daec5480f19149d2a6102107833afe0.tar.gz
add tests
-rw-r--r--spec/requests/api/labels_spec.rb27
1 files changed, 21 insertions, 6 deletions
diff --git a/spec/requests/api/labels_spec.rb b/spec/requests/api/labels_spec.rb
index 151b5c33e3a..77dfebf1a98 100644
--- a/spec/requests/api/labels_spec.rb
+++ b/spec/requests/api/labels_spec.rb
@@ -19,6 +19,8 @@ describe API::API, api: true do
project.update(group: group)
create(:labeled_issue, project: project, labels: [group_label], author: user)
create(:labeled_issue, project: project, labels: [label1], author: user, state: :closed)
+ create(:labeled_merge_request, labels: [priority_label], author: user, source_project: project )
+
expected_keys = [
'id', 'name', 'color', 'description',
'open_issues_count', 'closed_issues_count', 'open_merge_requests_count',
@@ -39,17 +41,30 @@ describe API::API, api: true do
expect(label1_response['open_issues_count']).to eq(0)
expect(label1_response['closed_issues_count']).to eq(1)
- expect(group_label_response['open_issues_count']).to eq(1)
- expect(group_label_response['closed_issues_count']).to eq(0)
- expect(priority_label_response['open_issues_count']).to eq(0)
- expect(priority_label_response['closed_issues_count']).to eq(0)
-
+ expect(label1_response['open_merge_requests_count']).to eq(0)
expect(label1_response['name']).to eq(label1.name)
expect(label1_response['color']).to be_present
expect(label1_response['description']).to be_nil
- expect(label1_response['open_merge_requests_count']).to eq(0)
expect(label1_response['priority']).to be_nil
expect(label1_response['subscribed']).to be_falsey
+
+ expect(group_label_response['open_issues_count']).to eq(1)
+ expect(group_label_response['closed_issues_count']).to eq(0)
+ expect(group_label_response['open_merge_requests_count']).to eq(0)
+ expect(group_label_response['name']).to eq(group_label.name)
+ expect(group_label_response['color']).to be_present
+ expect(group_label_response['description']).to be_nil
+ expect(group_label_response['priority']).to be_nil
+ expect(group_label_response['subscribed']).to be_falsey
+
+ expect(priority_label_response['open_issues_count']).to eq(0)
+ expect(priority_label_response['closed_issues_count']).to eq(0)
+ expect(priority_label_response['open_merge_requests_count']).to eq(1)
+ expect(priority_label_response['name']).to eq(priority_label.name)
+ expect(priority_label_response['color']).to be_present
+ expect(priority_label_response['description']).to be_nil
+ expect(priority_label_response['priority']).to eq(3)
+ expect(priority_label_response['subscribed']).to be_falsey
end
end