diff options
Diffstat (limited to 'spec/models/commit_collection_spec.rb')
-rw-r--r-- | spec/models/commit_collection_spec.rb | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/spec/models/commit_collection_spec.rb b/spec/models/commit_collection_spec.rb index 6dd34c3e21f..1d2d89573bb 100644 --- a/spec/models/commit_collection_spec.rb +++ b/spec/models/commit_collection_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe CommitCollection do +RSpec.describe CommitCollection, feature_category: :source_code_management do let(:project) { create(:project, :repository) } let(:commit) { project.commit("c1c67abbaf91f624347bb3ae96eabe3a1b742478") } @@ -45,6 +45,24 @@ RSpec.describe CommitCollection do end end + describe '#committer_user_ids' do + subject(:collection) { described_class.new(project, [commit]) } + + it 'returns an array of committer user IDs' do + user = create(:user, email: commit.committer_email) + + expect(collection.committer_user_ids).to contain_exactly(user.id) + end + + context 'when there are no committers' do + subject(:collection) { described_class.new(project, []) } + + it 'returns an empty array' do + expect(collection.committer_user_ids).to be_empty + end + end + end + describe '#without_merge_commits' do it 'returns all commits except merge commits' do merge_commit = project.commit("60ecb67744cb56576c30214ff52294f8ce2def98") @@ -191,6 +209,19 @@ RSpec.describe CommitCollection do end end + describe '#load_tags' do + let(:gitaly_commit_with_tags) { project.commit('5937ac0a7beb003549fc5fd26fc247adbce4a52e') } + let(:collection) { described_class.new(project, [gitaly_commit_with_tags]) } + + subject { collection.load_tags } + + it 'loads tags' do + subject + + expect(collection.commits[0].referenced_by).to contain_exactly('refs/tags/v1.1.0') + end + end + describe '#respond_to_missing?' do it 'returns true when the underlying Array responds to the message' do collection = described_class.new(project, []) |