profile_stories.rb 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # frozen_string_literal: true
  2. module ProfileStories
  3. attr_reader :bob, :alice, :alice_bio
  4. def as_a_registered_user
  5. @bob = Fabricate(
  6. :user,
  7. email: email, password: password, confirmed_at: confirmed_at,
  8. account: Fabricate(:account, username: 'bob')
  9. )
  10. end
  11. def as_a_logged_in_user
  12. as_a_registered_user
  13. visit new_user_session_path
  14. fill_in 'user_email', with: email
  15. fill_in 'user_password', with: password
  16. click_on I18n.t('auth.login')
  17. end
  18. def with_alice_as_local_user
  19. @alice_bio = '@alice and @bob are fictional characters commonly used as'\
  20. 'placeholder names in #cryptology, as well as #science and'\
  21. 'engineering 📖 literature. Not affilated with @pepe.'
  22. @alice = Fabricate(
  23. :user,
  24. email: 'alice@example.com', password: password, confirmed_at: confirmed_at,
  25. account: Fabricate(:account, username: 'alice', note: @alice_bio)
  26. )
  27. end
  28. def confirmed_at
  29. @confirmed_at ||= Time.zone.now
  30. end
  31. def email
  32. @email ||= 'test@example.com'
  33. end
  34. def password
  35. @password ||= 'password'
  36. end
  37. end