1 # frozen_string_literal: true
 
   3 require "application_system_test_case"
 
   5 class ProfileLocationChangeTest < ApplicationSystemTestCase
 
   6   test "can't change location when unauthorized" do
 
  11     within_content_heading do
 
  12       assert_no_button "Edit Profile Details"
 
  13       assert_no_link "Edit Location"
 
  17   test "can't change location of another user" do
 
  19     another_user = create(:user)
 
  22     visit user_path(another_user)
 
  24     within_content_heading do
 
  25       assert_no_button "Edit Profile Details"
 
  26       assert_no_link "Edit Location"
 
  30   test "can change location" do
 
  36     within_content_body do
 
  37       click_on "Edit Profile Details"
 
  38       click_on "Edit Location"
 
  39       fill_in "Home Location Name", :with => "Test Place"
 
  40       click_on "Update Profile"
 
  43     assert_text "Profile location updated."
 
  45     within_content_body do
 
  46       assert_text :all, "Home location Test Place"
 
  48       click_on "Edit Profile Details"
 
  49       click_on "Edit Location"
 
  50       fill_in "Home Location Name", :with => "New Test Place"
 
  51       click_on "Update Profile"
 
  54     assert_text "Profile location updated."
 
  56     within_content_body do
 
  57       assert_text :all, "Home location New Test Place"