blob: ee1ae6b1781dc8b75521576763ad60b22b1d2362 (
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
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe API::Helpers::MembersHelpers, feature_category: :subgroups do
let(:helper) do
Class.new.include(described_class).new
end
describe '#source_members' do
subject(:source_members) { helper.source_members(source) }
shared_examples_for 'returns all direct members' do
specify do
expect(source_members).to match_array(direct_members)
end
end
context 'for a group' do
let_it_be(:source) { create(:group) }
let_it_be(:direct_members) { create_list(:group_member, 2, group: source) }
it_behaves_like 'returns all direct members'
it_behaves_like 'query with source filters'
end
context 'for a project' do
let_it_be(:source) { create(:project, group: create(:group)) }
let_it_be(:direct_members) { create_list(:project_member, 2, project: source) }
it_behaves_like 'returns all direct members'
it_behaves_like 'query without source filters'
end
end
end
|