debian-mirror-gitlab/spec/lib/api/helpers/members_helpers_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
1 KiB
Ruby
Raw Permalink Normal View History

2023-03-17 16:20:25 +05:30
# 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