1 # frozen_string_literal: true
3 require "application_system_test_case"
5 class ProfileLinksChangeTest < ApplicationSystemTestCase
6 test "can't change description when unauthorized" do
11 within_content_body do
12 assert_no_link "Edit Description"
16 test "can't change description of another user" do
18 another_user = create(:user)
21 visit user_path(another_user)
23 within_content_body do
24 assert_no_link "Edit Description"
28 test "can change description" do
30 check_description_change(user)
33 test "can change description when have a description" do
34 user = create(:user, :description => "My old profile description")
35 check_description_change(user)
38 test "can change description when have a link" do
40 create(:social_link, :user => user)
41 check_description_change(user)
44 test "can change description when have a description and a link" do
45 user = create(:user, :description => "My old profile description")
46 create(:social_link, :user => user)
47 check_description_change(user)
52 def check_description_change(user)
56 within_content_body do
57 click_on "Edit Description"
58 fill_in "Profile Description", :with => "This is my updated OSM profile!"
59 click_on "Update Profile"
62 assert_text "Profile description updated."
64 within_content_body do
65 assert_text "This is my updated OSM profile!"