diff options
author | Ash McKenzie <ash@the-rebellion.net> | 2019-07-18 12:09:30 +1000 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2019-07-18 12:34:17 +1000 |
commit | f53112de5931144ac74819f87c227f06e115ba58 (patch) | |
tree | 3181a5601e537b32100f88389779903976097b7a /spec/models | |
parent | d00d60a66deeacb19ccbd39501946ed646db64b6 (diff) | |
download | gitlab-ce-f53112de5931144ac74819f87c227f06e115ba58.tar.gz |
New GroupMember.of_ldap_type scope39-count-unique-users-for-more-accurate-smau-reporting
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/members/group_member_spec.rb | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/spec/models/members/group_member_spec.rb b/spec/models/members/group_member_spec.rb index f227abd3dae..a6928ec31f4 100644 --- a/spec/models/members/group_member_spec.rb +++ b/spec/models/members/group_member_spec.rb @@ -3,19 +3,29 @@ require 'spec_helper' describe GroupMember do - describe '.count_users_by_group_id' do - it 'counts users by group ID' do - user_1 = create(:user) - user_2 = create(:user) - group_1 = create(:group) - group_2 = create(:group) - - group_1.add_owner(user_1) - group_1.add_owner(user_2) - group_2.add_owner(user_1) - - expect(described_class.count_users_by_group_id).to eq(group_1.id => 2, - group_2.id => 1) + context 'scopes' do + describe '.count_users_by_group_id' do + it 'counts users by group ID' do + user_1 = create(:user) + user_2 = create(:user) + group_1 = create(:group) + group_2 = create(:group) + + group_1.add_owner(user_1) + group_1.add_owner(user_2) + group_2.add_owner(user_1) + + expect(described_class.count_users_by_group_id).to eq(group_1.id => 2, + group_2.id => 1) + end + end + + describe '.of_ldap_type' do + it 'returns ldap type users' do + group_member = create(:group_member, :ldap) + + expect(described_class.of_ldap_type).to eq([group_member]) + end end end |