summaryrefslogtreecommitdiff
path: root/spec/models/commit_collection_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/commit_collection_spec.rb')
-rw-r--r--spec/models/commit_collection_spec.rb16
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