| ... | @@ -390,7 +390,32 @@ describe Gitlab::Git::Commit, :seed_helper do |
... | @@ -390,7 +390,32 @@ describe Gitlab::Git::Commit, :seed_helper do |
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
describe '#batch_by_oid' do
|
|
shared_examples '.batch_by_oid' do
|
|
|
|
context 'with multiple OIDs' do
|
|
|
|
let(:oids) { [SeedRepo::Commit::ID, SeedRepo::FirstCommit::ID] }
|
|
|
|
|
|
|
|
it 'returns multiple commits' do
|
|
|
|
commits = described_class.batch_by_oid(repository, oids)
|
|
|
|
|
|
|
|
expect(commits.count).to eq(2)
|
|
|
|
expect(commits).to all( be_a(Gitlab::Git::Commit) )
|
|
|
|
expect(commits.first.sha).to eq(SeedRepo::Commit::ID)
|
|
|
|
expect(commits.second.sha).to eq(SeedRepo::FirstCommit::ID)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when oids is empty' do
|
|
|
|
it 'returns empty commits' do
|
|
|
|
commits = described_class.batch_by_oid(repository, [])
|
|
|
|
|
|
|
|
expect(commits.count).to eq(0)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '.batch_by_oid with Gitaly enabled' do
|
|
|
|
it_should_behave_like '.batch_by_oid'
|
|
|
|
|
|
|
context 'when oids is empty' do
|
|
context 'when oids is empty' do
|
|
|
it 'makes no Gitaly request' do
|
|
it 'makes no Gitaly request' do
|
|
|
expect(Gitlab::GitalyClient).not_to receive(:call)
|
|
expect(Gitlab::GitalyClient).not_to receive(:call)
|
| ... | @@ -400,6 +425,16 @@ describe Gitlab::Git::Commit, :seed_helper do |
... | @@ -400,6 +425,16 @@ describe Gitlab::Git::Commit, :seed_helper do |
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
describe '.batch_by_oid with Rugged enabled', :enable_rugged do
|
|
|
|
it_should_behave_like '.batch_by_oid'
|
|
|
|
|
|
|
|
it 'calls out to the Rugged implementation' do
|
|
|
|
allow_any_instance_of(Rugged).to receive(:rev_parse).with(SeedRepo::Commit::ID).and_call_original
|
|
|
|
|
|
|
|
described_class.batch_by_oid(repository, [SeedRepo::Commit::ID])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
shared_examples 'extracting commit signature' do
|
|
shared_examples 'extracting commit signature' do
|
|
|
context 'when the commit is signed' do
|
|
context 'when the commit is signed' do
|
|
|
let(:commit_id) { '0b4bc9a49b562e85de7cc9e834518ea6828729b9' }
|
|
let(:commit_id) { '0b4bc9a49b562e85de7cc9e834518ea6828729b9' }
|
| ... | |
... | |
| ... | | ... | |