Mirror of Github Repo. https://github.com/flockingbird/roost
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

member_tags_member_test.rb 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # frozen_string_literal: true
  2. require 'test_helper'
  3. ##
  4. # As a member using the web-app
  5. # When I visit another members' profile
  6. # And I click the "add tag" button
  7. # And I fill provide a tag
  8. # Then the tag is added to that profile
  9. # And I follow the member
  10. class MemberTagsMemberTest < Minitest::WebSpec
  11. before do
  12. harry
  13. ron
  14. as(harry)
  15. discover_member(username: ron[:username]).upto(:profile_visited)
  16. tags_member.upto(:tag_added)
  17. end
  18. it 'adds a tag to another profile' do
  19. assert_content(flash(:success), '@ron@example.com was tagged as "friend"')
  20. discover_member(username: ron[:username]).upto(:profile_visited)
  21. assert_selector('.tag.mine', text: 'friend')
  22. end
  23. it 'shows tags from other members styled different' do
  24. as(hermoine)
  25. discover_member(username: ron[:username]).upto(:profile_visited)
  26. assert_selector('.tag', text: 'friend')
  27. refute_selector('.tag.mine')
  28. end
  29. # TODO: for accountability, we need to show the tag.authors in a neat
  30. # and friendly hover dialog.
  31. # Then we can test that a member who tags multiple times, only appears once
  32. # in the authors. One tag "friend" per author, so to say.
  33. it 'profile can be tagged multiple times with one tag' do
  34. as(hermoine)
  35. discover_member(username: ron[:username]).upto(:profile_visited)
  36. tags_member.upto(:tag_added)
  37. # Tags shows up as "mine" but it still appears only once: hpotter and mine
  38. # are merged. One .tag is used for the "add" button, making total 2.
  39. assert_selector('.tag.mine', text: 'friend')
  40. assert_equal(find_all('.tag').length, 2)
  41. end
  42. it 'follows the tagged member' do
  43. # Determine that harry follows ron by checking the notification sent to
  44. # ron. TODO: Change to check with my followings once we have that overview
  45. as(ron)
  46. main_menu('Updates').click
  47. assert_content '@hpotter@example.com started following you'
  48. end
  49. end