Class: DiscourseDev::Category

Inherits:
Record
  • Object
show all
Defined in:
lib/discourse_dev/category.rb

Constant Summary

Constants inherited from Record

Record::DEFAULT_COUNT

Instance Attribute Summary

Attributes inherited from Record

#model, #type

Instance Method Summary collapse

Methods inherited from Record

#count, #create!, #populate!, populate!

Constructor Details

#initialize(count = DEFAULT_COUNT) ⇒ Category

Returns a new instance of Category.



10
11
12
# File 'lib/discourse_dev/category.rb', line 10

def initialize(count = DEFAULT_COUNT)
  super(::Category, count)
end

Instance Method Details

#dataObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/discourse_dev/category.rb', line 14

def data
  name = Faker::Name.name
  email = Faker::Internet.email(name: name)
  username = Faker::Internet.username(specifier: name)[0, SiteSetting.max_username_length]
  username_lower = username.downcase

  {
    name: name,
    email: email,
    username: username,
    username_lower: username_lower,
    trust_level: Faker::Number.between(from: 1, to: 4)
  }
end