2020-03-15 13:33:58 +00:00
|
|
|
|
FactoryBot.define do
|
2020-03-23 03:11:36 +00:00
|
|
|
|
factory :ban, class: Ban do
|
2020-03-17 01:03:02 +00:00
|
|
|
|
ban_type { Ban::TYPE_SITE }
|
|
|
|
|
expiry { Time.now.utc.to_date + 1 }
|
2015-08-01 15:44:39 +00:00
|
|
|
|
# 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
|
2015-11-07 06:21:31 +00:00
|
|
|
|
else
|
2015-08-01 15:44:39 +00:00
|
|
|
|
ban.user_name = ban.user.username
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2020-03-23 03:11:36 +00:00
|
|
|
|
trait :mute do
|
|
|
|
|
ban_type { Ban::TYPE_MUTE }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
trait :site do
|
|
|
|
|
ban_type { Ban::TYPE_SITE }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
trait :gather do
|
|
|
|
|
ban_type { Ban::TYPE_GATHER }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
trait :expired do
|
|
|
|
|
expiry { Date.yesterday - 1 }
|
|
|
|
|
end
|
2015-08-01 15:44:39 +00:00
|
|
|
|
end
|
2015-11-07 06:21:31 +00:00
|
|
|
|
end
|