]> git.openstreetmap.org Git - rails.git/blob - test/controllers/dashboards_controller_test.rb
Bump osm-community-index from 5.6.2 to 5.6.3
[rails.git] / test / controllers / dashboards_controller_test.rb
1 require "test_helper"
2
3 class DashboardsControllerTest < ActionDispatch::IntegrationTest
4   ##
5   # test all routes which lead to this controller
6   def test_routes
7     assert_routing(
8       { :path => "/dashboard", :method => :get },
9       { :controller => "dashboards", :action => "show" }
10     )
11   end
12
13   def test_show_no_friends
14     user = create(:user)
15     session_for(user)
16
17     get dashboard_path
18   end
19
20   def test_show_with_friends
21     user = create(:user, :home_lon => 1.1, :home_lat => 1.1)
22     friend_user = create(:user, :home_lon => 1.2, :home_lat => 1.2)
23     create(:friendship, :befriender => user, :befriendee => friend_user)
24     create(:changeset, :user => friend_user)
25     session_for(user)
26
27     get dashboard_path
28
29     # Friends should be visible as we're now logged in
30     assert_select "div#friends-container" do
31       assert_select "div" do
32         assert_select "a[href='/user/#{ERB::Util.u(friend_user.display_name)}']", :count => 1
33       end
34     end
35   end
36 end