summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-04-28 15:02:45 +0000
committerDouwe Maan <douwe@gitlab.com>2017-04-28 15:02:45 +0000
commit2bd552041661ad1f2e5364a643a21d1419a9e6b3 (patch)
treed0589df69095b5e323106df1ec247de8b153c2e7 /spec
parent17a4c2a1c22a7bc6cafeebd36f3de4ad041fb939 (diff)
parentb8dc4c761dd5277188320c74633122b8a3a3173a (diff)
downloadgitlab-ce-2bd552041661ad1f2e5364a643a21d1419a9e6b3.tar.gz
Merge branch 'dz-improve-add-users-method' into 'master'
Collect all users by single query when using Member#add_users See merge request !10975
Diffstat (limited to 'spec')
-rw-r--r--spec/models/member_spec.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb
index b0f3657d3b5..ccc3deac199 100644
--- a/spec/models/member_spec.rb
+++ b/spec/models/member_spec.rb
@@ -390,13 +390,15 @@ describe Member, models: true do
%w[project group].each do |source_type|
context "when source is a #{source_type}" do
let!(:source) { create(source_type, :public, :access_requestable) }
- let!(:user) { create(:user) }
let!(:admin) { create(:admin) }
+ let(:user1) { create(:user) }
+ let(:user2) { create(:user) }
it 'returns a <Source>Member objects' do
- members = described_class.add_users(source, [user], :master)
+ members = described_class.add_users(source, [user1, user2], :master)
expect(members).to be_a Array
+ expect(members.size).to eq(2)
expect(members.first).to be_a "#{source_type.classify}Member".constantize
expect(members.first).to be_persisted
end