diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /spec/models/member_spec.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/models/member_spec.rb')
-rw-r--r-- | spec/models/member_spec.rb | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb index f155c240fb2..a3ed39abfb3 100644 --- a/spec/models/member_spec.rb +++ b/spec/models/member_spec.rb @@ -113,9 +113,10 @@ RSpec.describe Member do end describe 'Scopes & finders' do - before do - project = create(:project, :public) - group = create(:group) + let_it_be(:project) { create(:project, :public) } + let_it_be(:group) { create(:group) } + + before_all do @owner_user = create(:user).tap { |u| group.add_owner(u) } @owner = group.members.find_by(user_id: @owner_user.id) @@ -252,9 +253,9 @@ RSpec.describe Member do describe '.add_user' do %w[project group].each do |source_type| context "when source is a #{source_type}" do - let!(:source) { create(source_type, :public) } - let!(:user) { create(:user) } - let!(:admin) { create(:admin) } + let_it_be(:source, reload: true) { create(source_type, :public) } + let_it_be(:user) { create(:user) } + let_it_be(:admin) { create(:admin) } it 'returns a <Source>Member object' do member = described_class.add_user(source, user, :maintainer) @@ -322,7 +323,7 @@ RSpec.describe Member do it 'adds the user as a member' do expect(source.users).not_to include(user) - described_class.add_user(source, 42, :maintainer) + described_class.add_user(source, non_existing_record_id, :maintainer) expect(source.users.reload).not_to include(user) end @@ -482,10 +483,10 @@ RSpec.describe Member do describe '.add_users' do %w[project group].each do |source_type| context "when source is a #{source_type}" do - let!(:source) { create(source_type, :public) } - let!(:admin) { create(:admin) } - let(:user1) { create(:user) } - let(:user2) { create(:user) } + let_it_be(:source) { create(source_type, :public) } + let_it_be(:admin) { create(:admin) } + let_it_be(:user1) { create(:user) } + let_it_be(:user2) { create(:user) } it 'returns a <Source>Member objects' do members = described_class.add_users(source, [user1, user2], :maintainer) |