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