diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-15 00:10:32 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-15 00:10:32 +0000 |
commit | 0a977c1034dbc147771db52e9fbc8ede43eb7e0c (patch) | |
tree | 7e9f63fbb6bcfd509abb2bec6221ac1a51d567c8 /spec/models/merge_request_spec.rb | |
parent | db2275b561bace34d90b901226d7f46d33e4cbd9 (diff) | |
download | gitlab-ce-0a977c1034dbc147771db52e9fbc8ede43eb7e0c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/merge_request_spec.rb')
-rw-r--r-- | spec/models/merge_request_spec.rb | 78 |
1 files changed, 1 insertions, 77 deletions
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index b16fa4df6c1..32518b867cb 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -5416,82 +5416,6 @@ RSpec.describe MergeRequest, factory_default: :keep do subject(:suggested_reviewer_users) { merge_request.suggested_reviewer_users } - shared_examples 'blank suggestions' do - it 'returns an empty relation' do - expect(suggested_reviewer_users).to be_empty - end - end - - context 'when predictions is nil' do - it_behaves_like 'blank suggestions' - end - - context 'when predictions is not nil' do - before do - merge_request.build_predictions - end - - context 'when predictions is a non hash' do - before do - merge_request.build_predictions - merge_request.predictions.suggested_reviewers = 1 - end - - it_behaves_like 'blank suggestions' - end - - context 'when predictions is an empty hash' do - before do - merge_request.predictions.suggested_reviewers = {} - end - - it_behaves_like 'blank suggestions' - end - - context 'when suggests a user who is not a member' do - let_it_be(:non_member) { create(:user) } - - before do - merge_request.predictions.suggested_reviewers = { 'reviewers' => [non_member.username] } - end - - it_behaves_like 'blank suggestions' - end - - context 'when suggests users who are members' do - let_it_be(:first_member) { create(:user) } - let_it_be(:second_member) { create(:user) } - - before_all do - project.add_developer(first_member) - project.add_developer(second_member) - end - - before do - merge_request.predictions.suggested_reviewers = { - 'reviewers' => [ - second_member.username, - first_member.username - ] - } - end - - context 'when a user is inactive' do - before do - second_member.deactivate - end - - it 'returns only active users' do - expect(suggested_reviewer_users).to eq([first_member]) - end - end - - context 'when all users are active' do - it 'returns users in correct suggested order' do - expect(suggested_reviewer_users).to eq([second_member, first_member]) - end - end - end - end + it { is_expected.to be_empty } end end |