diff options
author | Rémy Coutable <remy@rymai.me> | 2019-05-20 12:49:23 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-05-20 12:49:23 +0300 |
commit | 23660f3ae424824db803ce4794240f718157b045 (patch) | |
tree | 5bfe7c6f326163a46abed6ee479e846579f2f1ae /spec/support | |
parent | f14565948f8d7759f6c0e7d6cc77445b2211e8f6 (diff) | |
parent | 9ff6edf690423a284f4d0ad924ff2a9a4285eb50 (diff) |
Merge branch 'ce-57402-add-issues-statistics-api-endpoints' into 'master'
Add issues_statistics api endpoints
See merge request gitlab-org/gitlab-ce!27366
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/shared_examples/requests/api/issues_shared_example_spec.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/support/shared_examples/requests/api/issues_shared_example_spec.rb b/spec/support/shared_examples/requests/api/issues_shared_example_spec.rb new file mode 100644 index 00000000000..1133e95e44e --- /dev/null +++ b/spec/support/shared_examples/requests/api/issues_shared_example_spec.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +shared_examples 'labeled issues with labels and label_name params' do + shared_examples 'returns label names' do + it 'returns label names' do + expect_paginated_array_response(issue.id) + expect(json_response.first['labels']).to eq([label_c.title, label_b.title, label.title]) + end + end + + shared_examples 'returns basic label entity' do + it 'returns basic label entity' do + expect_paginated_array_response(issue.id) + expect(json_response.first['labels'].pluck('name')).to eq([label_c.title, label_b.title, label.title]) + expect(json_response.first['labels'].first).to match_schema('/public_api/v4/label_basic') + end + end + + context 'array of labeled issues when all labels match' do + let(:params) { { labels: "#{label.title},#{label_b.title},#{label_c.title}" } } + + it_behaves_like 'returns label names' + end + + context 'array of labeled issues when all labels match with labels param as array' do + let(:params) { { labels: [label.title, label_b.title, label_c.title] } } + + it_behaves_like 'returns label names' + end + + context 'when with_labels_details provided' do + context 'array of labeled issues when all labels match' do + let(:params) { { labels: "#{label.title},#{label_b.title},#{label_c.title}", with_labels_details: true } } + + it_behaves_like 'returns basic label entity' + end + + context 'array of labeled issues when all labels match with labels param as array' do + let(:params) { { labels: [label.title, label_b.title, label_c.title], with_labels_details: true } } + + it_behaves_like 'returns basic label entity' + end + end +end |