diff options
-rw-r--r-- | spec/models/cycle_analytics/code_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/cycle_analytics/plan_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/cycle_analytics/review_spec.rb | 5 | ||||
-rw-r--r-- | spec/support/git_helpers.rb | 9 |
4 files changed, 14 insertions, 6 deletions
diff --git a/spec/models/cycle_analytics/code_spec.rb b/spec/models/cycle_analytics/code_spec.rb index 1eaccb5e937..a81b5cf444d 100644 --- a/spec/models/cycle_analytics/code_spec.rb +++ b/spec/models/cycle_analytics/code_spec.rb @@ -7,13 +7,13 @@ describe 'CycleAnalytics#code', feature: true do subject { CycleAnalytics.new(project, from: from_date) } def create_commit_referencing_issue(issue) - sha = project.repository.commit_file(user, FFaker::Product.brand, "content", "Commit for ##{issue.iid}", "master", false) + 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) end def create_merge_request_closing_issue(issue, message: nil) - source_branch = FFaker::Product.brand + source_branch = random_git_name project.repository.add_branch(user, source_branch, 'master') opts = { diff --git a/spec/models/cycle_analytics/plan_spec.rb b/spec/models/cycle_analytics/plan_spec.rb index 4cae87e9d89..42984169b28 100644 --- a/spec/models/cycle_analytics/plan_spec.rb +++ b/spec/models/cycle_analytics/plan_spec.rb @@ -7,7 +7,7 @@ describe 'CycleAnalytics#plan', feature: true do subject { CycleAnalytics.new(project, from: from_date) } def create_commit_referencing_issue(issue) - sha = project.repository.commit_file(user, FFaker::Product.brand, "content", "Commit for ##{issue.iid}", "master", false) + 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! end diff --git a/spec/models/cycle_analytics/review_spec.rb b/spec/models/cycle_analytics/review_spec.rb index 5099e502345..8530d70a38e 100644 --- a/spec/models/cycle_analytics/review_spec.rb +++ b/spec/models/cycle_analytics/review_spec.rb @@ -7,9 +7,9 @@ describe 'CycleAnalytics#review', feature: true do subject { CycleAnalytics.new(project, from: from_date) } def create_merge_request_closing_issue(issue) - source_branch = FFaker::Product.brand + source_branch = random_git_name project.repository.add_branch(user, source_branch, 'master') - sha = project.repository.commit_file(user, FFaker::Product.brand, "content", "commit message", source_branch, false) + sha = project.repository.commit_file(user, random_git_name, "content", "commit message", source_branch, false) project.repository.commit(sha) opts = { @@ -22,7 +22,6 @@ describe 'CycleAnalytics#review', feature: true do 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) } diff --git a/spec/support/git_helpers.rb b/spec/support/git_helpers.rb new file mode 100644 index 00000000000..93422390ef7 --- /dev/null +++ b/spec/support/git_helpers.rb @@ -0,0 +1,9 @@ +module GitHelpers + def random_git_name + "#{FFaker::Product.brand}-#{FFaker::Product.brand}-#{rand(1000)}" + end +end + +RSpec.configure do |config| + config.include GitHelpers +end |