summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/finders/assignees_filter_shared_examples.rb
blob: f1df1052ef2309c137ea97b5ea869488abe241bd (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# frozen_string_literal: true

shared_examples 'assignee ID filter' do
  it 'returns issuables assigned to that user' do
    expect(issuables).to contain_exactly(*expected_issuables)
  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' } }

  it 'returns issuables not assigned to any assignee' do
    expect(issuables).to contain_exactly(*expected_issuables)
  end

  it 'returns issuables not assigned to any assignee' do
    params[:assignee_id] = 'none'

    expect(issuables).to contain_exactly(*expected_issuables)
  end
end

shared_examples 'any assignee filter' do
  context '' do
    let(:params) { { assignee_id: 'Any' } }

    it 'returns issuables assigned to any assignee' do
      expect(issuables).to contain_exactly(*expected_issuables)
    end

    it 'returns issuables assigned to any assignee' do
      params[:assignee_id] = 'any'

      expect(issuables).to contain_exactly(*expected_issuables)
    end
  end
end