2015-06-02 16:55:08 +00:00
|
|
|
FactoryGirl.define do
|
2015-08-01 15:44:39 +00:00
|
|
|
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
|
2015-06-02 16:55:08 +00:00
|
|
|
|
2015-08-01 15:44:39 +00:00
|
|
|
trait :mute do
|
|
|
|
ban_type Ban::TYPE_MUTE
|
|
|
|
end
|
2015-06-02 16:55:08 +00:00
|
|
|
|
2015-08-01 15:44:39 +00:00
|
|
|
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-06-02 16:55:08 +00:00
|
|
|
end
|