From bd860c22f6a4b9473cbddd34a53eead8235a7ea1 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 17 Sep 2019 12:06:48 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../finders/assignees_filter_shared_examples.rb | 12 ++++++++++++ .../cluster_application_core_shared_examples.rb | 4 ++++ .../requests/api/issues_shared_examples.rb | 21 +++++++++++++++++++++ 3 files changed, 37 insertions(+) (limited to 'spec/support/shared_examples') diff --git a/spec/support/shared_examples/finders/assignees_filter_shared_examples.rb b/spec/support/shared_examples/finders/assignees_filter_shared_examples.rb index a931c4df99f..f1df1052ef2 100644 --- a/spec/support/shared_examples/finders/assignees_filter_shared_examples.rb +++ b/spec/support/shared_examples/finders/assignees_filter_shared_examples.rb @@ -6,12 +6,24 @@ shared_examples 'assignee ID filter' do end end +shared_examples 'assignee NOT ID filter' do + it 'returns issuables not assigned to that user' do + expect(issuables).to contain_exactly(*expected_issuables) + end +end + shared_examples 'assignee username filter' do it 'returns issuables assigned to those users' do expect(issuables).to contain_exactly(*expected_issuables) end end +shared_examples 'assignee NOT username filter' do + it 'returns issuables not assigned to those users' do + expect(issuables).to contain_exactly(*expected_issuables) + end +end + shared_examples 'no assignee filter' do let(:params) { { assignee_id: 'None' } } diff --git a/spec/support/shared_examples/models/cluster_application_core_shared_examples.rb b/spec/support/shared_examples/models/cluster_application_core_shared_examples.rb index 8e58cc7ba22..affe88be475 100644 --- a/spec/support/shared_examples/models/cluster_application_core_shared_examples.rb +++ b/spec/support/shared_examples/models/cluster_application_core_shared_examples.rb @@ -21,4 +21,8 @@ shared_examples 'cluster application core specs' do |application_name| expect(Clusters::Cluster::APPLICATIONS[subject.name]).to eq(described_class) end end + + describe '.association_name' do + it { expect(described_class.association_name).to eq(:"application_#{subject.name}") } + end end diff --git a/spec/support/shared_examples/requests/api/issues_shared_examples.rb b/spec/support/shared_examples/requests/api/issues_shared_examples.rb index 1133e95e44e..d22210edf99 100644 --- a/spec/support/shared_examples/requests/api/issues_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/issues_shared_examples.rb @@ -8,6 +8,13 @@ shared_examples 'labeled issues with labels and label_name params' do end end + shared_examples 'returns negated label names' do + it 'returns label names' do + expect_paginated_array_response(issue2.id) + expect(json_response.first['labels']).to eq([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) @@ -28,6 +35,20 @@ shared_examples 'labeled issues with labels and label_name params' do it_behaves_like 'returns label names' end + context 'negation' do + context 'array of labeled issues when all labels match with negation' do + let(:params) { { labels: "#{label.title},#{label_b.title}", not: { labels: "#{label_c.title}" } } } + + it_behaves_like 'returns negated label names' + end + + context 'array of labeled issues when all labels match with negation with label params as array' do + let(:params) { { labels: [label.title, label_b.title], not: { labels: [label_c.title] } } } + + it_behaves_like 'returns negated label names' + end + 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 } } -- cgit v1.2.1