diff --git a/app/controllers/my_profile/friends_controller.rb b/app/controllers/my_profile/friends_controller.rb index 325c94c..36ca05a 100644 --- a/app/controllers/my_profile/friends_controller.rb +++ b/app/controllers/my_profile/friends_controller.rb @@ -1,9 +1,13 @@ class FriendsController < MyProfileController + + def index + @friends = profile.friends + end def add @friend = Person.find(params[:id]) if request.post? && params[:confirmation] - AddFriend.create!(:person => user, :friend => @friend) + AddFriend.create!(:person => profile, :friend => @friend) # FIXME shouldn't redirect to the friend's page? redirect_to :action => 'index' diff --git a/test/functional/friends_controller_test.rb b/test/functional/friends_controller_test.rb index b9ee7a1..e9ffc94 100644 --- a/test/functional/friends_controller_test.rb +++ b/test/functional/friends_controller_test.rb @@ -21,6 +21,13 @@ class FriendsControllerTest < Test::Unit::TestCase end attr_accessor :profile, :friend + should 'list friends' do + get :index + assert_response :success + assert_template 'index' + assert_kind_of Array, assigns(:friends) + end + should 'confirm addition of new friend' do get :add, :id => friend.id -- libgit2 0.21.2