Merge branch 'sh-add-seed-fixtures-for-spam-logs' into 'master'
Add mock data for spam logs Closes gitlab-development-kit#387 See merge request gitlab-org/gitlab-ce!21117
This commit is contained in:
commit
a266cd25da
1 changed files with 32 additions and 0 deletions
32
db/fixtures/development/23_spam_logs.rb
Normal file
32
db/fixtures/development/23_spam_logs.rb
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Db
|
||||||
|
module Fixtures
|
||||||
|
module Development
|
||||||
|
class SpamLog
|
||||||
|
def self.seed
|
||||||
|
Gitlab::Seeder.quiet do
|
||||||
|
(::SpamLog.default_per_page + 3).times do |i|
|
||||||
|
::SpamLog.create(
|
||||||
|
user: self.random_user,
|
||||||
|
user_agent: FFaker::Lorem.sentence,
|
||||||
|
source_ip: FFaker::Internet.ip_v4_address,
|
||||||
|
title: FFaker::Lorem.sentence,
|
||||||
|
description: FFaker::Lorem.paragraph,
|
||||||
|
via_api: FFaker::Boolean.random,
|
||||||
|
submitted_as_ham: FFaker::Boolean.random,
|
||||||
|
recaptcha_verified: FFaker::Boolean.random)
|
||||||
|
print '.'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.random_user
|
||||||
|
User.find(User.pluck(:id).sample)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Db::Fixtures::Development::SpamLog.seed
|
Loading…
Reference in a new issue