diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /spec/models/commit_collection_spec.rb | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'spec/models/commit_collection_spec.rb')
-rw-r--r-- | spec/models/commit_collection_spec.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/spec/models/commit_collection_spec.rb b/spec/models/commit_collection_spec.rb index 93c696cae54..6dd34c3e21f 100644 --- a/spec/models/commit_collection_spec.rb +++ b/spec/models/commit_collection_spec.rb @@ -15,26 +15,34 @@ RSpec.describe CommitCollection do end describe '.committers' do + subject(:collection) { described_class.new(project, [commit]) } + it 'returns a relation of users when users are found' do user = create(:user, email: commit.committer_email.upcase) - collection = described_class.new(project, [commit]) expect(collection.committers).to contain_exactly(user) end it 'returns empty array when committers cannot be found' do - collection = described_class.new(project, [commit]) - expect(collection.committers).to be_empty end it 'excludes authors of merge commits' do commit = project.commit("60ecb67744cb56576c30214ff52294f8ce2def98") create(:user, email: commit.committer_email.upcase) - collection = described_class.new(project, [commit]) expect(collection.committers).to be_empty end + + context 'when committer email is nil' do + before do + allow(commit).to receive(:committer_email).and_return(nil) + end + + it 'returns empty array when committers cannot be found' do + expect(collection.committers).to be_empty + end + end end describe '#without_merge_commits' do |