From 64622c39afd61edd3f53050b055011428c97021f Mon Sep 17 00:00:00 2001 From: Moises Machado Date: Mon, 27 Jul 2009 20:09:05 -0300 Subject: [PATCH] ActionItem1127: search by prefix instead of full word --- app/controllers/my_profile/profile_members_controller.rb | 2 +- test/functional/profile_members_controller_test.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/controllers/my_profile/profile_members_controller.rb b/app/controllers/my_profile/profile_members_controller.rb index cad2cac..0c35a99 100644 --- a/app/controllers/my_profile/profile_members_controller.rb +++ b/app/controllers/my_profile/profile_members_controller.rb @@ -76,7 +76,7 @@ class ProfileMembersController < MyProfileController end def find_users - @users_found = Person.find_by_contents(params[:query]) + @users_found = Person.find_by_contents(params[:query] + '*') render :layout => false end diff --git a/test/functional/profile_members_controller_test.rb b/test/functional/profile_members_controller_test.rb index 933b3b7..b937386 100644 --- a/test/functional/profile_members_controller_test.rb +++ b/test/functional/profile_members_controller_test.rb @@ -239,4 +239,18 @@ class ProfileMembersControllerTest < Test::Unit::TestCase assert_tag :tag => 'tr', :attributes => {:id => 'tr-test_user', :style => 'display:none'} end + should 'return users with as a prefix' do + daniel = create_user('daniel').person + daniela = create_user('daniela').person + + ent = Enterprise.create!(:name => 'Test Ent', :identifier => 'test_ent') + p = create_user_with_permission('test_user', 'manage_memberships', ent) + login_as :test_user + + get :find_users, :profile => ent.identifier, :query => 'daniel' + + assert_includes assigns(:users_found), daniel + assert_includes assigns(:users_found), daniela + end + end -- libgit2 0.21.2