switch contents of embeddable_host_fabricator.rb and category_fabricator.rb

This commit is contained in:
Neil Lalonde 2017-03-01 15:11:48 -05:00
parent 262016604d
commit 51d7dc4355
2 changed files with 33 additions and 33 deletions

View File

@ -1,4 +1,31 @@
Fabricator(:embeddable_host) do
host "eviltrout.com"
category
Fabricator(:category) do
name { sequence(:name) { |n| "Amazing Category #{n}" } }
user
end
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
Fabricator(:link_category, from: :category) do
before_validation { |category, transients| category.topic_featured_link_allowed = true }
end

View File

@ -1,31 +1,4 @@
Fabricator(:category) do
name { sequence(:name) { |n| "Amazing Category #{n}" } }
user
end
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
Fabricator(:link_category, from: :category) do
before_validation { |category, transients| category.topic_featured_link_allowed = true }
Fabricator(:embeddable_host) do
host "eviltrout.com"
category
end