summaryrefslogtreecommitdiff
path: root/spec/models/members
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 12:26:25 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 12:26:25 +0000
commita09983ae35713f5a2bbb100981116d31ce99826e (patch)
tree2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/models/members
parent18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff)
downloadgitlab-ce-a09983ae35713f5a2bbb100981116d31ce99826e.tar.gz
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/models/members')
-rw-r--r--spec/models/members/group_member_spec.rb58
-rw-r--r--spec/models/members/project_member_spec.rb2
2 files changed, 14 insertions, 46 deletions
diff --git a/spec/models/members/group_member_spec.rb b/spec/models/members/group_member_spec.rb
index fdb71b7ec7d..9af620e70a5 100644
--- a/spec/models/members/group_member_spec.rb
+++ b/spec/models/members/group_member_spec.rb
@@ -2,52 +2,20 @@
require 'spec_helper'
-describe GroupMember do
+RSpec.describe GroupMember do
context 'scopes' do
- shared_examples '.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 '.count_users_by_group_id with optimized_count_users_by_group_id feature flag on' do
- before do
- stub_feature_flags(optimized_count_users_by_group_id: true)
- end
-
- it_behaves_like '.count_users_by_group_id'
-
- it 'does not JOIN users' do
- scope = described_class.all
- expect(scope).not_to receive(:joins).with(:user)
-
- scope.count_users_by_group_id
- end
- end
-
- describe '.count_users_by_group_id with optimized_count_users_by_group_id feature flag off' do
- before do
- stub_feature_flags(optimized_count_users_by_group_id: false)
- end
-
- it_behaves_like '.count_users_by_group_id'
-
- it 'does JOIN users' do
- scope = described_class.all
- expect(scope).to receive(:joins).with(:user).and_call_original
-
- scope.count_users_by_group_id
- end
+ 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
describe '.of_ldap_type' do
diff --git a/spec/models/members/project_member_spec.rb b/spec/models/members/project_member_spec.rb
index fdb9457b211..f25f8933184 100644
--- a/spec/models/members/project_member_spec.rb
+++ b/spec/models/members/project_member_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe ProjectMember do
+RSpec.describe ProjectMember do
describe 'associations' do
it { is_expected.to belong_to(:project).with_foreign_key(:source_id) }
end