Controller and module specs and code to prevent a fatal error when you try to befriend yourself

This commit is contained in:
Joseph Method 2010-10-17 19:05:19 -04:00
parent fcdcf88a79
commit b58b6d380b

View file

@ -0,0 +1,25 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
describe RequestsController do
render_views
before do
@user = Factory.create(:user)
sign_in :user, @user
@user.aspect(:name => "lame-os")
end
it "should not error out when requesting to be friends with yourself" do
put("create", "request" => {
"destination_url" => @user.diaspora_handle,
"aspect_id" => @user.aspects[0].id
}
)
response.should redirect_to aspect_path(@user.aspects[0].id.to_s)
end
end