2019-04-29 20:27:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-03-01 15:11:48 -05:00
|
|
|
Fabricator(:category) do
|
|
|
|
name { sequence(:name) { |n| "Amazing Category #{n}" } }
|
2019-08-06 06:26:54 -04:00
|
|
|
skip_category_definition true
|
2017-03-01 15:11:48 -05:00
|
|
|
user
|
|
|
|
end
|
|
|
|
|
2019-08-06 06:26:54 -04:00
|
|
|
Fabricator(:category_with_definition, from: :category) do
|
|
|
|
skip_category_definition false
|
|
|
|
end
|
|
|
|
|
2017-03-01 15:11:48 -05:00
|
|
|
Fabricator(:diff_category, from: :category) do
|
|
|
|
name "Different Category"
|
|
|
|
user
|
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:happy_category, from: :category) do
|
|
|
|
name 'Happy Category'
|
|
|
|
slug 'happy'
|
|
|
|
user
|
|
|
|
end
|
|
|
|
|
|
|
|
Fabricator(:private_category, from: :category) do
|
|
|
|
transient :group
|
|
|
|
|
|
|
|
name 'Private Category'
|
|
|
|
slug 'private'
|
|
|
|
user
|
|
|
|
after_build do |cat, transients|
|
|
|
|
cat.update!(read_restricted: true)
|
|
|
|
cat.category_groups.build(group_id: transients[:group].id, permission_type: CategoryGroup.permission_types[:full])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-08-06 06:26:54 -04:00
|
|
|
Fabricator(:private_category_with_definition, from: :private_category) do
|
|
|
|
skip_category_definition false
|
|
|
|
end
|
2017-03-01 15:11:48 -05:00
|
|
|
Fabricator(:link_category, from: :category) do
|
|
|
|
before_validation { |category, transients| category.topic_featured_link_allowed = true }
|
2015-03-02 14:25:25 -05:00
|
|
|
end
|
2017-11-17 08:48:48 -05:00
|
|
|
|
|
|
|
Fabricator(:mailinglist_mirror_category, from: :category) do
|
|
|
|
email_in 'list@example.com'
|
|
|
|
email_in_allow_strangers true
|
|
|
|
mailinglist_mirror true
|
|
|
|
end
|