Welcome to mirror list, hosted at ThFree Co, Russian Federation.

search_archived_filter_shared_examples.rb « gitlab « lib « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7bcefd07fc4a787c26787d7bc2773d1657010536 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

RSpec.shared_examples 'search results filtered by archived' do
  context 'when filter not provided (all behavior)' do
    let(:filters) { {} }

    it 'returns unarchived results only', :aggregate_failures do
      expect(results.objects('projects')).to include unarchived_project
      expect(results.objects('projects')).not_to include archived_project
    end
  end

  context 'when include_archived is true' do
    let(:filters) { { include_archived: true } }

    it 'returns archived and unarchived results', :aggregate_failures do
      expect(results.objects('projects')).to include unarchived_project
      expect(results.objects('projects')).to include archived_project
    end
  end

  context 'when include_archived filter is false' do
    let(:filters) { { include_archived: false } }

    it 'returns unarchived results only', :aggregate_failures do
      expect(results.objects('projects')).to include unarchived_project
      expect(results.objects('projects')).not_to include archived_project
    end
  end
end