AspectsController#manage now works if you have pending friend requests.
This commit is contained in:
parent
c113ee2b7c
commit
a39bd2badb
2 changed files with 56 additions and 18 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ describe AspectsController do
|
|||
@aspect1 = @user.aspects.create(:name => "another aspect")
|
||||
@user2 = make_user
|
||||
@aspect2 = @user2.aspects.create(:name => "party people")
|
||||
friend_users(@user,@aspect, @user2, @aspect2)
|
||||
friend_users(@user, @aspect, @user2, @aspect2)
|
||||
@contact = @user.contact_for(@user2.person)
|
||||
sign_in :user, @user
|
||||
request.env["HTTP_REFERER"] = 'http://' + request.host
|
||||
|
|
@ -52,12 +52,50 @@ 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"}}}
|
||||
let(:opts) { {:friend_id => "person_id", :from => "from_aspect_id", :to => {:to => "to_aspect_id"}} }
|
||||
it 'calls the move_friend_method' do
|
||||
pending "need to figure out what is the deal with remote requests"
|
||||
@controller.stub!(:current_user).and_return(@user)
|
||||
@user.should_receive(:move_friend).with( :friend_id => "person_id", :from => "from_aspect_id", :to => "to_aspect_id")
|
||||
@user.should_receive(:move_friend).with(:friend_id => "person_id", :from => "from_aspect_id", :to => "to_aspect_id")
|
||||
post :move_friend, opts
|
||||
end
|
||||
end
|
||||
|
|
@ -79,7 +117,7 @@ describe AspectsController do
|
|||
it 'adds the users to the aspect' do
|
||||
@aspect1.reload
|
||||
@aspect1.people.include?(@contact).should be false
|
||||
post 'add_to_aspect', {:friend_id => @user2.person.id, :aspect_id => @aspect1.id }
|
||||
post 'add_to_aspect', {:friend_id => @user2.person.id, :aspect_id => @aspect1.id}
|
||||
@aspect1.reload
|
||||
@aspect1.people.include?(@contact).should be true
|
||||
end
|
||||
|
|
@ -89,7 +127,7 @@ describe AspectsController do
|
|||
it 'adds the users to the aspect' do
|
||||
@aspect.reload
|
||||
@aspect.people.include?(@contact).should be true
|
||||
post 'remove_from_aspect', {:friend_id => @user2.person.id, :aspect_id => @aspect1.id }
|
||||
post 'remove_from_aspect', {:friend_id => @user2.person.id, :aspect_id => @aspect1.id}
|
||||
@aspect1.reload
|
||||
@aspect1.people.include?(@contact).should be false
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue