mirror of https://github.com/mastodon/mastodon
Fabricator specs (#23925)
parent
c40d5e5a8f
commit
cd99fa8ceb
@ -1,7 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
Fabricator(:account_alias) do
|
|
||||||
account
|
|
||||||
acct 'test@example.com'
|
|
||||||
uri 'https://example.com/users/test'
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
Fabricator(:account_deletion_request) do
|
|
||||||
account
|
|
||||||
end
|
|
@ -1,6 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:account_pin) do
|
Fabricator(:account_pin) do
|
||||||
account nil
|
account
|
||||||
target_account nil
|
target_account(fabricator: :account)
|
||||||
|
before_create { |account_pin, _| account_pin.account.follow!(account_pin.target_account) }
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:account_stat) do
|
Fabricator(:account_stat) do
|
||||||
account nil
|
account
|
||||||
statuses_count ''
|
statuses_count '123'
|
||||||
following_count ''
|
following_count '456'
|
||||||
followers_count ''
|
followers_count '789'
|
||||||
end
|
end
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
Fabricator(:account_tag_stat) do
|
|
||||||
accounts_count ''
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
Fabricator(:account_warning_preset) do
|
|
||||||
text 'MyText'
|
|
||||||
end
|
|
@ -1,7 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator('Admin::ActionLog') do
|
Fabricator('Admin::ActionLog') do
|
||||||
account nil
|
account
|
||||||
action 'MyString'
|
action 'MyString'
|
||||||
target nil
|
target nil
|
||||||
end
|
end
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
Fabricator(:announcement_mute) do
|
|
||||||
account
|
|
||||||
announcement
|
|
||||||
end
|
|
@ -1,7 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
Fabricator(:announcement_reaction) do
|
|
||||||
account
|
|
||||||
announcement
|
|
||||||
name '🌿'
|
|
||||||
end
|
|
@ -1,8 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
Fabricator(:conversation_account) do
|
|
||||||
account nil
|
|
||||||
conversation nil
|
|
||||||
participant_account_ids ''
|
|
||||||
last_status nil
|
|
||||||
end
|
|
@ -1,4 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
Fabricator(:conversation_mute) do
|
|
||||||
end
|
|
@ -1,5 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
Fabricator(:custom_emoji_category) do
|
|
||||||
name 'MyString'
|
|
||||||
end
|
|
@ -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
|
|
@ -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
|
|
@ -1,5 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
Fabricator(:follow_recommendation_suppression) do
|
|
||||||
account
|
|
||||||
end
|
|
@ -1,7 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:identity) do
|
Fabricator(:identity) do
|
||||||
user nil
|
user
|
||||||
provider 'MyString'
|
provider 'MyString'
|
||||||
uid 'MyString'
|
uid 'MyString'
|
||||||
end
|
end
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
Fabricator(:import) do
|
|
||||||
end
|
|
@ -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
|
|
@ -1,7 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
Fabricator(:list_account) do
|
|
||||||
list nil
|
|
||||||
account nil
|
|
||||||
follow nil
|
|
||||||
end
|
|
@ -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
|
|
@ -1,4 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:setting) do
|
Fabricator(:setting) do
|
||||||
|
var 'var'
|
||||||
end
|
end
|
||||||
|
@ -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
|
|
@ -1,8 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
Fabricator(:status_stat) do
|
|
||||||
status_id nil
|
|
||||||
replies_count ''
|
|
||||||
reblogs_count ''
|
|
||||||
favourites_count ''
|
|
||||||
end
|
|
@ -1,5 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:unavailable_domain) do
|
Fabricator(:unavailable_domain) do
|
||||||
domain { Faker::Internet.domain }
|
domain { Faker::Internet.domain_name }
|
||||||
end
|
end
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
Fabricator(:user_invite_request) do
|
|
||||||
user
|
|
||||||
text { Faker::Lorem.sentence }
|
|
||||||
end
|
|
@ -1,4 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
Fabricator(:web_setting, from: Web::Setting) do
|
|
||||||
end
|
|
@ -0,0 +1,12 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
Fabrication.manager.load_definitions if Fabrication.manager.empty?
|
||||||
|
|
||||||
|
Fabrication.manager.schematics.map(&:first).each do |factory_name|
|
||||||
|
describe "The #{factory_name} factory" do
|
||||||
|
it 'is valid' do
|
||||||
|
factory = Fabricate(factory_name)
|
||||||
|
expect(factory).to be_valid
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue