Commit 58fe40fb authored by Rémy Coutable's avatar Rémy Coutable

Don't use FFaker in factories, use sequences instead

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 169dc4ce
module Db module Db
module Fixtures module Fixtures
class Development module Development
class AbuseReport
def self.seed def self.seed
Gitlab::Seeder.quiet do Gitlab::Seeder.quiet do
(AbuseReport.default_per_page + 3).times do (::AbuseReport.default_per_page + 3).times do
reported_user = reported_user =
User.create!( ::User.create!(
username: FFaker::Internet.user_name, username: FFaker::Internet.user_name,
name: FFaker::Name.name, name: FFaker::Name.name,
email: FFaker::Internet.email, email: FFaker::Internet.email,
...@@ -13,13 +14,14 @@ module Db ...@@ -13,13 +14,14 @@ module Db
password: '12345678' password: '12345678'
) )
AbuseReport.create(reporter: User.take, user: reported_user, message: 'User sends spam') ::AbuseReport.create(reporter: ::User.take, user: reported_user, message: 'User sends spam')
print '.' print '.'
end end
end end
end end
end end
end end
end
end end
Db::Fixtures::Development.seed Db::Fixtures::Development::AbuseReport.seed
FactoryGirl.define do FactoryGirl.define do
factory :label, class: ProjectLabel do trait :base_label do
title { generate(:label) } title { generate(:label_title) }
color "#990000" color "#990000"
end
factory :label, traits: [:base_label], class: ProjectLabel do
project factory: :empty_project project factory: :empty_project
transient do transient do
...@@ -15,9 +18,7 @@ FactoryGirl.define do ...@@ -15,9 +18,7 @@ FactoryGirl.define do
end end
end end
factory :group_label, class: GroupLabel do factory :group_label, traits: [:base_label] do
title { generate(:label) }
color "#990000"
group group
end end
end end
...@@ -6,7 +6,7 @@ FactoryGirl.define do ...@@ -6,7 +6,7 @@ FactoryGirl.define do
sequence(:title) { |n| "My title #{n}" } sequence(:title) { |n| "My title #{n}" }
sequence(:filename) { |n| "filename-#{n}.rb" } sequence(:filename) { |n| "filename-#{n}.rb" }
sequence(:url) { |n| "http://example#{n}.org" } sequence(:url) { |n| "http://example#{n}.org" }
sequence(:label) { |n| "label#{n}" } sequence(:label_title) { |n| "label#{n}" }
sequence(:branch) { |n| "my-branch-#{n}" } sequence(:branch) { |n| "my-branch-#{n}" }
sequence(:issue_created_at) { |n| 4.hours.ago + (2 * n).seconds } sequence(:past_time) { |n| 4.hours.ago + (2 * n).seconds }
end end
...@@ -19,7 +19,7 @@ describe API::Issues, api: true do ...@@ -19,7 +19,7 @@ describe API::Issues, api: true do
project: project, project: project,
state: :closed, state: :closed,
milestone: milestone, milestone: milestone,
created_at: generate(:issue_created_at), created_at: generate(:past_time),
updated_at: 3.hours.ago updated_at: 3.hours.ago
end end
let!(:confidential_issue) do let!(:confidential_issue) do
...@@ -28,7 +28,7 @@ describe API::Issues, api: true do ...@@ -28,7 +28,7 @@ describe API::Issues, api: true do
project: project, project: project,
author: author, author: author,
assignee: assignee, assignee: assignee,
created_at: generate(:issue_created_at), created_at: generate(:past_time),
updated_at: 2.hours.ago updated_at: 2.hours.ago
end end
let!(:issue) do let!(:issue) do
...@@ -37,7 +37,7 @@ describe API::Issues, api: true do ...@@ -37,7 +37,7 @@ describe API::Issues, api: true do
assignee: user, assignee: user,
project: project, project: project,
milestone: milestone, milestone: milestone,
created_at: generate(:issue_created_at), created_at: generate(:past_time),
updated_at: 1.hour.ago updated_at: 1.hour.ago
end end
let!(:label) do let!(:label) do
......
...@@ -19,7 +19,7 @@ describe API::V3::Issues, api: true do ...@@ -19,7 +19,7 @@ describe API::V3::Issues, api: true do
project: project, project: project,
state: :closed, state: :closed,
milestone: milestone, milestone: milestone,
created_at: generate(:issue_created_at), created_at: generate(:past_time),
updated_at: 3.hours.ago updated_at: 3.hours.ago
end end
let!(:confidential_issue) do let!(:confidential_issue) do
...@@ -28,7 +28,7 @@ describe API::V3::Issues, api: true do ...@@ -28,7 +28,7 @@ describe API::V3::Issues, api: true do
project: project, project: project,
author: author, author: author,
assignee: assignee, assignee: assignee,
created_at: generate(:issue_created_at), created_at: generate(:past_time),
updated_at: 2.hours.ago updated_at: 2.hours.ago
end end
let!(:issue) do let!(:issue) do
...@@ -37,7 +37,7 @@ describe API::V3::Issues, api: true do ...@@ -37,7 +37,7 @@ describe API::V3::Issues, api: true do
assignee: user, assignee: user,
project: project, project: project,
milestone: milestone, milestone: milestone,
created_at: generate(:issue_created_at), created_at: generate(:past_time),
updated_at: 1.hour.ago updated_at: 1.hour.ago
end end
let!(:label) do let!(:label) do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment