Update _person and person show, add specs for those pages
This commit is contained in:
parent
a39bd2badb
commit
8232a92ca0
3 changed files with 57 additions and 23 deletions
|
|
@ -18,10 +18,10 @@
|
||||||
- elsif current_user.pending_requests.find_by_person_id(person.id)
|
- elsif current_user.pending_requests.find_by_person_id(person.id)
|
||||||
= link_to =t('.pending_request'), aspects_manage_path
|
= link_to =t('.pending_request'), aspects_manage_path
|
||||||
- else
|
- else
|
||||||
= form_for Request.new do |f|
|
= form_tag(requests_path) do
|
||||||
= f.select(:into_id, @aspects_dropdown_array)
|
= select_tag(:aspect_id, @aspects_dropdown_array.join.html_safe)
|
||||||
= f.hidden_field :destination_url, :value => person.diaspora_handle
|
= hidden_field_tag :destination_handle, :value => person.diaspora_handle
|
||||||
= f.submit t('.add_friend')
|
= submit_tag t('.add_friend')
|
||||||
|
|
||||||
.info
|
.info
|
||||||
= person.diaspora_handle
|
= person.diaspora_handle
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@
|
||||||
.description
|
.description
|
||||||
= t('.request_people')
|
= t('.request_people')
|
||||||
|
|
||||||
= form_for Request.new do |f|
|
= form_tag(requests_path) do
|
||||||
= f.select(:aspect_id, @aspects_dropdown_array)
|
= select_tag(:aspect_id, @aspects_dropdown_array.join.html_safe)
|
||||||
= f.hidden_field :destination_url, :value => @person.diaspora_handle
|
= hidden_field_tag :destination_handle, :value => @person.diaspora_handle
|
||||||
= f.submit t('.add_friend')
|
= submit_tag t('.add_friend')
|
||||||
|
|
||||||
- else
|
- else
|
||||||
%h3
|
%h3
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,32 @@ describe PeopleController do
|
||||||
sign_in :user, user
|
sign_in :user, user
|
||||||
end
|
end
|
||||||
|
|
||||||
it "index should yield search results for substring of person name" do
|
describe '#index' do
|
||||||
|
it "yields search results for substring of person name" do
|
||||||
eugene = Factory.create(:person, :profile => {:first_name => "Eugene", :last_name => "w"})
|
eugene = Factory.create(:person, :profile => {:first_name => "Eugene", :last_name => "w"})
|
||||||
get :index, :q => "Eu"
|
get :index, :q => "Eu"
|
||||||
assigns[:people].should include eugene
|
assigns[:people].should include eugene
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'shows a friend' do
|
||||||
|
user2 = make_user
|
||||||
|
friend_users(user, aspect, user2, user2.aspects.create(:name => 'Neuroscience'))
|
||||||
|
get :index
|
||||||
|
assigns[:people].should include user2.person
|
||||||
|
response.should be_success
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'shows a non-friend' do
|
||||||
|
user2 = make_user
|
||||||
|
user2.person.profile.searchable = true
|
||||||
|
user2.save
|
||||||
|
get :index
|
||||||
|
assigns[:people].should include user2.person
|
||||||
|
response.should be_success
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#show' do
|
||||||
it 'should go to the current_user show page' do
|
it 'should go to the current_user show page' do
|
||||||
get :show, :id => user.person.id
|
get :show, :id => user.person.id
|
||||||
response.should be_success
|
response.should be_success
|
||||||
|
|
@ -35,6 +55,20 @@ describe PeopleController do
|
||||||
response.should redirect_to people_path
|
response.should redirect_to people_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "renders the show page of a friend" do
|
||||||
|
user2 = make_user
|
||||||
|
friend_users(user, aspect, user2, user2.aspects.create(:name => 'Neuroscience'))
|
||||||
|
get :show, :id => user2.person.id
|
||||||
|
response.should be_success
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders the show page of a non-friend" do
|
||||||
|
user2 = make_user
|
||||||
|
get :show, :id => user2.person.id
|
||||||
|
response.should be_success
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#update' do
|
describe '#update' do
|
||||||
context 'with a profile photo set' do
|
context 'with a profile photo set' do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue