summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/factories/issues.rb2
-rw-r--r--spec/factories/merge_requests.rb2
-rw-r--r--spec/factories/sequences.rb2
-rw-r--r--spec/factories/snippets.rb9
-rw-r--r--spec/features/admin/admin_browse_spam_logs_spec.rb2
-rw-r--r--spec/features/issuables/issuable_list_spec.rb4
-rw-r--r--spec/support/cycle_analytics_helpers.rb4
-rw-r--r--spec/support/filter_spec_helper.rb4
8 files changed, 14 insertions, 15 deletions
diff --git a/spec/factories/issues.rb b/spec/factories/issues.rb
index dbd0fff8376..0b6977e3b17 100644
--- a/spec/factories/issues.rb
+++ b/spec/factories/issues.rb
@@ -1,6 +1,6 @@
FactoryGirl.define do
factory :issue do
- title
+ title { generate(:title) }
author
project factory: :empty_project
diff --git a/spec/factories/merge_requests.rb b/spec/factories/merge_requests.rb
index ae0bbbd6aeb..e36fe326e1c 100644
--- a/spec/factories/merge_requests.rb
+++ b/spec/factories/merge_requests.rb
@@ -1,6 +1,6 @@
FactoryGirl.define do
factory :merge_request do
- title
+ title { generate(:title) }
author
association :source_project, :repository, factory: :project
target_project { source_project }
diff --git a/spec/factories/sequences.rb b/spec/factories/sequences.rb
index 5b8501aa770..2321455bfee 100644
--- a/spec/factories/sequences.rb
+++ b/spec/factories/sequences.rb
@@ -3,6 +3,8 @@ FactoryGirl.define do
sequence(:name) { |n| "John Doe#{n}" }
sequence(:email) { |n| "user#{n}@example.org" }
sequence(:email_alias) { |n| "user.alias#{n}@example.org" }
+ sequence(:title) { |n| "My title #{n}" }
+ sequence(:filename) { |n| "filename-#{n}.rb" }
sequence(:url) { |n| "http://example#{n}.org" }
sequence(:label) { |n| "label#{n}" }
sequence(:branch) { |n| "my-branch-#{n}" }
diff --git a/spec/factories/snippets.rb b/spec/factories/snippets.rb
index fb87c584f0b..18cb0f5de26 100644
--- a/spec/factories/snippets.rb
+++ b/spec/factories/snippets.rb
@@ -1,12 +1,9 @@
FactoryGirl.define do
- sequence(:title, aliases: [:content]) { |n| "My snippet #{n}" }
- sequence(:file_name) { |n| "snippet-#{n}.rb" }
-
factory :snippet do
author
- title
- content
- file_name
+ title { generate(:title) }
+ content { generate(:title) }
+ file_name { generate(:filename) }
trait :public do
visibility_level Snippet::PUBLIC
diff --git a/spec/features/admin/admin_browse_spam_logs_spec.rb b/spec/features/admin/admin_browse_spam_logs_spec.rb
index 562ace92598..bee57472270 100644
--- a/spec/features/admin/admin_browse_spam_logs_spec.rb
+++ b/spec/features/admin/admin_browse_spam_logs_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe 'Admin browse spam logs' do
- let!(:spam_log) { create(:spam_log) }
+ let!(:spam_log) { create(:spam_log, description: 'abcde ' * 20) }
before do
login_as :admin
diff --git a/spec/features/issuables/issuable_list_spec.rb b/spec/features/issuables/issuable_list_spec.rb
index f324354dd46..3dc872ae520 100644
--- a/spec/features/issuables/issuable_list_spec.rb
+++ b/spec/features/issuables/issuable_list_spec.rb
@@ -51,7 +51,7 @@ describe 'issuable list', feature: true do
if issuable_type == :issue
create(:issue, project: project, author: user)
else
- create(:merge_request, source_project: project, source_branch: "#{n}-feature")
+ create(:merge_request, source_project: project, source_branch: generate(:branch))
end
2.times do
@@ -66,7 +66,7 @@ describe 'issuable list', feature: true do
issue = Issue.reorder(:iid).first
merge_request = create(:merge_request,
source_project: project,
- source_branch: 'my-bug-fix')
+ source_branch: generate(:branch))
MergeRequestsClosingIssues.create!(issue: issue, merge_request: merge_request)
end
diff --git a/spec/support/cycle_analytics_helpers.rb b/spec/support/cycle_analytics_helpers.rb
index 37ee4d55769..8ad042f5e3b 100644
--- a/spec/support/cycle_analytics_helpers.rb
+++ b/spec/support/cycle_analytics_helpers.rb
@@ -1,6 +1,6 @@
module CycleAnalyticsHelpers
- def create_commit_referencing_issue(issue, branch_name: nil)
- project.repository.add_branch(user, branch_name || generate(:branch), 'master')
+ def create_commit_referencing_issue(issue, branch_name: generate(:branch))
+ project.repository.add_branch(user, branch_name, 'master')
create_commit("Commit for ##{issue.iid}", issue.project, user, branch_name)
end
diff --git a/spec/support/filter_spec_helper.rb b/spec/support/filter_spec_helper.rb
index a8e454eb09e..b871b7ffc90 100644
--- a/spec/support/filter_spec_helper.rb
+++ b/spec/support/filter_spec_helper.rb
@@ -63,9 +63,9 @@ module FilterSpecHelper
#
# Returns a String
def invalidate_reference(reference)
- if reference =~ /\A(.+)?.\d+\z/
+ if reference =~ /\A(.+)?[^\d]\d+\z/
# Integer-based reference with optional project prefix
- reference.gsub(/\d+\z/) { |i| i.to_i + 1 }
+ reference.gsub(/\d+\z/) { |i| i.to_i + 10_000 }
elsif reference =~ /\A(.+@)?(\h{7,40}\z)/
# SHA-based reference with optional prefix
reference.gsub(/\h{7,40}\z/) { |v| v.reverse }