diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-09-20 09:54:42 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-09-20 13:23:14 +0530 |
commit | 204419e9e9b01977cbeac34b1a8385239b1455aa (patch) | |
tree | ffd299a69a4616501902d0be198d4c4aa0077f7e /spec/support | |
parent | 461b399538b275bf6b7b477c2f3dbd38718140c5 (diff) | |
download | gitlab-ce-204419e9e9b01977cbeac34b1a8385239b1455aa.tar.gz |
Test the `CycleAnalytics::Summary` model.
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/cycle_analytics_helpers.rb | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/spec/support/cycle_analytics_helpers.rb b/spec/support/cycle_analytics_helpers.rb index c5fe1170423..ffd3eb60b80 100644 --- a/spec/support/cycle_analytics_helpers.rb +++ b/spec/support/cycle_analytics_helpers.rb @@ -1,8 +1,28 @@ module CycleAnalyticsHelpers def create_commit_referencing_issue(issue) - sha = project.repository.commit_file(user, random_git_name, "content", "Commit for ##{issue.iid}", "master", false) - commit = project.repository.commit(sha) - commit.create_cross_references!(user) + branch_name = random_git_name + project.repository.add_branch(user, branch_name, 'master') + create_commit("Commit for ##{issue.iid}", issue.project, user, branch_name) + end + + def create_commit(message, project, user, branch_name) + 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 } + } + + commit_sha = Gitlab::Git::Blob.commit(project.repository, options) + project.repository.commit(commit_sha) + + GitPushService.new(project, + user, + oldrev: project.repository.commit(branch_name).sha, + newrev: commit_sha, + ref: 'refs/heads/master').execute end def create_merge_request_closing_issue(issue, message: nil) |