mirror of
https://github.com/kikobar/mastodon.git
synced 2024-12-29 09:14:15 +00:00
Use build
where possible in fabricators (#25360)
This commit is contained in:
parent
c94bb9ba9a
commit
3a2a15c6ea
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:account_domain_block) do
|
Fabricator(:account_domain_block) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
domain 'example.com'
|
domain 'example.com'
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
Fabricator(:account_moderation_note) do
|
Fabricator(:account_moderation_note) do
|
||||||
content 'MyText'
|
content 'MyText'
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
target_account { Fabricate(:account) }
|
target_account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:account_note) do
|
Fabricator(:account_note) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
target_account { Fabricate(:account) }
|
target_account { Fabricate.build(:account) }
|
||||||
comment 'User note text'
|
comment 'User note text'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:account_stat) do
|
Fabricator(:account_stat) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
statuses_count '123'
|
statuses_count '123'
|
||||||
following_count '456'
|
following_count '456'
|
||||||
followers_count '789'
|
followers_count '789'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:account_statuses_cleanup_policy) do
|
Fabricator(:account_statuses_cleanup_policy) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:account_warning) do
|
Fabricator(:account_warning) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
target_account(fabricator: :account)
|
target_account(fabricator: :account)
|
||||||
text { Faker::Lorem.paragraph }
|
text { Faker::Lorem.paragraph }
|
||||||
action 'suspend'
|
action 'suspend'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator('Admin::ActionLog') do
|
Fabricator('Admin::ActionLog') do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
action 'MyString'
|
action 'MyString'
|
||||||
target nil
|
target nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:backup) do
|
Fabricator(:backup) do
|
||||||
user
|
user { Fabricate.build(:user) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:block) do
|
Fabricator(:block) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
target_account { Fabricate(:account) }
|
target_account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:bookmark) do
|
Fabricator(:bookmark) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
status
|
status { Fabricate.build(:status) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,5 +8,5 @@ Fabricator(:bulk_import) do
|
||||||
imported_items 1
|
imported_items 1
|
||||||
finished_at '2022-11-18 14:55:07'
|
finished_at '2022-11-18 14:55:07'
|
||||||
overwrite false
|
overwrite false
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:bulk_import_row) do
|
Fabricator(:bulk_import_row) do
|
||||||
bulk_import
|
bulk_import { Fabricate.build(:bulk_import) }
|
||||||
data ''
|
data ''
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
Fabricator(:canonical_email_block) do
|
Fabricator(:canonical_email_block) do
|
||||||
email { sequence(:email) { |i| "#{i}#{Faker::Internet.email}" } }
|
email { sequence(:email) { |i| "#{i}#{Faker::Internet.email}" } }
|
||||||
reference_account { Fabricate(:account) }
|
reference_account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:custom_filter) do
|
Fabricator(:custom_filter) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
expires_at nil
|
expires_at nil
|
||||||
phrase 'discourse'
|
phrase 'discourse'
|
||||||
context %w(home notifications)
|
context %w(home notifications)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:custom_filter_keyword) do
|
Fabricator(:custom_filter_keyword) do
|
||||||
custom_filter
|
custom_filter { Fabricate.build(:custom_filter) }
|
||||||
keyword 'discourse'
|
keyword 'discourse'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:custom_filter_status) do
|
Fabricator(:custom_filter_status) do
|
||||||
custom_filter
|
custom_filter { Fabricate.build(:custom_filter) }
|
||||||
status
|
status { Fabricate.build(:status) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:device) do
|
Fabricator(:device) do
|
||||||
access_token
|
access_token { Fabricate.build(:access_token) }
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
device_id { Faker::Number.number(digits: 5) }
|
device_id { Faker::Number.number(digits: 5) }
|
||||||
name { Faker::App.name }
|
name { Faker::App.name }
|
||||||
fingerprint_key { Base64.strict_encode64(Ed25519::SigningKey.generate.verify_key.to_bytes) }
|
fingerprint_key { Base64.strict_encode64(Ed25519::SigningKey.generate.verify_key.to_bytes) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:encrypted_message) do
|
Fabricator(:encrypted_message) do
|
||||||
device
|
device { Fabricate.build(:device) }
|
||||||
from_account { Fabricate(:account) }
|
from_account { Fabricate.build(:account) }
|
||||||
from_device_id { Faker::Number.number(digits: 5) }
|
from_device_id { Faker::Number.number(digits: 5) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:favourite) do
|
Fabricator(:favourite) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
status
|
status { Fabricate.build(:status) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:featured_tag) do
|
Fabricator(:featured_tag) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
tag
|
tag { Fabricate.build(:tag) }
|
||||||
name { sequence(:name) { |i| "Tag#{i}" } }
|
name { sequence(:name) { |i| "Tag#{i}" } }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:follow) do
|
Fabricator(:follow) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
target_account { Fabricate(:account) }
|
target_account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:follow_request) do
|
Fabricator(:follow_request) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
target_account { Fabricate(:account, locked: true) }
|
target_account { Fabricate.build(:account, locked: true) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:identity) do
|
Fabricator(:identity) do
|
||||||
user
|
user { Fabricate.build(:user) }
|
||||||
provider 'MyString'
|
provider 'MyString'
|
||||||
uid 'MyString'
|
uid 'MyString'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:invite) do
|
Fabricator(:invite) do
|
||||||
user
|
user { Fabricate.build(:user) }
|
||||||
expires_at nil
|
expires_at nil
|
||||||
max_uses nil
|
max_uses nil
|
||||||
uses 0
|
uses 0
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:list) do
|
Fabricator(:list) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
title 'MyString'
|
title 'MyString'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:login_activity) do
|
Fabricator(:login_activity) do
|
||||||
user
|
user { Fabricate.build(:user) }
|
||||||
authentication_method 'password'
|
authentication_method 'password'
|
||||||
success true
|
success true
|
||||||
failure_reason nil
|
failure_reason nil
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:marker) do
|
Fabricator(:marker) do
|
||||||
user
|
user { Fabricate.build(:user) }
|
||||||
timeline 'home'
|
timeline 'home'
|
||||||
last_read_id 0
|
last_read_id 0
|
||||||
lock_version 0
|
lock_version 0
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:media_attachment) do
|
Fabricator(:media_attachment) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
|
|
||||||
file do |attrs|
|
file do |attrs|
|
||||||
case attrs[:type]
|
case attrs[:type]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:mention) do
|
Fabricator(:mention) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
status
|
status { Fabricate.build(:status) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:mute) do
|
Fabricator(:mute) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
target_account { Fabricate(:account) }
|
target_account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
Fabricator(:notification) do
|
Fabricator(:notification) do
|
||||||
activity fabricator: :status
|
activity fabricator: :status
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:one_time_key) do
|
Fabricator(:one_time_key) do
|
||||||
device
|
device { Fabricate.build(:device) }
|
||||||
key_id { Faker::Alphanumeric.alphanumeric(number: 10) }
|
key_id { Faker::Alphanumeric.alphanumeric(number: 10) }
|
||||||
key { Base64.strict_encode64(Ed25519::SigningKey.generate.verify_key.to_bytes) }
|
key { Base64.strict_encode64(Ed25519::SigningKey.generate.verify_key.to_bytes) }
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:poll) do
|
Fabricator(:poll) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
status
|
status { Fabricate.build(:status) }
|
||||||
expires_at { 7.days.from_now }
|
expires_at { 7.days.from_now }
|
||||||
options %w(Foo Bar)
|
options %w(Foo Bar)
|
||||||
multiple false
|
multiple false
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:poll_vote) do
|
Fabricator(:poll_vote) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
poll
|
poll
|
||||||
choice 0
|
choice 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:report) do
|
Fabricator(:report) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
target_account { Fabricate(:account) }
|
target_account { Fabricate.build(:account) }
|
||||||
comment 'You nasty'
|
comment 'You nasty'
|
||||||
action_taken_at nil
|
action_taken_at nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:report_note) do
|
Fabricator(:report_note) do
|
||||||
report
|
report { Fabricate.build(:report) }
|
||||||
account { Fabricate(:account) }
|
account { Fabricate.build(:account) }
|
||||||
content 'Test Content'
|
content 'Test Content'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:scheduled_status) do
|
Fabricator(:scheduled_status) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
scheduled_at { 20.hours.from_now }
|
scheduled_at { 20.hours.from_now }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:session_activation) do
|
Fabricator(:session_activation) do
|
||||||
user
|
user { Fabricate.build(:user) }
|
||||||
session_id 'MyString'
|
session_id 'MyString'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:status) do
|
Fabricator(:status) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
text 'Lorem ipsum dolor sit amet'
|
text 'Lorem ipsum dolor sit amet'
|
||||||
|
|
||||||
after_build do |status|
|
after_build do |status|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:status_pin) do
|
Fabricator(:status_pin) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
status { |attrs| Fabricate(:status, account: attrs[:account], visibility: :public) }
|
status { |attrs| Fabricate.build(:status, account: attrs[:account], visibility: :public) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
Fabricator(:tag_follow) do
|
Fabricator(:tag_follow) do
|
||||||
tag
|
tag
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue