]> git.openstreetmap.org Git - rails.git/blob - test/system/account_home_test.rb
Add frozen_string_literal comments to ruby files
[rails.git] / test / system / account_home_test.rb
1 # frozen_string_literal: true
2
3 require "application_system_test_case"
4
5 class AccountHomeTest < ApplicationSystemTestCase
6   test "Go to Home Location works on map layout pages" do
7     user = create(:user, :display_name => "test user", :home_lat => 60, :home_lon => 30)
8     sign_in_as(user)
9
10     visit root_path
11     assert_no_selector ".leaflet-marker-icon"
12
13     click_on "test user"
14     click_on "Go to Home Location"
15     all ".leaflet-marker-icon", :count => 1 do |marker|
16       assert_equal "My home location", marker["title"]
17     end
18
19     click_on "OpenStreetMap logo"
20     assert_no_selector ".leaflet-marker-icon"
21   end
22
23   test "Go to Home Location works on non-map layout pages" do
24     user = create(:user, :display_name => "test user", :home_lat => 60, :home_lon => 30)
25     sign_in_as(user)
26
27     visit about_path
28     assert_no_selector ".leaflet-marker-icon"
29
30     click_on "test user"
31     click_on "Go to Home Location"
32     all ".leaflet-marker-icon", :count => 1 do |marker|
33       assert_equal "My home location", marker["title"]
34     end
35
36     click_on "OpenStreetMap logo"
37     assert_no_selector ".leaflet-marker-icon"
38   end
39
40   test "Go to Home Location is not available for users without home location" do
41     user = create(:user, :display_name => "test user")
42     sign_in_as(user)
43
44     visit root_path
45     assert_no_selector ".leaflet-marker-icon"
46
47     click_on "test user"
48     assert_no_link "Go to Home Location"
49   end
50
51   test "account home page shows a warning when visited by users without home location" do
52     user = create(:user, :display_name => "test user")
53     sign_in_as(user)
54
55     visit account_home_path
56     assert_no_selector ".leaflet-marker-icon"
57     assert_text "Home location is not set"
58   end
59 end