diff options
author | Luke Duncalfe <lduncalfe@gitlab.com> | 2019-02-06 12:33:11 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-02-06 12:33:11 +0000 |
commit | 2b7dd017af7de4d09ef3a1cd835e8d07c8800b6a (patch) | |
tree | 47615a573f6dc932353f0f6695cd4fcd050b1201 /spec/factories | |
parent | 5bfa8e2f5e03849645570ba8c2dbfcc5c834f1b1 (diff) | |
download | gitlab-ce-2b7dd017af7de4d09ef3a1cd835e8d07c8800b6a.tar.gz |
Allow custom squash commit messages
Diffstat (limited to 'spec/factories')
-rw-r--r-- | spec/factories/commits.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/factories/commits.rb b/spec/factories/commits.rb index 818f7b046f6..2bcc4b6cf52 100644 --- a/spec/factories/commits.rb +++ b/spec/factories/commits.rb @@ -16,14 +16,24 @@ FactoryBot.define do commit end + project + skip_create # Commits cannot be persisted + initialize_with do new(git_commit, project) end after(:build) do |commit, evaluator| allow(commit).to receive(:author).and_return(evaluator.author || build_stubbed(:author)) + allow(commit).to receive(:parent_ids).and_return([]) + end + + trait :merge_commit do + after(:build) do |commit| + allow(commit).to receive(:parent_ids).and_return(Array.new(2) { SecureRandom.hex(20) }) + end end trait :without_author do |