Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-08-09 21:07:43 +0300
committerStan Hu <stanhu@gmail.com>2018-08-09 21:36:26 +0300
commit58b68954b4c0673fffa3bd1e14e412a8c6140709 (patch)
tree9000749ace1da8dd43782d8a8bde3416b83ddccd /db
parentbe1ef711edb13114cf6478821293bb2f0821e75c (diff)
Add mock data for spam logs
Closes https://gitlab.com/gitlab-org/gitlab-development-kit/issues/387
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/development/23_spam_logs.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/db/fixtures/development/23_spam_logs.rb b/db/fixtures/development/23_spam_logs.rb
new file mode 100644
index 00000000000..81cc13e6b2d
--- /dev/null
+++ b/db/fixtures/development/23_spam_logs.rb
@@ -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