blob: ecf3e4e065e5e9bc0bf74c494a29b0ba78458150 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# frozen_string_literal: true
FactoryBot.define do
sequence(:gitaly_commit_id) { Digest::SHA1.hexdigest(Time.now.to_f.to_s) }
factory :gitaly_commit, class: 'Gitaly::GitCommit' do
skip_create
id { generate(:gitaly_commit_id) }
parent_ids do
ids = [generate(:gitaly_commit_id), generate(:gitaly_commit_id)]
Google::Protobuf::RepeatedField.new(:string, ids)
end
subject { "My commit" }
body { subject + "\nMy body" }
author { association(:gitaly_commit_author) }
committer { association(:gitaly_commit_author) }
trailers do
trailers = body.lines.keep_if { |l| l =~ /.*: / }.map do |l|
key, value = *l.split(":").map(&:strip)
Gitaly::CommitTrailer.new(key: key, value: value)
end
Google::Protobuf::RepeatedField.new(:message, Gitaly::CommitTrailer, trailers)
end
end
end
|