diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-09-07 11:59:12 +0300 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-09-07 11:59:12 +0300 |
commit | 0a767f7b618161278b66f7e1d842a51c8cab37b3 (patch) | |
tree | 26ea426551f117870b2f63321bcf581e6711f34c /spec/models/cycle_analytics/staging_spec.rb | |
parent | 32147ddf5412bceaea809dedb028b23f55461a89 (diff) |
Consolidate all cycle analytics helper methods.
1. Move the test generation to `CycleAnalyticsHelpers::TestGeneration`
2. Move all helper methods (previously placed in each individual spec
file) to `CycleAnalyticsHelpers`
Diffstat (limited to 'spec/models/cycle_analytics/staging_spec.rb')
-rw-r--r-- | spec/models/cycle_analytics/staging_spec.rb | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/spec/models/cycle_analytics/staging_spec.rb b/spec/models/cycle_analytics/staging_spec.rb index 23e01532500..105f566f41c 100644 --- a/spec/models/cycle_analytics/staging_spec.rb +++ b/spec/models/cycle_analytics/staging_spec.rb @@ -6,36 +6,6 @@ describe 'CycleAnalytics#staging', feature: true do let(:user) { create(:user, :admin) } subject { CycleAnalytics.new(project, from: from_date) } - def create_merge_request_closing_issue(issue, message: nil) - source_branch = random_git_name - project.repository.add_branch(user, source_branch, 'master') - sha = project.repository.commit_file(user, random_git_name, "content", "commit message", source_branch, false) - project.repository.commit(sha) - - opts = { - title: 'Awesome merge_request', - description: message || "Fixes #{issue.to_reference}", - source_branch: source_branch, - target_branch: 'master' - } - - MergeRequests::CreateService.new(project, user, opts).execute - end - - def merge_merge_requests_closing_issue(issue) - merge_requests = issue.closed_by_merge_requests - merge_requests.each { |merge_request| MergeRequests::MergeService.new(project, user).execute(merge_request) } - end - - def deploy_master(environment: 'production') - CreateDeploymentService.new(project, user, { - environment: environment, - ref: 'master', - tag: false, - sha: project.repository.commit('master').sha - }).execute - end - generate_cycle_analytics_spec(phase: :staging, data_fn: lambda do |context| issue = context.create(:issue, project: context.project) |