]> git.openstreetmap.org Git - rails.git/blobdiff - test/factories/user_blocks.rb
Merge pull request #4761 from AntonKhorev:dark-mode-with-close-button
[rails.git] / test / factories / user_blocks.rb
index 8f7edaf6e2f4444fda84ca7b1b4fb3fdd04a05d6..8bdd6875e014ed8e364871b41781cfccd31cfa84 100644 (file)
@@ -1,22 +1,31 @@
-FactoryGirl.define do
+FactoryBot.define do
   factory :user_block do
     sequence(:reason) { |n| "User Block #{n}" }
-    ends_at Time.now + 1.day
+    ends_at { Time.now.utc + 1.day }
+    deactivates_at { ends_at }
 
     user
-    association :creator, :factory => :moderator_user
+    creator :factory => :moderator_user
+
+    trait :zero_hour do
+      now = Time.now.utc
+      created_at { now }
+      ends_at { now }
+    end
 
     trait :needs_view do
-      needs_view true
+      needs_view { true }
+      deactivates_at { nil }
     end
 
     trait :expired do
-      ends_at Time.now - 1.day
+      created_at { Time.now.utc - 2.days }
+      ends_at { Time.now.utc - 1.day }
     end
 
     trait :revoked do
-      # FIXME: requires User factory
-      revoker_id 5
+      expired
+      revoker :factory => :moderator_user
     end
   end
 end