openstreetmap-website/test/controllers/dashboards_controller_test.rb
Andy Allan cb7b79a58f Split the non-public information off of the profile page
This opens up many possibilities for more interesting things to be
shown on the dashboard, as well as making it easier to find if
you have lots of content in your profile.
2021-08-18 13:32:36 +01:00

34 lines
903 B
Ruby

require "test_helper"
class DashboardsControllerTest < ActionDispatch::IntegrationTest
##
# test all routes which lead to this controller
def test_routes
assert_routing(
{ :path => "/dashboard", :method => :get },
{ :controller => "dashboards", :action => "show" }
)
end
def test_show_no_friends
user = create(:user)
session_for(user)
get dashboard_path
end
def test_show_with_friends
user = create(:user, :home_lon => 1.1, :home_lat => 1.1)
friend_user = create(:user, :home_lon => 1.2, :home_lat => 1.2)
create(:friendship, :befriender => user, :befriendee => friend_user)
create(:changeset, :user => friend_user)
session_for(user)
get dashboard_path
# Friends should be visible as we're now logged in
assert_select "div#friends-container" do
assert_select "div.contact-activity", :count => 1
end
end
end