diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-09-27 14:29:56 +0300 |
---|---|---|
committer | Ruben Davila <rdavila84@gmail.com> | 2016-09-28 18:37:53 +0300 |
commit | 16518f6a377385c1d635049ba9601cd7ed2a68bc (patch) | |
tree | b8756a277c5f74e09bd72edccc60596f0668f428 /spec/support/cycle_analytics_helpers.rb | |
parent | 57837fd1ca96532e8e2ac0f3260dc3c028aebbb0 (diff) |
Merge branch '22578-cycle-analytics-incorrect-commit-count'
Diffstat (limited to 'spec/support/cycle_analytics_helpers.rb')
-rw-r--r-- | spec/support/cycle_analytics_helpers.rb | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/spec/support/cycle_analytics_helpers.rb b/spec/support/cycle_analytics_helpers.rb index e8e760a6187..62a5b46d47b 100644 --- a/spec/support/cycle_analytics_helpers.rb +++ b/spec/support/cycle_analytics_helpers.rb @@ -4,24 +4,28 @@ module CycleAnalyticsHelpers create_commit("Commit for ##{issue.iid}", issue.project, user, branch_name) end - def create_commit(message, project, user, branch_name) - filename = random_git_name + def create_commit(message, project, user, branch_name, count: 1) oldrev = project.repository.commit(branch_name).sha + commit_shas = Array.new(count) do |index| + filename = random_git_name - options = { - committer: project.repository.user_to_committer(user), - author: project.repository.user_to_committer(user), - commit: { message: message, branch: branch_name, update_ref: true }, - file: { content: "content", path: filename, update: false } - } + options = { + committer: project.repository.user_to_committer(user), + author: project.repository.user_to_committer(user), + commit: { message: message, branch: branch_name, update_ref: true }, + file: { content: "content", path: filename, update: false } + } + + commit_sha = Gitlab::Git::Blob.commit(project.repository, options) + project.repository.commit(commit_sha) - commit_sha = Gitlab::Git::Blob.commit(project.repository, options) - project.repository.commit(commit_sha) + commit_sha + end GitPushService.new(project, user, oldrev: oldrev, - newrev: commit_sha, + newrev: commit_shas.last, ref: 'refs/heads/master').execute end |