]> git.openstreetmap.org Git - rails.git/blob - test/system/profile_location_change_test.rb
Fix eslint warning
[rails.git] / test / system / profile_location_change_test.rb
1 require "application_system_test_case"
2
3 class ProfileLocationChangeTest < ApplicationSystemTestCase
4   test "can't change location when unauthorized" do
5     user = create(:user)
6
7     visit user_path(user)
8
9     within_content_heading do
10       assert_no_button "Edit Profile Details"
11       assert_no_link "Edit Location"
12     end
13   end
14
15   test "can't change location of another user" do
16     user = create(:user)
17     another_user = create(:user)
18
19     sign_in_as(user)
20     visit user_path(another_user)
21
22     within_content_heading do
23       assert_no_button "Edit Profile Details"
24       assert_no_link "Edit Location"
25     end
26   end
27
28   test "can change location" do
29     user = create(:user)
30
31     sign_in_as(user)
32     visit user_path(user)
33
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"
39     end
40
41     assert_text "Profile location updated."
42
43     within_content_body do
44       assert_text :all, "Home location Test Place"
45
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"
50     end
51
52     assert_text "Profile location updated."
53
54     within_content_body do
55       assert_text :all, "Home location New Test Place"
56     end
57   end
58 end