From 0595bfe6ea1d1753cb4155a1ca4526635ccd664f Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Thu, 4 Aug 2016 16:05:11 -0300 Subject: [PATCH] Limit task list in profile editor --- app/views/profile_editor/_pending_tasks.html.erb | 4 ++-- test/functional/profile_editor_controller_test.rb | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app/views/profile_editor/_pending_tasks.html.erb b/app/views/profile_editor/_pending_tasks.html.erb index cd3ed15..a7fc968 100644 --- a/app/views/profile_editor/_pending_tasks.html.erb +++ b/app/views/profile_editor/_pending_tasks.html.erb @@ -2,9 +2,9 @@ <% unless @pending_tasks.empty? %>
-

<%= _('You have pending requests') %>

+

<%= _('You have %s pending requests' % @pending_tasks.count) %>

<%= button(:todo, _('Process requests'), :controller => 'tasks', :action => 'index') %>
diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index ae7cd54..000d132 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -408,6 +408,24 @@ class ProfileEditorControllerTest < ActionController::TestCase assert_no_tag :tag => 'div', :attributes => { :class => 'pending-tasks' } end + should 'limit task list' do + user2 = create_user('usertwo').person + 6.times { AddFriend.create!(:person => create_user.person, :friend => user2) } + login_as('usertwo') + get :index, :profile => 'usertwo' + assert_select '.pending-tasks > ul > li', 5 + end + + should 'display task count in task list' do + user2 = create_user('usertwo').person + 6.times { AddFriend.create!(:person => create_user.person, :friend => user2) } + login_as('usertwo') + get :index, :profile => 'usertwo' + assert_select '.pending-tasks h2' do |elements| + assert_match /6/, elements.first.content + end + end + should 'show favorite enterprises button for person' do get :index, :profile => profile.identifier assert_tag :tag => 'a', :content => 'Favorite Enterprises' -- libgit2 0.21.2