Commit 8470293887b42804d572dcffc5ee02af1a0d2ff6
1 parent
844304db
Exists in
master
and in
29 other branches
User can search friends for invitation using usp number
Showing
2 changed files
with
16 additions
and
0 deletions
Show diff stats
plugins/stoa/lib/stoa_plugin.rb
@@ -124,4 +124,8 @@ class StoaPlugin < Noosfero::Plugin | @@ -124,4 +124,8 @@ class StoaPlugin < Noosfero::Plugin | ||
124 | {:field => :usp_id, :name => _('USP Number'), :model => 'person'} | 124 | {:field => :usp_id, :name => _('USP Number'), :model => 'person'} |
125 | end | 125 | end |
126 | 126 | ||
127 | + def search_friend_fields | ||
128 | + [{:field => :usp_id, :name => _('USP Number')}] | ||
129 | + end | ||
130 | + | ||
127 | end | 131 | end |
plugins/stoa/test/functional/invite_controller_test.rb
@@ -48,5 +48,17 @@ class InviteControllerTest < ActionController::TestCase | @@ -48,5 +48,17 @@ class InviteControllerTest < ActionController::TestCase | ||
48 | assert_response 200 | 48 | assert_response 200 |
49 | end | 49 | end |
50 | 50 | ||
51 | + should 'search friends profiles by usp_id' do | ||
52 | + person1 = User.create!(:login => 'john', :email => 'john@example.com', :password => 'test', :password_confirmation => 'test', :person_data => {:usp_id => 12345678}).person | ||
53 | + User.create!(:login => 'mary', :email => 'mary@example.com', :password => 'test', :password_confirmation => 'test', :person_data => {:usp_id => 11111111}).person | ||
54 | + organization = fast_create(Organization) | ||
55 | + organization.add_admin(person1) | ||
56 | + | ||
57 | + login_as(person1.identifier) | ||
58 | + get :search_friend, :profile => organization.identifier, :q => '1234' | ||
59 | + | ||
60 | + assert_equal [{"name" => person1.name, "id" => person1.id}].to_json, @response.body | ||
61 | + assert_response 200 | ||
62 | + end | ||
51 | end | 63 | end |
52 | 64 |