account_fabricator.rb 542 B

12345678910111213
  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. end