From: Tom Hughes Date: Wed, 12 Sep 2018 16:57:09 +0000 (+0100) Subject: Test that friends are shown correctly on the user profile X-Git-Tag: live~3457 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/b4d90ec7f4de168a332959f52965d632bedb96aa Test that friends are shown correctly on the user profile Fixes #1992 --- diff --git a/test/controllers/user_controller_test.rb b/test/controllers/user_controller_test.rb index 42bc1ac3f..ffae32d0c 100644 --- a/test/controllers/user_controller_test.rb +++ b/test/controllers/user_controller_test.rb @@ -942,6 +942,7 @@ class UserControllerTest < ActionController::TestCase # Test a normal user user = create(:user) + create(:friend, :befriender => user) get :show, :params => { :display_name => user.display_name } assert_response :success assert_select "div#userinformation" do @@ -955,6 +956,9 @@ class UserControllerTest < ActionController::TestCase assert_select "a[href='/blocks/new/#{ERB::Util.u(user.display_name)}']", 0 end + # Friends shouldn't be visible as we're not logged in + assert_select "div#friends-container", :count => 0 + # Test a user who has been blocked blocked_user = create(:user) create(:user_block, :user => blocked_user) @@ -1004,6 +1008,11 @@ class UserControllerTest < ActionController::TestCase assert_select "a[href='/blocks/new/#{ERB::Util.u(user.display_name)}']", 0 end + # Friends should be visible as we're now logged in + assert_select "div#friends-container" do + assert_select "div.contact-activity", :count => 1 + end + # Login as a moderator session[:user] = create(:moderator_user).id