]> git.openstreetmap.org Git - rails.git/blob - test/factories/user_blocks.rb
Merge remote-tracking branch 'upstream/pull/5419'
[rails.git] / test / factories / user_blocks.rb
1 FactoryBot.define do
2   factory :user_block do
3     sequence(:reason) { |n| "User Block #{n}" }
4     ends_at { Time.now.utc + 1.day }
5     deactivates_at { ends_at }
6
7     user
8     creator :factory => :moderator_user
9
10     trait :zero_hour do
11       now = Time.now.utc
12       created_at { now }
13       ends_at { now }
14     end
15
16     trait :needs_view do
17       needs_view { true }
18       deactivates_at { nil }
19     end
20
21     trait :expired do
22       created_at { Time.now.utc - 2.days }
23       ends_at { Time.now.utc - 1.day }
24     end
25
26     trait :revoked do
27       expired
28       revoker :factory => :moderator_user
29     end
30   end
31 end