diff options
Diffstat (limited to 'spec/finders/groups/user_groups_finder_spec.rb')
-rw-r--r-- | spec/finders/groups/user_groups_finder_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/finders/groups/user_groups_finder_spec.rb b/spec/finders/groups/user_groups_finder_spec.rb index a4a9b8d16d0..9339741da79 100644 --- a/spec/finders/groups/user_groups_finder_spec.rb +++ b/spec/finders/groups/user_groups_finder_spec.rb @@ -9,6 +9,7 @@ RSpec.describe Groups::UserGroupsFinder do let_it_be(:private_maintainer_group) { create(:group, :private, name: 'b private maintainer', path: 'b-private-maintainer') } let_it_be(:public_developer_group) { create(:group, project_creation_level: nil, name: 'c public developer', path: 'c-public-developer') } let_it_be(:public_maintainer_group) { create(:group, name: 'a public maintainer', path: 'a-public-maintainer') } + let_it_be(:public_owner_group) { create(:group, name: 'a public owner', path: 'a-public-owner') } subject { described_class.new(current_user, target_user, arguments).execute } @@ -21,12 +22,14 @@ RSpec.describe Groups::UserGroupsFinder do private_maintainer_group.add_maintainer(user) public_developer_group.add_developer(user) public_maintainer_group.add_maintainer(user) + public_owner_group.add_owner(user) end it 'returns all groups where the user is a direct member' do is_expected.to match( [ public_maintainer_group, + public_owner_group, private_maintainer_group, public_developer_group, guest_group @@ -53,6 +56,7 @@ RSpec.describe Groups::UserGroupsFinder do is_expected.to match( [ public_maintainer_group, + public_owner_group, private_maintainer_group, public_developer_group ] @@ -73,6 +77,32 @@ RSpec.describe Groups::UserGroupsFinder do end end + context 'when permission is :transfer_projects' do + let(:arguments) { { permission_scope: :transfer_projects } } + + specify do + is_expected.to match( + [ + public_maintainer_group, + public_owner_group, + private_maintainer_group + ] + ) + end + + context 'when search is provided' do + let(:arguments) { { permission_scope: :transfer_projects, search: 'owner' } } + + specify do + is_expected.to match( + [ + public_owner_group + ] + ) + end + end + end + context 'when search is provided' do let(:arguments) { { search: 'maintainer' } } |