mirror of https://github.com/mastodon/mastodon
Use `build` where possible in fabricators (#25360)
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
|
||||||
|
@ -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,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('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
|
||||||
|
@ -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
|
||||||
|
@ -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,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,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,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
|
||||||
|
@ -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,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
|
||||||
|
Loading…
Reference in New Issue