summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-17 12:06:48 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-17 12:06:48 +0000
commitbd860c22f6a4b9473cbddd34a53eead8235a7ea1 (patch)
tree3f955a56c2ac90497863da26902a42dba49f3466 /spec/support/shared_examples
parente567b4c2df7dc4085d213db029eff6b6fcde0152 (diff)
downloadgitlab-ce-bd860c22f6a4b9473cbddd34a53eead8235a7ea1.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples')
-rw-r--r--spec/support/shared_examples/finders/assignees_filter_shared_examples.rb12
-rw-r--r--spec/support/shared_examples/models/cluster_application_core_shared_examples.rb4
-rw-r--r--spec/support/shared_examples/requests/api/issues_shared_examples.rb21
3 files changed, 37 insertions, 0 deletions
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 } }