Skip to content
Extraits de code Groupes Projets
Non vérifiée Valider 9f28b935 rédigé par Steffen van Bergerem's avatar Steffen van Bergerem
Parcourir les fichiers

Drop contacts.json

parent f1e9c998
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -13,13 +13,6 @@ class ContactsController < ApplicationController
# Used by the mobile site
format.mobile { set_up_contacts_mobile }
# Used to populate mentions in the publisher
format.json {
aspect_ids = params[:aspect_ids] || current_user.aspects.map(&:id)
@people = Person.all_from_aspects(aspect_ids, current_user).for_json
render :json => @people.to_json
}
end
end
......
......@@ -48,28 +48,6 @@ describe ContactsController, :type => :controller do
expect(contacts.to_set).to eq(bob.contacts.to_set)
end
end
context 'format json' do
it 'assumes all aspects if none are specified' do
get :index, :format => 'json'
expect(assigns[:people].map(&:id)).to match_array(bob.contacts.map { |c| c.person.id })
expect(response).to be_success
end
it 'returns the contacts for multiple aspects' do
get :index, :aspect_ids => bob.aspect_ids, :format => 'json'
expect(assigns[:people].map(&:id)).to match_array(bob.contacts.map { |c| c.person.id })
expect(response).to be_success
end
it 'does not return duplicate contacts' do
aspect = bob.aspects.create(:name => 'hilarious people')
aspect.contacts << bob.contact_for(eve.person)
get :index, :format => 'json', :aspect_ids => bob.aspect_ids
expect(assigns[:people].map { |p| p.id }.uniq).to eq(assigns[:people].map { |p| p.id })
expect(assigns[:people].map(&:id)).to match_array(bob.contacts.map { |c| c.person.id })
end
end
end
describe "#search" do
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter