1 require "application_system_test_case"
3 class ProfileLocationChangeTest < ApplicationSystemTestCase
4 test "can't change location when unauthorized" do
9 within_content_heading do
10 assert_no_button "Edit Profile Details"
11 assert_no_link "Edit Location"
15 test "can't change location of another user" do
17 another_user = create(:user)
20 visit user_path(another_user)
22 within_content_heading do
23 assert_no_button "Edit Profile Details"
24 assert_no_link "Edit Location"
28 test "can change location" do
34 within_content_body do
35 click_on "Edit Profile Details"
36 click_on "Edit Location"
37 fill_in "Home Location Name", :with => "Test Place"
38 click_on "Update Profile"
41 assert_text "Profile location updated."
43 within_content_body do
44 assert_text :all, "Home location Test Place"
46 click_on "Edit Profile Details"
47 click_on "Edit Location"
48 fill_in "Home Location Name", :with => "New Test Place"
49 click_on "Update Profile"
52 assert_text "Profile location updated."
54 within_content_body do
55 assert_text :all, "Home location New Test Place"