diff options
Diffstat (limited to 'spec/models/members')
-rw-r--r-- | spec/models/members/group_member_spec.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/spec/models/members/group_member_spec.rb b/spec/models/members/group_member_spec.rb index 9af620e70a5..2b24e2d6455 100644 --- a/spec/models/members/group_member_spec.rb +++ b/spec/models/members/group_member_spec.rb @@ -4,9 +4,10 @@ require 'spec_helper' RSpec.describe GroupMember do context 'scopes' do + let_it_be(:user_1) { create(:user) } + let_it_be(:user_2) { create(:user) } + it 'counts users by group ID' do - user_1 = create(:user) - user_2 = create(:user) group_1 = create(:group) group_2 = create(:group) @@ -25,6 +26,15 @@ RSpec.describe GroupMember do expect(described_class.of_ldap_type).to eq([group_member]) end end + + describe '.with_user' do + it 'returns requested user' do + group_member = create(:group_member, user: user_2) + create(:group_member, user: user_1) + + expect(described_class.with_user(user_2)).to eq([group_member]) + end + end end describe '.access_level_roles' do |