diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /spec/support/shared_examples/lib/gitlab/search_confidential_filter_shared_examples.rb | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) | |
download | gitlab-ce-48aff82709769b098321c738f3444b9bdaa694c6.tar.gz |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'spec/support/shared_examples/lib/gitlab/search_confidential_filter_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/lib/gitlab/search_confidential_filter_shared_examples.rb | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/spec/support/shared_examples/lib/gitlab/search_confidential_filter_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/search_confidential_filter_shared_examples.rb new file mode 100644 index 00000000000..d0bef2ad730 --- /dev/null +++ b/spec/support/shared_examples/lib/gitlab/search_confidential_filter_shared_examples.rb @@ -0,0 +1,69 @@ +# frozen_string_literal: true + +RSpec.shared_examples 'search results filtered by confidential' do + context 'filter not provided (all behavior)' do + let(:filters) { {} } + + context 'when Feature search_filter_by_confidential enabled' do + it 'returns confidential and not confidential results', :aggregate_failures do + expect(results.objects('issues')).to include confidential_result + expect(results.objects('issues')).to include opened_result + end + end + + context 'when Feature search_filter_by_confidential not enabled' do + before do + stub_feature_flags(search_filter_by_confidential: false) + end + + it 'returns confidential and not confidential results', :aggregate_failures do + expect(results.objects('issues')).to include confidential_result + expect(results.objects('issues')).to include opened_result + end + end + end + + context 'confidential filter' do + let(:filters) { { confidential: true } } + + context 'when Feature search_filter_by_confidential enabled' do + it 'returns only confidential results', :aggregate_failures do + expect(results.objects('issues')).to include confidential_result + expect(results.objects('issues')).not_to include opened_result + end + end + + context 'when Feature search_filter_by_confidential not enabled' do + before do + stub_feature_flags(search_filter_by_confidential: false) + end + + it 'returns confidential and not confidential results', :aggregate_failures do + expect(results.objects('issues')).to include confidential_result + expect(results.objects('issues')).to include opened_result + end + end + end + + context 'not confidential filter' do + let(:filters) { { confidential: false } } + + context 'when Feature search_filter_by_confidential enabled' do + it 'returns not confidential results', :aggregate_failures do + expect(results.objects('issues')).not_to include confidential_result + expect(results.objects('issues')).to include opened_result + end + end + + context 'when Feature search_filter_by_confidential not enabled' do + before do + stub_feature_flags(search_filter_by_confidential: false) + end + + it 'returns confidential and not confidential results', :aggregate_failures do + expect(results.objects('issues')).to include confidential_result + expect(results.objects('issues')).to include opened_result + end + end + end +end |