discourse/spec/fabricators/category_fabricator.rb

28 lines
605 B
Ruby
Raw Normal View History

2013-02-05 13:16:51 -06:00
Fabricator(:category) do
name { sequence(:name) { |n| "Amazing Category #{n}" } }
2013-02-05 13:16:51 -06:00
user
end
Fabricator(:diff_category, from: :category) do
name "Different Category"
user
end
2014-12-20 08:07:29 -06:00
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