summaryrefslogtreecommitdiff
path: root/db/fixtures/development/23_spam_logs.rb
blob: 81cc13e6b2d42d3001e7edc4e1c06ae18de062e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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