diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-09-27 14:29:56 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-09-27 14:29:56 +0300 |
commit | edebd5e76395883213e40e10b7bfdc81d20d351b (patch) | |
tree | ad7b2a591feac8b11b8818a33c3ac6b0d384a44b /spec/support | |
parent | 04d9547c4893338f084b83f8c2c11c5405cb36df (diff) | |
parent | da1fa1e14f86c1deabe047f61e6526e4870a07c5 (diff) |
Merge branch '22578-cycle-analytics-incorrect-commit-count'
Diffstat (limited to 'spec/support')
-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 |