AspectsController#manage now works if you have pending friend requests.

This commit is contained in:
Sarah Mei 2010-11-10 12:05:28 -07:00
parent c113ee2b7c
commit a39bd2badb
2 changed files with 56 additions and 18 deletions

View file

@ -20,12 +20,12 @@
%li=t('.no_requests')
- else
- for request in @remote_requests
%li.person.request{:data=>{:guid=>request.id, :person_id=>request.person.id}}
%li.person.request{:data=>{:guid=>request.id, :person_id=>request.from.id}}
.delete
.x
X
.circle
= person_image_tag(request.person)
= person_image_tag(request.from)
= render 'shared/invitations', :invites => @invites

View file

@ -52,6 +52,44 @@ describe AspectsController do
end
end
describe "#manage" do
it "succeeds" do
get :manage
response.should be_success
end
it "assigns aspect to manage" do
get :manage
assigns(:aspect).should == :manage
end
it "assigns remote_requests" do
get :manage
assigns(:remote_requests).should be_empty
end
context "when the user has pending requests" do
before do
requestor = make_user
requestor_aspect = requestor.aspects.create(:name => "Meh")
requestor.send_friend_request_to(@user.person, requestor_aspect)
requestor.reload
requestor_aspect.reload
@user.reload
end
it "succeeds" do
get :manage
response.should be_success
end
it "assigns aspect to manage" do
get :manage
assigns(:aspect).should == :manage
end
it "assigns remote_requests" do
get :manage
assigns(:remote_requests).count.should == 1
end
end
end
describe "#move_friend" do
let(:opts) { {:friend_id => "person_id", :from => "from_aspect_id", :to => {:to => "to_aspect_id"}} }
it 'calls the move_friend_method' do