account_fabricator.rb 668 B

123456789101112131415
  1. keypair = OpenSSL::PKey::RSA.new(2048)
  2. public_key = keypair.public_key.to_pem
  3. private_key = keypair.to_pem
  4. Fabricator(:account) do
  5. transient :suspended, :silenced
  6. username { sequence(:username) { |i| "#{Faker::Internet.user_name(separators: %w(_))}#{i}" } }
  7. last_webfingered_at { Time.now.utc }
  8. public_key { public_key }
  9. private_key { private_key }
  10. suspended_at { |attrs| attrs[:suspended] ? Time.now.utc : nil }
  11. silenced_at { |attrs| attrs[:silenced] ? Time.now.utc : nil }
  12. user { |attrs| attrs[:domain].nil? ? Fabricate.build(:user, account: nil) : nil }
  13. discoverable true
  14. end