Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Duncalfe <lduncalfe@gitlab.com>2019-02-06 15:33:11 +0300
committerNick Thomas <nick@gitlab.com>2019-02-06 15:33:11 +0300
commit2b7dd017af7de4d09ef3a1cd835e8d07c8800b6a (patch)
tree47615a573f6dc932353f0f6695cd4fcd050b1201 /spec/factories
parent5bfa8e2f5e03849645570ba8c2dbfcc5c834f1b1 (diff)
Allow custom squash commit messages
Diffstat (limited to 'spec/factories')
-rw-r--r--spec/factories/commits.rb10
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