Commit 78293fab0e4cd406d08559a1ea54f99ed584d989

Authored by Larissa Reis
1 parent db283e29

invite-members: fixes test in stoa plugin

 The user searched shouldn't be a member of the community already,
 because those are filtered out.
plugins/stoa/test/functional/invite_controller_test.rb
@@ -49,15 +49,17 @@ class InviteControllerTest < ActionController::TestCase @@ -49,15 +49,17 @@ class InviteControllerTest < ActionController::TestCase
49 end 49 end
50 50
51 should 'search friends profiles by usp_id' do 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 52 + person = User.create!(:login => 'john', :email => 'john@example.com', :password => 'test', :password_confirmation => 'test', :person_data => {:usp_id => 12345678}).person
  53 + User.create!(:login => 'joseph', :email => 'joseph@example.com', :password => 'test', :password_confirmation => 'test', :person_data => {:usp_id => 12333333})
  54 +
  55 + admin = User.create!(:login => 'mary', :email => 'mary@example.com', :password => 'test', :password_confirmation => 'test', :person_data => {:usp_id => 11111111}).person
54 organization = fast_create(Organization) 56 organization = fast_create(Organization)
55 - organization.add_admin(person1) 57 + organization.add_admin(admin)
56 58
57 - login_as(person1.identifier) 59 + login_as(admin.identifier)
58 get :search_friend, :profile => organization.identifier, :q => '1234' 60 get :search_friend, :profile => organization.identifier, :q => '1234'
59 61
60 - assert_equal [{"name" => person1.name, "id" => person1.id}].to_json, @response.body 62 + assert_equal [{"id" => person.id, "name" => person.name}].to_json, @response.body
61 assert_response 200 63 assert_response 200
62 end 64 end
63 end 65 end