diff options
author | Bèr Kessels <ber@berk.es> | 2020-01-03 02:44:06 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2020-01-03 02:44:06 +0100 |
commit | 6c1ba513ee00443cba684adfe41f62567bd6bb21 (patch) | |
tree | 36012699b2c36b33292dfa81ad20947563e8ae86 /spec/support | |
parent | 9cbbc50fcdfe2ec852107b1757d92d54b862a91a (diff) |
Add feature test that tests behaviour of profile name and bio (#12658)
* Add feature test that tests behaviour of profile name and bio * Fix rubocop style errors in Login Spec. * DRY log_in_spec by reusing the stories helper Co-authored-by: Eugen Rochko <eugen@zeonfederated.com>
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/stories/profile_stories.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/support/stories/profile_stories.rb b/spec/support/stories/profile_stories.rb new file mode 100644 index 000000000..75b413330 --- /dev/null +++ b/spec/support/stories/profile_stories.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +module ProfileStories + attr_reader :bob, :alice, :alice_bio + + def as_a_registered_user + @bob = Fabricate( + :user, + email: email, password: password, confirmed_at: confirmed_at, + account: Fabricate(:account, username: 'bob') + ) + end + + def as_a_logged_in_user + as_a_registered_user + visit new_user_session_path + fill_in 'user_email', with: email + fill_in 'user_password', with: password + click_on I18n.t('auth.login') + end + + def with_alice_as_local_user + @alice_bio = '@alice and @bob are fictional characters commonly used as'\ + 'placeholder names in #cryptology, as well as #science and'\ + 'engineering 📖 literature. Not affilated with @pepe.' + + @alice = Fabricate( + :user, + email: 'alice@example.com', password: password, confirmed_at: confirmed_at, + account: Fabricate(:account, username: 'alice', note: @alice_bio) + ) + end + + def confirmed_at + @confirmed_at ||= Time.zone.now + end + + def email + @email ||= 'test@example.com' + end + + def password + @password ||= 'password' + end +end |