diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-09-07 10:58:19 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-09-07 11:26:07 +0530 |
commit | 0f44c5a56fdc5986797808c508d7b42236cee450 (patch) | |
tree | 423d79a1157e375984615adf619310c5a6b8ad78 /spec/models | |
parent | 71a9bcd3def27a46223ea052e7fe3560869b9d6d (diff) | |
download | gitlab-ce-0f44c5a56fdc5986797808c508d7b42236cee450.tar.gz |
Generate branch/file names more randomly to avoid failures.
- Tests would randomly fail because of naming conflicts.
- Use a `random_git_name` method instead of using `FFaker` directly.
Diffstat (limited to 'spec/models')
-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 |
3 files changed, 5 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) } |