diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-17 12:06:48 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-17 12:06:48 +0000 |
commit | bd860c22f6a4b9473cbddd34a53eead8235a7ea1 (patch) | |
tree | 3f955a56c2ac90497863da26902a42dba49f3466 /spec/support | |
parent | e567b4c2df7dc4085d213db029eff6b6fcde0152 (diff) | |
download | gitlab-ce-bd860c22f6a4b9473cbddd34a53eead8235a7ea1.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
4 files changed, 39 insertions, 0 deletions
diff --git a/spec/support/shared_contexts/finders/issues_finder_shared_contexts.rb b/spec/support/shared_contexts/finders/issues_finder_shared_contexts.rb index 26ab6fbd400..6c96b18d834 100644 --- a/spec/support/shared_contexts/finders/issues_finder_shared_contexts.rb +++ b/spec/support/shared_contexts/finders/issues_finder_shared_contexts.rb @@ -12,6 +12,7 @@ RSpec.shared_context 'IssuesFinder context' do set(:project3) { create(:project, group: subgroup) } set(:milestone) { create(:milestone, project: project1) } set(:label) { create(:label, project: project2) } + set(:label2) { create(:label, project: project2) } set(:issue1) { create(:issue, author: user, assignees: [user], project: project1, milestone: milestone, title: 'gitlab', created_at: 1.week.ago, updated_at: 1.week.ago) } set(:issue2) { create(:issue, author: user, assignees: [user], project: project2, description: 'gitlab', created_at: 1.week.from_now, updated_at: 1.week.from_now) } set(:issue3) { create(:issue, author: user2, assignees: [user2], project: project2, title: 'tanuki', description: 'tanuki', created_at: 2.weeks.from_now, updated_at: 2.weeks.from_now) } @@ -24,6 +25,7 @@ end RSpec.shared_context 'IssuesFinder#execute context' do let!(:closed_issue) { create(:issue, author: user2, assignees: [user2], project: project2, state: 'closed') } let!(:label_link) { create(:label_link, label: label, target: issue2) } + let!(:label_link2) { create(:label_link, label: label2, target: issue3) } let(:search_user) { user } let(:params) { {} } let(:issues) { described_class.new(search_user, params.reverse_merge(scope: scope, state: 'opened')).execute } 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 } } |