mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-27 04:51:14 +00:00
23 lines
437 B
Ruby
23 lines
437 B
Ruby
|
FactoryGirl.define do
|
||
|
factory :ban do
|
||
|
ban_type Ban::TYPE_SITE
|
||
|
expiry Date.today + 1
|
||
|
# Hack because of the awkward way bans are created (requires user_name)
|
||
|
before(:create) do |ban|
|
||
|
if ban.user.nil?
|
||
|
user = create :user
|
||
|
ban.user_name = user.username
|
||
|
else
|
||
|
ban.user_name = ban.user.username
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
trait :mute do
|
||
|
ban_type Ban::TYPE_MUTE
|
||
|
end
|
||
|
|
||
|
trait :expired do
|
||
|
expiry Date.yesterday - 1
|
||
|
end
|
||
|
end
|