Commit a21af7ca authored by danielvincent's avatar danielvincent

friend_users -> connect_users in helper_methods

parent 9850783f
......@@ -45,9 +45,9 @@ user2 = User.build( :email => "korth@tom.joindiaspora.com",
user2.save
user2.person.save!
user2.seed_aspects
# friending users
# connecting users
aspect = user.aspects.create(:name => "other dudes")
aspect2 = user2.aspects.create(:name => "presidents")
friend_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user2, aspect2)
user.aspects.create(:name => "Presidents")
......@@ -41,9 +41,9 @@ user2 = User.build( :email => "korth@tom.joindiaspora.com",
user2.save!
user2.seed_aspects
user2.person.save!
# friending users
# connecting users
aspect = user.aspects.create(:name => "other dudes")
aspect2 = user2.aspects.create(:name => "presidents")
friend_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user2, aspect2)
user.aspects.create(:name => "Presidents")
......@@ -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)
connect_users(@user, @aspect, @user2, @aspect2)
@contact = @user.contact_for(@user2.person)
sign_in :user, @user
request.env["HTTP_REFERER"] = 'http://' + request.host
......
......@@ -26,7 +26,7 @@ describe CommentsController do
context "on a post from a friend" do
before do
friend_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user2, aspect2)
@post = user2.post :status_message, :message => 'GIANTS', :to => aspect2.id
end
it 'comments' do
......
......@@ -23,7 +23,7 @@ describe PeopleController do
it 'shows a friend' do
user2 = make_user
friend_users(user, aspect, user2, user2.aspects.create(:name => 'Neuroscience'))
connect_users(user, aspect, user2, user2.aspects.create(:name => 'Neuroscience'))
get :index
assigns[:people].should include user2.person
response.should be_success
......@@ -57,7 +57,7 @@ describe PeopleController do
it "renders the show page of a friend" do
user2 = make_user
friend_users(user, aspect, user2, user2.aspects.create(:name => 'Neuroscience'))
connect_users(user, aspect, user2, user2.aspects.create(:name => 'Neuroscience'))
get :show, :id => user2.person.id
response.should be_success
end
......
......@@ -18,7 +18,7 @@ describe PhotosController do
let!(:photo2){ user2.post(:photo, :user_file => image, :to => aspect2.id)}
before do
friend_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user2, aspect2)
sign_in :user, user
@controller.stub!(:current_user).and_return(user)
end
......
......@@ -110,7 +110,7 @@ describe PublicsController do
pending
message = user2.build_post(:status_message, :message => "hi")
friend_users(user, aspect1, user2, aspect2)
connect_users(user, aspect1, user2, aspect2)
user.reload
user.visible_post_ids.include?(message.id).should be false
......
......@@ -14,7 +14,7 @@ describe StatusMessagesController do
let!(:aspect2) { user2.aspects.create(:name => "WIN!!") }
before do
friend_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user2, aspect2)
request.env["HTTP_REFERER"] = ""
sign_in :user, user
@controller.stub!(:current_user).and_return(user)
......
......@@ -26,7 +26,7 @@ module HelperMethods
User::QUEUE
end
def friend_users(user1, aspect1, user2, aspect2)
def connect_users(user1, aspect1, user2, aspect2)
request = user1.send_friend_request_to(user2.person, aspect1)
user1.reload
......
......@@ -44,7 +44,7 @@ describe Diaspora::Exporter do
context '<contacts/>' do
before do
friend_users(user1, aspect1, user3, aspect3)
connect_users(user1, aspect1, user3, aspect3)
user1.add_person_to_aspect(user3.person.id, aspect.id)
user1.reload
end
......@@ -66,7 +66,7 @@ describe Diaspora::Exporter do
context '<people/>' do
let(:people_xml) {exported.xpath('//people').to_s}
before do
friend_users(user1, aspect1, user3, aspect3)
connect_users(user1, aspect1, user3, aspect3)
user1.reload
end
it 'should include persons id' do
......
......@@ -25,7 +25,7 @@ describe Diaspora::Parser do
end
it 'should accept retractions' do
friend_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user2, aspect2)
message = user2.post(:status_message, :message => "cats", :to => aspect2.id)
retraction = Retraction.for(message)
xml = retraction.to_diaspora_xml
......@@ -70,7 +70,7 @@ describe Diaspora::Parser do
end
it 'should process retraction for a person' do
friend_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user2, aspect2)
retraction = Retraction.for(user2)
retraction_xml = retraction.to_diaspora_xml
......@@ -79,7 +79,7 @@ describe Diaspora::Parser do
end
it 'should marshal a profile for a person' do
friend_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user2, aspect2)
#Create person
person = user2.person
id = person.id
......
......@@ -44,13 +44,13 @@ describe 'making sure the spec runner works' do
end
end
describe '#friend_users' do
describe '#connect_users' do
before do
@user1 = make_user
@aspect1 = @user1.aspects.create(:name => "losers")
@user2 = make_user
@aspect2 = @user2.aspects.create(:name => "bruisers")
friend_users(@user1, @aspect1, @user2, @aspect2)
connect_users(@user1, @aspect1, @user2, @aspect2)
end
it 'makes the first user friends with the second' do
......
......@@ -121,7 +121,7 @@ describe Aspect do
it 'should add post to aspect via receive method' do
aspect = user.aspects.create(:name => 'losers')
aspect2 = user2.aspects.create(:name => 'winners')
friend_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user2, aspect2)
message = user2.post(:status_message, :message => "Hey Dude", :to => aspect2.id)
......@@ -133,7 +133,7 @@ describe Aspect do
it 'should retract the post from the aspects as well' do
aspect = user.aspects.create(:name => 'losers')
aspect2 = user2.aspects.create(:name => 'winners')
friend_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user2, aspect2)
message = user2.post(:status_message, :message => "Hey Dude", :to => aspect2.id)
......@@ -149,7 +149,7 @@ describe Aspect do
context "aspect management" do
let(:contact){user.contact_for(user2.person)}
before do
friend_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user2, aspect2)
aspect.reload
user.reload
end
......@@ -217,7 +217,7 @@ describe Aspect do
end
it 'should not delete other peoples posts' do
friend_users(user, aspect, user3, aspect3)
connect_users(user, aspect, user3, aspect3)
user.delete_person_from_aspect(user3.person.id, aspect.id)
aspect.reload
aspect.posts.should == [@message]
......
......@@ -11,7 +11,7 @@ describe Comment do
let(:user2) {make_user}
let(:aspect2) {user2.aspects.create(:name => "Lame-faces")}
let!(:friending) { friend_users(user, aspect, user2, aspect2) }
let!(:friending) { connect_users(user, aspect, user2, aspect2) }
it 'validates that the handle belongs to the person' do
user_status = user.post(:status_message, :message => "hello", :to => aspect.id)
......@@ -123,7 +123,7 @@ describe Comment do
it 'should serialize the handle and not the sender' do
commenter = make_user
commenter_aspect = commenter.aspects.create(:name => "bruisers")
friend_users(user, aspect, commenter, commenter_aspect)
connect_users(user, aspect, commenter, commenter_aspect)
post = user.post :status_message, :message => "hello", :to => aspect.id
comment = commenter.comment "Fool!", :on => post
comment.person.should_not == user.person
......
......@@ -131,7 +131,7 @@ describe Photo do
#security hax
user2 = Factory.create(:user)
aspect2 = user2.aspects.create(:name => "foobars")
friend_users(@user, @aspect, user2, aspect2)
connect_users(@user, @aspect, user2, aspect2)
url = @photo.url
thumb_url = @photo.url :thumb_medium
......
......@@ -37,7 +37,7 @@ describe "attack vectors" do
end
it 'does not let a user attach to posts previously in the db unless its received from the author' do
friend_users(user, aspect, user3, aspect3)
connect_users(user, aspect, user3, aspect3)
original_message = user2.post :status_message, :message => 'store this!', :to => aspect2.id
......@@ -48,8 +48,8 @@ describe "attack vectors" do
context 'malicious friend attack vector' do
before do
friend_users(user, aspect, user2, aspect2)
friend_users(user, aspect, user3, aspect3)
connect_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user3, aspect3)
end
......
......@@ -81,7 +81,7 @@ describe Diaspora::UserModules::Friending do
end
it 'should not be able to friend request an existing friend' do
friend_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user2, aspect2)
proc { user.send_friend_request_to(user2.person, aspect1) }.should raise_error /already friends/
end
......@@ -211,7 +211,7 @@ describe Diaspora::UserModules::Friending do
describe 'unfriending' do
before do
friend_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user2, aspect2)
end
it 'should unfriend the other user on the same seed' do
......
......@@ -40,7 +40,7 @@ describe User do
it 'throws if you try to add someone you"re friends with' do
friend_users(inviter, aspect, another_user, wrong_aspect)
connect_users(inviter, aspect, another_user, wrong_aspect)
inviter.reload
proc{inviter.invite_user(:email => another_user.email, :aspect_id => aspect.id)}.should raise_error /already friends/
end
......
......@@ -105,9 +105,9 @@ describe User do
let!(:post) { user.build_post :status_message, :message => "hey" }
before do
friend_users(user, aspect, user2, aspect2)
friend_users(user, aspect, user3, aspect3)
friend_users(user, aspect1, user4, aspect4)
connect_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user3, aspect3)
connect_users(user, aspect1, user4, aspect4)
user.add_person_to_aspect(user2.person.id, aspect1.id)
user.reload
end
......
......@@ -49,7 +49,7 @@ describe User do
let!(:second_aspect) {user.aspects.create(:name => 'losers')}
it "queries by aspect" do
friend_users(user, first_aspect, user2, user2.aspects.first)
connect_users(user, first_aspect, user2, user2.aspects.first)
user.receive status_message1.to_diaspora_xml, user2.person
user.visible_posts(:by_members_of => first_aspect).should =~ [status_message1]
......@@ -93,8 +93,8 @@ describe User do
let!(:user4) { Factory.create(:user_with_aspect)}
before do
friend_users(user, first_aspect, user4, user4.aspects.first)
friend_users(user, second_aspect, user2, user2.aspects.first)
connect_users(user, first_aspect, user4, user4.aspects.first)
connect_users(user, second_aspect, user2, user2.aspects.first)
end
describe '#friends_not_in_aspect' do
......
......@@ -17,7 +17,7 @@ describe User do
before do
friend_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user2, aspect2)
end
it 'should stream only one message to the everyone aspect when a multi-aspected friend posts' do
......@@ -128,7 +128,7 @@ describe User do
describe 'comments' do
before do
friend_users(user, aspect, user3, aspect3)
connect_users(user, aspect, user3, aspect3)
@post = user.post :status_message, :message => "hello", :to => aspect.id
user2.receive @post.to_diaspora_xml, user.person
......
......@@ -246,7 +246,7 @@ describe User do
end
it 'should not delete an aspect with friends' do
friend_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user2, aspect2)
aspect.reload
proc { user.drop_aspect(aspect) }.should raise_error /Aspect not empty/
user.aspects.include?(aspect).should == true
......@@ -305,7 +305,7 @@ describe User do
end
it 'should unfriend local people' do
friend_users(user, aspect, user2, aspect2)
connect_users(user, aspect, user2, aspect2)
lambda {user.destroy}.should change{user2.reload.friends.count}.by(-1)
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment