about summary refs log tree commit diff
path: root/spec/fabricators
diff options
context:
space:
mode:
authorMatt Jankowski <matt@jankowski.online>2023-03-04 11:12:09 -0500
committerGitHub <noreply@github.com>2023-03-04 17:12:09 +0100
commitcd99fa8cebc6efa059b4fca743d517c88f8d9686 (patch)
treec5abb6d00b2ac0245d58f017c125049be66cc04c /spec/fabricators
parentc40d5e5a8fb02f2c603a23a1b0130b3f86a15710 (diff)
Fabricator specs (#23925)
Diffstat (limited to 'spec/fabricators')
-rw-r--r--spec/fabricators/account_alias_fabricator.rb7
-rw-r--r--spec/fabricators/account_deletion_request_fabricator.rb5
-rw-r--r--spec/fabricators/account_migration_fabricator.rb1
-rw-r--r--spec/fabricators/account_moderation_note_fabricator.rb3
-rw-r--r--spec/fabricators/account_pin_fabricator.rb5
-rw-r--r--spec/fabricators/account_stat_fabricator.rb8
-rw-r--r--spec/fabricators/account_tag_stat_fabricator.rb5
-rw-r--r--spec/fabricators/account_warning_preset_fabricator.rb5
-rw-r--r--spec/fabricators/admin_action_log_fabricator.rb2
-rw-r--r--spec/fabricators/announcement_mute_fabricator.rb6
-rw-r--r--spec/fabricators/announcement_reaction_fabricator.rb7
-rw-r--r--spec/fabricators/conversation_account_fabricator.rb8
-rw-r--r--spec/fabricators/conversation_mute_fabricator.rb4
-rw-r--r--spec/fabricators/custom_emoji_category_fabricator.rb5
-rw-r--r--spec/fabricators/encrypted_message_fabricator.rb10
-rw-r--r--spec/fabricators/featured_tag_fabricator.rb8
-rw-r--r--spec/fabricators/follow_recommendation_suppression_fabricator.rb5
-rw-r--r--spec/fabricators/identity_fabricator.rb2
-rw-r--r--spec/fabricators/import_fabricator.rb4
-rw-r--r--spec/fabricators/ip_block_fabricator.rb8
-rw-r--r--spec/fabricators/list_account_fabricator.rb7
-rw-r--r--spec/fabricators/one_time_key_fabricator.rb13
-rw-r--r--spec/fabricators/setting_fabricator.rb1
-rw-r--r--spec/fabricators/site_upload_fabricator.rb1
-rw-r--r--spec/fabricators/status_edit_fabricator.rb9
-rw-r--r--spec/fabricators/status_stat_fabricator.rb8
-rw-r--r--spec/fabricators/unavailable_domain_fabricator.rb2
-rw-r--r--spec/fabricators/user_invite_request_fabricator.rb6
-rw-r--r--spec/fabricators/web_setting_fabricator.rb4
29 files changed, 15 insertions, 144 deletions
diff --git a/spec/fabricators/account_alias_fabricator.rb b/spec/fabricators/account_alias_fabricator.rb
deleted file mode 100644
index 4f434c078..000000000
--- a/spec/fabricators/account_alias_fabricator.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:account_alias) do
-  account
-  acct 'test@example.com'
-  uri 'https://example.com/users/test'
-end
diff --git a/spec/fabricators/account_deletion_request_fabricator.rb b/spec/fabricators/account_deletion_request_fabricator.rb
deleted file mode 100644
index 3d3d37398..000000000
--- a/spec/fabricators/account_deletion_request_fabricator.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:account_deletion_request) do
-  account
-end
diff --git a/spec/fabricators/account_migration_fabricator.rb b/spec/fabricators/account_migration_fabricator.rb
index fd453f6d2..ae6143a65 100644
--- a/spec/fabricators/account_migration_fabricator.rb
+++ b/spec/fabricators/account_migration_fabricator.rb
@@ -5,4 +5,5 @@ Fabricator(:account_migration) do
   target_account { |attrs| Fabricate(:account, also_known_as: [ActivityPub::TagManager.instance.uri_for(attrs[:account])]) }
   acct           { |attrs| attrs[:target_account].acct }
   followers_count 1234
+  created_at { 60.days.ago }
 end
diff --git a/spec/fabricators/account_moderation_note_fabricator.rb b/spec/fabricators/account_moderation_note_fabricator.rb
index 403870db6..341a24dea 100644
--- a/spec/fabricators/account_moderation_note_fabricator.rb
+++ b/spec/fabricators/account_moderation_note_fabricator.rb
@@ -2,5 +2,6 @@
 
 Fabricator(:account_moderation_note) do
   content 'MyText'
-  account nil
+  account
+  target_account { Fabricate(:account) }
 end
diff --git a/spec/fabricators/account_pin_fabricator.rb b/spec/fabricators/account_pin_fabricator.rb
index 7d8a77bb5..32a5f3bdb 100644
--- a/spec/fabricators/account_pin_fabricator.rb
+++ b/spec/fabricators/account_pin_fabricator.rb
@@ -1,6 +1,7 @@
 # frozen_string_literal: true
 
 Fabricator(:account_pin) do
-  account        nil
-  target_account nil
+  account
+  target_account(fabricator: :account)
+  before_create { |account_pin, _| account_pin.account.follow!(account_pin.target_account) }
 end
diff --git a/spec/fabricators/account_stat_fabricator.rb b/spec/fabricators/account_stat_fabricator.rb
index 45b1524ef..e6085c5f2 100644
--- a/spec/fabricators/account_stat_fabricator.rb
+++ b/spec/fabricators/account_stat_fabricator.rb
@@ -1,8 +1,8 @@
 # frozen_string_literal: true
 
 Fabricator(:account_stat) do
-  account         nil
-  statuses_count  ''
-  following_count ''
-  followers_count ''
+  account
+  statuses_count  '123'
+  following_count '456'
+  followers_count '789'
 end
diff --git a/spec/fabricators/account_tag_stat_fabricator.rb b/spec/fabricators/account_tag_stat_fabricator.rb
deleted file mode 100644
index 769015bd0..000000000
--- a/spec/fabricators/account_tag_stat_fabricator.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:account_tag_stat) do
-  accounts_count ''
-end
diff --git a/spec/fabricators/account_warning_preset_fabricator.rb b/spec/fabricators/account_warning_preset_fabricator.rb
deleted file mode 100644
index 7588e7f9c..000000000
--- a/spec/fabricators/account_warning_preset_fabricator.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:account_warning_preset) do
-  text 'MyText'
-end
diff --git a/spec/fabricators/admin_action_log_fabricator.rb b/spec/fabricators/admin_action_log_fabricator.rb
index eb738c01c..a259644bd 100644
--- a/spec/fabricators/admin_action_log_fabricator.rb
+++ b/spec/fabricators/admin_action_log_fabricator.rb
@@ -1,7 +1,7 @@
 # frozen_string_literal: true
 
 Fabricator('Admin::ActionLog') do
-  account nil
+  account
   action  'MyString'
   target  nil
 end
diff --git a/spec/fabricators/announcement_mute_fabricator.rb b/spec/fabricators/announcement_mute_fabricator.rb
deleted file mode 100644
index 109fec041..000000000
--- a/spec/fabricators/announcement_mute_fabricator.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:announcement_mute) do
-  account
-  announcement
-end
diff --git a/spec/fabricators/announcement_reaction_fabricator.rb b/spec/fabricators/announcement_reaction_fabricator.rb
deleted file mode 100644
index 5da51caaa..000000000
--- a/spec/fabricators/announcement_reaction_fabricator.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:announcement_reaction) do
-  account
-  announcement
-  name '🌿'
-end
diff --git a/spec/fabricators/conversation_account_fabricator.rb b/spec/fabricators/conversation_account_fabricator.rb
deleted file mode 100644
index f69d36855..000000000
--- a/spec/fabricators/conversation_account_fabricator.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:conversation_account) do
-  account                 nil
-  conversation            nil
-  participant_account_ids ''
-  last_status             nil
-end
diff --git a/spec/fabricators/conversation_mute_fabricator.rb b/spec/fabricators/conversation_mute_fabricator.rb
deleted file mode 100644
index 5cf4dd3d5..000000000
--- a/spec/fabricators/conversation_mute_fabricator.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:conversation_mute) do
-end
diff --git a/spec/fabricators/custom_emoji_category_fabricator.rb b/spec/fabricators/custom_emoji_category_fabricator.rb
deleted file mode 100644
index 6019baba2..000000000
--- a/spec/fabricators/custom_emoji_category_fabricator.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:custom_emoji_category) do
-  name 'MyString'
-end
diff --git a/spec/fabricators/encrypted_message_fabricator.rb b/spec/fabricators/encrypted_message_fabricator.rb
deleted file mode 100644
index 289882754..000000000
--- a/spec/fabricators/encrypted_message_fabricator.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:encrypted_message) do
-  device
-  from_account
-  from_device_id   { Faker::Number.number(digits: 5) }
-  type             0
-  body             ''
-  message_franking ''
-end
diff --git a/spec/fabricators/featured_tag_fabricator.rb b/spec/fabricators/featured_tag_fabricator.rb
deleted file mode 100644
index 4bfa3e924..000000000
--- a/spec/fabricators/featured_tag_fabricator.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:featured_tag) do
-  account
-  tag
-  statuses_count 1_337
-  last_status_at Time.now.utc
-end
diff --git a/spec/fabricators/follow_recommendation_suppression_fabricator.rb b/spec/fabricators/follow_recommendation_suppression_fabricator.rb
deleted file mode 100644
index 6477baee1..000000000
--- a/spec/fabricators/follow_recommendation_suppression_fabricator.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:follow_recommendation_suppression) do
-  account
-end
diff --git a/spec/fabricators/identity_fabricator.rb b/spec/fabricators/identity_fabricator.rb
index b83010111..58072c0d6 100644
--- a/spec/fabricators/identity_fabricator.rb
+++ b/spec/fabricators/identity_fabricator.rb
@@ -1,7 +1,7 @@
 # frozen_string_literal: true
 
 Fabricator(:identity) do
-  user     nil
+  user
   provider 'MyString'
   uid      'MyString'
 end
diff --git a/spec/fabricators/import_fabricator.rb b/spec/fabricators/import_fabricator.rb
deleted file mode 100644
index 11602f407..000000000
--- a/spec/fabricators/import_fabricator.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:import) do
-end
diff --git a/spec/fabricators/ip_block_fabricator.rb b/spec/fabricators/ip_block_fabricator.rb
deleted file mode 100644
index a5da3f706..000000000
--- a/spec/fabricators/ip_block_fabricator.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:ip_block) do
-  ip         ''
-  severity   ''
-  expires_at '2020-10-08 22:20:37'
-  comment    'MyText'
-end
diff --git a/spec/fabricators/list_account_fabricator.rb b/spec/fabricators/list_account_fabricator.rb
deleted file mode 100644
index b0af29e6f..000000000
--- a/spec/fabricators/list_account_fabricator.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:list_account) do
-  list    nil
-  account nil
-  follow  nil
-end
diff --git a/spec/fabricators/one_time_key_fabricator.rb b/spec/fabricators/one_time_key_fabricator.rb
deleted file mode 100644
index e317c28bd..000000000
--- a/spec/fabricators/one_time_key_fabricator.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:one_time_key) do
-  device
-  key_id { Faker::Alphanumeric.alphanumeric(number: 10) }
-  key    { Base64.strict_encode64(Ed25519::SigningKey.generate.verify_key.to_bytes) }
-
-  signature do |attrs|
-    signing_key = Ed25519::SigningKey.generate
-    attrs[:device].update(fingerprint_key: Base64.strict_encode64(signing_key.verify_key.to_bytes))
-    Base64.strict_encode64(signing_key.sign(attrs[:key]))
-  end
-end
diff --git a/spec/fabricators/setting_fabricator.rb b/spec/fabricators/setting_fabricator.rb
index 336d7c355..ce9a48e90 100644
--- a/spec/fabricators/setting_fabricator.rb
+++ b/spec/fabricators/setting_fabricator.rb
@@ -1,4 +1,5 @@
 # frozen_string_literal: true
 
 Fabricator(:setting) do
+  var 'var'
 end
diff --git a/spec/fabricators/site_upload_fabricator.rb b/spec/fabricators/site_upload_fabricator.rb
index ad1b777cc..87553ccb8 100644
--- a/spec/fabricators/site_upload_fabricator.rb
+++ b/spec/fabricators/site_upload_fabricator.rb
@@ -2,4 +2,5 @@
 
 Fabricator(:site_upload) do
   file { Rails.root.join('spec', 'fabricators', 'assets', 'utah_teapot.png').open }
+  var 'thumbnail'
 end
diff --git a/spec/fabricators/status_edit_fabricator.rb b/spec/fabricators/status_edit_fabricator.rb
deleted file mode 100644
index 33735a459..000000000
--- a/spec/fabricators/status_edit_fabricator.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:status_edit) do
-  status                    nil
-  account                   nil
-  text                      'MyText'
-  spoiler_text              'MyText'
-  media_attachments_changed false
-end
diff --git a/spec/fabricators/status_stat_fabricator.rb b/spec/fabricators/status_stat_fabricator.rb
deleted file mode 100644
index 8a358c51a..000000000
--- a/spec/fabricators/status_stat_fabricator.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:status_stat) do
-  status_id        nil
-  replies_count    ''
-  reblogs_count    ''
-  favourites_count ''
-end
diff --git a/spec/fabricators/unavailable_domain_fabricator.rb b/spec/fabricators/unavailable_domain_fabricator.rb
index 300a9e7a1..cb9707020 100644
--- a/spec/fabricators/unavailable_domain_fabricator.rb
+++ b/spec/fabricators/unavailable_domain_fabricator.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
 
 Fabricator(:unavailable_domain) do
-  domain { Faker::Internet.domain }
+  domain { Faker::Internet.domain_name }
 end
diff --git a/spec/fabricators/user_invite_request_fabricator.rb b/spec/fabricators/user_invite_request_fabricator.rb
deleted file mode 100644
index 7736263e4..000000000
--- a/spec/fabricators/user_invite_request_fabricator.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:user_invite_request) do
-  user
-  text { Faker::Lorem.sentence }
-end
diff --git a/spec/fabricators/web_setting_fabricator.rb b/spec/fabricators/web_setting_fabricator.rb
deleted file mode 100644
index 7c9f30079..000000000
--- a/spec/fabricators/web_setting_fabricator.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-# frozen_string_literal: true
-
-Fabricator(:web_setting, from: Web::Setting) do
-end