This commit is contained in:
Alec Leamas 2010-10-22 09:21:49 +02:00
commit 56eeae464e
19 changed files with 189 additions and 167 deletions

View file

@ -43,10 +43,11 @@ GIT
GIT GIT
remote: git://github.com/rsofaer/carrierwave.git remote: git://github.com/rsofaer/carrierwave.git
revision: 00347b93a4232ed0edd3e30a8730b5ffde635d17 revision: c3dfbdda2fa227af91fe383bb126f59b991a318f
branch: master branch: master
specs: specs:
carrierwave (0.4.4) carrierwave (0.5.0)
activesupport (~> 3.0)
GIT GIT
remote: git://github.com/rsofaer/redfinger.git remote: git://github.com/rsofaer/redfinger.git
@ -97,7 +98,6 @@ GEM
activesupport (= 3.0.1) activesupport (= 3.0.1)
activesupport (3.0.1) activesupport (3.0.1)
addressable (2.2.2) addressable (2.2.2)
archive-tar-minitar (0.5.2)
arel (1.0.1) arel (1.0.1)
activesupport (~> 3.0.0) activesupport (~> 3.0.0)
aws (2.3.22) aws (2.3.22)
@ -164,8 +164,7 @@ GEM
i18n (0.4.1) i18n (0.4.1)
json (1.4.6) json (1.4.6)
json_pure (1.4.6) json_pure (1.4.6)
linecache19 (0.5.11) linecache (0.43)
ruby_core_source (>= 0.1.4)
mail (2.2.7) mail (2.2.7)
activesupport (>= 2.3.6) activesupport (>= 2.3.6)
mime-types mime-types
@ -227,16 +226,11 @@ GEM
rspec-expectations (~> 2.0.1) rspec-expectations (~> 2.0.1)
rspec-rails (2.0.1) rspec-rails (2.0.1)
rspec (~> 2.0.0) rspec (~> 2.0.0)
ruby-debug-base19 (0.11.24) ruby-debug (0.10.3)
columnize (>= 0.3.1) columnize (>= 0.1)
linecache19 (>= 0.5.11) ruby-debug-base (~> 0.10.3.0)
ruby_core_source (>= 0.1.4) ruby-debug-base (0.10.3)
ruby-debug19 (0.11.6) linecache (>= 0.3)
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby-debug-base19 (>= 0.11.19)
ruby_core_source (0.1.4)
archive-tar-minitar (>= 0.5.2)
rubyzip (0.9.4) rubyzip (0.9.4)
selenium-webdriver (0.0.29) selenium-webdriver (0.0.29)
childprocess (>= 0.0.7) childprocess (>= 0.0.7)
@ -294,7 +288,7 @@ DEPENDENCIES
roxml! roxml!
rspec (>= 2.0.0) rspec (>= 2.0.0)
rspec-rails (>= 2.0.0) rspec-rails (>= 2.0.0)
ruby-debug19 ruby-debug
sprinkle! sprinkle!
thin thin
webmock webmock

View file

@ -73,8 +73,7 @@ class AspectsController < ApplicationController
def update def update
@aspect = current_user.aspect_by_id(params[:id]) @aspect = current_user.aspect_by_id(params[:id])
data = clean_hash(params[:aspect]) @aspect.update_attributes( params[:aspect] )
@aspect.update_attributes( data )
flash[:notice] = I18n.t 'aspects.update.success',:name => @aspect.name flash[:notice] = I18n.t 'aspects.update.success',:name => @aspect.name
respond_with @aspect respond_with @aspect
end end

View file

@ -18,6 +18,7 @@ class Aspect
validates_presence_of :name validates_presence_of :name
validates_uniqueness_of :name, :scope => :user_id validates_uniqueness_of :name, :scope => :user_id
attr_accessible :name
timestamps! timestamps!

View file

@ -92,8 +92,10 @@ class User
######### Aspects ###################### ######### Aspects ######################
def aspect(opts = {}) def aspect(opts = {})
opts[:user] = self aspect = Aspect.new(opts)
Aspect.create(opts) aspect.user = self
aspect.save
aspect
end end
def drop_aspect(aspect) def drop_aspect(aspect)

View file

@ -8,10 +8,14 @@
$("#add_album_button").fancybox(); $("#add_album_button").fancybox();
}); });
.span-4.append-1.last %h2
= render "shared/aspect_friends" = @aspect
.friend_pictures.horizontal
= owner_image_link
- for friend in @friends
= person_image_link(friend)
.span-15.last .span-24.last
%h3 %h3
= @aspect = @aspect
Albums Albums

View file

@ -48,7 +48,7 @@
%p %p
Hello #{@resource.email}! Hello #{@resource.email}!
%p %p
#{(@resource.inviters.count == 1)? ( @resource.inviters.first.real_name + " has") : (@resource.inviters.map{|inv| inv.real_name + " (#{inv.diaspora_handle})"}.join(",") + " have")} invited you to join Diaspora at #{root_url}, you can accept it through the link below. #{(@resource.inviters.count == 1)? ( @resource.inviters.first.real_name + " (#{@resource.inviters.first.diaspora_handle})" + " has") : (@resource.inviters.map{|inv| inv.real_name + " (#{inv.diaspora_handle})"}.join(",") + " have")} invited you to join Diaspora at #{root_url}, you can accept it through the link below.
- @resource.inviters.each do |inv| - @resource.inviters.each do |inv|
- if @resource.invite_messages[inv.id.to_s] - if @resource.invite_messages[inv.id.to_s]
= "#{inv.real_name}:" = "#{inv.real_name}:"

View file

@ -44,17 +44,19 @@
} }
function processComment(post_id, html){ function processComment(post_id, html){
post = $('#' + post_id)[0] post = $("*[data-guid='"+post_id+"']'");
$(' .comment_set li:last', post ).before( $(' .comment_set li:last', post ).before(
$(html).fadeIn("fast", function(){}) $(html).fadeIn("fast", function(){})
); );
toggler = $('.show_post_comments', post) toggler = $('.show_post_comments', post)
toggler.html( if(toggler.length > 0){
toggler.html().replace(/\d+/,$('.comment_set', post)[0].childElementCount -1)); toggler.html(
toggler.html().replace(/\d+/,$('.comment_set', post)[0].childElementCount -1));
if( !$(".comments", post).is(':visible') ){ if( !$(".comments", post).is(':visible') ){
toggler.click(); toggler.click();
}
} }
} }

View file

@ -2,57 +2,58 @@
-# licensed under the Affero General Public License version 3 or later. See -# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file. -# the COPYRIGHT file.
:javascript - content_for :head do
$(document).keydown(function(e){ :javascript
switch(e.keyCode) { $(document).keydown(function(e){
case 37: switch(e.keyCode) {
if(!$("textarea").hasClass("hasfocus")){//prevent redirect if textarea has focus case 37:
window.location.replace( "#{url_to_prev(@photo,@album)}" ); if(!$("textarea").hasClass("hasfocus")){//prevent redirect if textarea has focus
window.location.replace( "#{url_to_prev(@photo,@album)}" );
}
break;
case 39:
if(!$("textarea").hasClass("hasfocus")){
window.location.replace( "#{url_to_next(@photo,@album)}" );
}
break;
} }
break;
case 39:
if(!$("textarea").hasClass("hasfocus")){
window.location.replace( "#{url_to_next(@photo,@album)}" );
}
break;
}
});
$(document).ready(function(){
//add a clas to verify if a textarea has focus
$("textarea").live('focus',function(){
$(this).addClass("hasfocus");
});
$("textarea").live('blur',function(){
$(this).removeClass("hasfocus");
}); });
//show form to add description $(document).ready(function(){
$(".edit-desc").click(function(){ //add a clas to verify if a textarea has focus
$(".edit_photo").toggle(); $("textarea").live('focus',function(){
}); $(this).addClass("hasfocus");
});
$("textarea").live('blur',function(){
$(this).removeClass("hasfocus");
});
//Add a description with ajax request //show form to add description
$("#photo_submit").click(function(evenet){ $(".edit-desc").click(function(){
event.preventDefault(); $(".edit_photo").toggle();
var method = $(".edit_photo").attr("method"); });
var url = $(".edit_photo").attr("action");
var data = $(".edit_photo").serialize();
$(".description").text($("#photo_caption").val());
$(".edit_photo").toggle();
$.ajax({ //Add a description with ajax request
type: method, $("#photo_submit").click(function(evenet){
url: url, event.preventDefault();
data: data, var method = $(".edit_photo").attr("method");
success: function(response){ var url = $(".edit_photo").attr("action");
$("#add-description").remove(); var data = $(".edit_photo").serialize();
} $(".description").text($("#photo_caption").val());
}); $(".edit_photo").toggle();
}); $.ajax({
type: method,
url: url,
data: data,
success: function(response){
$("#add-description").remove();
}
});
});//end document ready });
});//end document ready
%h2 %h2
= @aspect = @aspect
@ -64,6 +65,12 @@
%h3 %h3
= link_to @photo.album.name, @photo.album = link_to @photo.album.name, @photo.album
= link_to "<< #{t('.prev')}", url_to_prev(@photo, @album), :rel => 'prefetch'
|
= link_to "#{t('.full_size')}", @photo.url
|
= link_to "#{t('.next')} >>", url_to_next(@photo, @album), :rel => 'prefetch'
.span-14.append-1.last .span-14.append-1.last
%div{:data=>{:guid=>@photo.id}} %div{:data=>{:guid=>@photo.id}}
#show_photo #show_photo
@ -72,8 +79,6 @@
.edit_pane .edit_pane
.controls{:data=>{:actor=>"#{@photo.person.owner.id}",:actor_person=>"#{@photo.person.id}",:image_url=>"#{@photo.url(:thumb_medium)}"}} .controls{:data=>{:actor=>"#{@photo.person.owner.id}",:actor_person=>"#{@photo.person.id}",:image_url=>"#{@photo.url(:thumb_medium)}"}}
= link_to 'make profile photo', '#', :class => "make_profile_photo" = link_to 'make profile photo', '#', :class => "make_profile_photo"
|
= link_to 'edit', '#', :class => "make_profile_photo"
= linked_scaled_photo @photo, @album = linked_scaled_photo @photo, @album
-else -else
= linked_scaled_photo @photo, @album = linked_scaled_photo @photo, @album
@ -100,13 +105,6 @@
= link_to t('.delete_photo'), @photo, :confirm => t('.are_you_sure'), :method => :delete, :class => 'button' = link_to t('.delete_photo'), @photo, :confirm => t('.are_you_sure'), :method => :delete, :class => 'button'
.span-9.last .span-9.last
= link_to "<< #{t('.prev')}", url_to_prev(@photo, @album), :rel => 'prefetch'
|
= link_to "#{t('.full_size')}", @photo.url
|
= link_to "#{t('.next')} >>", url_to_next(@photo, @album), :rel => 'prefetch'
%br
%br
#stream.show #stream.show
%li.message{:id => @photo.id} %li.message{:data=>{:guid=>@photo.id}}
= render "comments/comments", :post => @photo = render "comments/comments", :post => @photo

View file

@ -26,5 +26,5 @@
.span-9.last .span-9.last
#stream.show #stream.show
%li.message{:id => @status_message.id} %li.message{:data=>{:guid=>@status_message.id}}
= render "comments/comments", :post => @status_message = render "comments/comments", :post => @status_message

27
ci.sh
View file

@ -4,18 +4,19 @@ echo "**************************************************************************
echo "* ruby 1.8.7-p249 build *" && echo "* ruby 1.8.7-p249 build *" &&
echo "*************************************************************************************************" && echo "*************************************************************************************************" &&
echo "" && echo "" &&
rm Gemfile.lock && rm -f Gemfile.lock &&
source /usr/local/rvm/scripts/rvm && source /usr/local/rvm/scripts/rvm &&
rvm use ruby-1.8.7-p249 && rvm use ruby-1.8.7-p249@diaspora &&
bundle install && bundle install &&
bundle exec rake ci && bundle exec rake cruise
echo "" && # bundle exec rake cruise &&
echo "*************************************************************************************************" && # echo "" &&
echo "* ruby 1.9.2-p0 build *" && # echo "*************************************************************************************************" &&
echo "*************************************************************************************************" && # echo "* ruby 1.9.2-p0 build *" &&
echo "" && # echo "*************************************************************************************************" &&
rm Gemfile.lock && # echo "" &&
source /usr/local/rvm/scripts/rvm && # rm -f Gemfile.lock &&
rvm use ruby-1.9.2-p0 && # source /usr/local/rvm/scripts/rvm &&
bundle install && # rvm use ruby-1.9.2-p0@diaspora &&
bundle exec rake ci # bundle install &&
# bundle exec rake cruise

5
cruise_config.rb Normal file
View file

@ -0,0 +1,5 @@
require 'fileutils'
Project.configure do |project|
project.build_command = './ci.sh'
end

28
lib/cruise/build.rb Normal file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env ruby
require 'fileutils'
include FileUtils
def root_dir
@root_dir ||= File.expand_path(File.dirname(__FILE__) + '/../..')
end
def rake(*tasks)
tasks.each do |task|
return false unless system("rake", task, 'RAILS_ENV=test')
end
end
build_results = {}
cd root_dir do
build_results[:bundle] = system 'bundle install' # bundling here, rather than in a task (not in Rails context)
build_results[:spec] = rake 'cruise'
end
failures = build_results.select { |key, value| value == false }
if failures.empty?
exit(0)
else
exit(-1)
end

View file

@ -1,6 +1,6 @@
namespace :ci do namespace :cruise do
desc "Run all specs and features" desc "Run all specs and features"
task :ci => :environment do task :cruise => :environment do
system('/etc/init.d/xvfb start') system('/etc/init.d/xvfb start')
system('export DISPLAY=:99.0 && bundle exec rake') system('export DISPLAY=:99.0 && bundle exec rake')
exit_status = $?.exitstatus exit_status = $?.exitstatus
@ -8,4 +8,4 @@ namespace :ci do
raise "tests failed!" unless exit_status == 0 raise "tests failed!" unless exit_status == 0
end end
end end
task :ci => "ci:ci" task :cruise => "cruise:cruise"

View file

@ -47,7 +47,7 @@ $(document).ready(function(){
} }
); );
$("#publisher textarea, .comment textarea").keydown( function(e) { $("#publisher textarea, .comment_box").keydown( function(e) {
if (e.keyCode == 13) { if (e.keyCode == 13) {
$(this).closest("form").submit(); $(this).closest("form").submit();
} }

View file

@ -14,6 +14,7 @@
body body
:padding 2em :padding 2em
:margin 0 :margin 0
:background-color rgba(252,252,252,1)
a a
:color #107FC9 :color #107FC9
:text :text
@ -58,9 +59,7 @@ h3
#flash_notice #flash_notice
:background :background
:color rgba(127,255,36,0.85) :color rgba(127,255,36,0.6)
:border
:bottom solid 1px #6C6
:text :text
:shadow 0 1px #6C6 :shadow 0 1px #6C6
@ -180,7 +179,7 @@ header
#global_search #global_search
:margin :margin
:left 425px :left 432px
#stream #stream
:margin 0 :margin 0
@ -845,7 +844,7 @@ h1.big_text
:font :font
:weight bold :weight bold
:background :background
:color #fff :color rgba(252,252,252,1)
:color #444 :color #444
&:hover &:hover
@ -1015,8 +1014,8 @@ ul#settings_nav
:left 20px :left 20px
img img
:width 20px :width 30px
:height 20px :height 30px
:margin-right -4px :margin-right -4px
#thumbnails #thumbnails
@ -1070,7 +1069,7 @@ input[type="search"]
header header
input[type="search"] input[type="search"]
:width 200px :width 192px
.fancybox_content .fancybox_content
:display none :display none

View file

@ -18,29 +18,27 @@ describe Aspect do
let(:aspect3) {user3.aspect(:name => "lala")} let(:aspect3) {user3.aspect(:name => "lala")}
describe 'creation' do describe 'creation' do
let(:aspect){user.aspect(:name => 'losers')}
it 'should have a name' do it 'should have a name' do
aspect = user.aspect(:name => 'losers')
aspect.name.should == "losers" aspect.name.should == "losers"
end end
it 'should be creatable with people' do it 'should not be creatable with people' do
aspect = user.aspect(:name => 'losers', :people => [friend, friend_2]) aspect = user.aspect(:name => 'losers', :people => [friend, friend_2])
aspect.people.size.should == 2 aspect.people.size.should == 0
end end
it 'should be able to have other users' do it 'should be able to have other users' do
aspect = user.aspect(:name => 'losers', :people => [user2.person]) aspect.people << user2.person
aspect.people.include?(user.person).should be false aspect.people.include?(user.person).should be false
aspect.people.include?(user2.person).should be true aspect.people.include?(user2.person).should be true
aspect.people.size.should == 1 aspect.people.size.should == 1
end end
it 'should be able to have users and people' do it 'should be able to have users and people' do
aspect = user.aspect(:name => 'losers', :people => [user2.person, friend_2]) aspect.people << user2.person
aspect.people.include?(user.person).should be false aspect.people << friend_2
aspect.people.include?(user2.person).should be true aspect.save.should be_true
aspect.people.include?(friend_2).should be true
aspect.people.size.should == 2
end end
end end

View file

@ -10,18 +10,22 @@ describe Comment do
let(:user2) {Factory.create(:user)} let(:user2) {Factory.create(:user)}
let(:aspect2) {user2.aspect(:name => "Lame-faces")} let(:aspect2) {user2.aspect(:name => "Lame-faces")}
describe 'User#comment' do
let(:status) {user.post(:status_message, :message => "hello", :to => aspect)}
it "should be able to comment on his own status" do
status.comments.should == []
user.comment "Yeah, it was great", :on => status describe 'User#comment' do
status.reload.comments.first.text.should == "Yeah, it was great" before do
@status = user.post(:status_message, :message => "hello", :to => aspect.id)
end
it "should be able to comment on his own status" do
@status.comments.should == []
user.comment "Yeah, it was great", :on => @status
@status.reload.comments.first.text.should == "Yeah, it was great"
end end
it "should be able to comment on a person's status" do it "should be able to comment on a person's status" do
user2.comment "sup dog", :on => status user2.comment "sup dog", :on => @status
status.reload.comments.first.text.should == "sup dog" @status.reload.comments.first.text.should == "sup dog"
end end
end end
@ -42,34 +46,32 @@ describe Comment do
@person_status = Factory.build(:status_message, :person => @person) @person_status = Factory.build(:status_message, :person => @person)
user.reload user.reload
user_status = user.post :status_message, :message => "hi", :to => aspect.id @user_status = user.post :status_message, :message => "hi", :to => aspect.id
aspect.reload aspect.reload
user.reload user.reload
end end
it 'should receive a comment from a person not on the pod' do it 'should receive a comment from a person not on the pod' do
user3 = Factory.create :user user3 = Factory.create(:user)
aspect3 = user3.aspect(:name => "blah") aspect3 = user3.aspect(:name => "blah")
friend_users(user, aspect, user3, aspect3) friend_users(user, aspect, user3, aspect3)
comment = Comment.new(:person_id => user3.person.id, :text => "hey", :post => user_status) comment = Comment.new(:person_id => user3.person.id, :text => "hey", :post => @user_status)
comment.creator_signature = comment.sign_with_key(user3.encryption_key) comment.creator_signature = comment.sign_with_key(user3.encryption_key)
comment.post_creator_signature = comment.sign_with_key(user.encryption_key) comment.post_creator_signature = comment.sign_with_key(user.encryption_key)
xml = user.salmon(comment).xml_for(user2) xml = user.salmon(comment).xml_for(user2)
user3.person.delete user3.person.delete
user3.delete user3.delete
@user_status.reload
user_status.reload @user_status.comments.should == []
user_status.comments.should == [] user2.receive_salmon(xml)
user.receive_salmon(xml) @user_status.reload
user_status.reload @user_status.comments.include?(comment).should be true
user_status.comments.include?(comment).should be true
end end
it "should send a user's comment on a person's post to that person" do it "should send a user's comment on a person's post to that person" do
@ -80,17 +82,17 @@ describe Comment do
it 'should send a user comment on his own post to lots of people' do it 'should send a user comment on his own post to lots of people' do
User::QUEUE.should_receive(:add_post_request).twice User::QUEUE.should_receive(:add_post_request).twice
user.comment "yo", :on => user_status user.comment "yo", :on => @user_status
end end
it 'should send a comment a person made on your post to all people' do it 'should send a comment a person made on your post to all people' do
comment = Comment.new(:person_id => @person.id, :text => "balls", :post => user_status) comment = Comment.new(:person_id => @person.id, :text => "balls", :post => @user_status)
User::QUEUE.should_receive(:add_post_request).twice User::QUEUE.should_receive(:add_post_request).twice
user.receive comment.to_diaspora_xml, @person user.receive comment.to_diaspora_xml, @person
end end
it 'should send a comment a user made on your post to all people' do it 'should send a comment a user made on your post to all people' do
comment = user2.comment( "balls", :on => user_status) comment = user2.comment( "balls", :on => @user_status)
User::QUEUE.should_receive(:add_post_request).twice User::QUEUE.should_receive(:add_post_request).twice
user.receive comment.to_diaspora_xml, user2.person user.receive comment.to_diaspora_xml, user2.person
end end
@ -108,13 +110,13 @@ describe Comment do
end end
it 'should not clear the aspect post array on receiving a comment' do it 'should not clear the aspect post array on receiving a comment' do
aspect.post_ids.include?(user_status.id).should be true aspect.post_ids.include?(@user_status.id).should be true
comment = Comment.new(:person_id => @person.id, :text => "balls", :post => user_status) comment = Comment.new(:person_id => @person.id, :text => "balls", :post => @user_status)
user.receive comment.to_diaspora_xml, @person user.receive comment.to_diaspora_xml, @person
aspect.reload aspect.reload
aspect.post_ids.include?(user_status.id).should be true aspect.post_ids.include?(@user_status.id).should be true
end end
end end
describe 'serialization' do describe 'serialization' do

View file

@ -27,7 +27,7 @@ describe User do
status_message.destroy status_message.destroy
user user
lambda {user.receive xml , user2.person}.should change (Post,:count).by(1) lambda {user.receive xml , user2.person}.should change(Post,:count).by(1)
end end
it 'should not create new aspects on message receive' do it 'should not create new aspects on message receive' do

View file

@ -9,8 +9,6 @@ describe User do
let(:aspect) { user.aspect(:name => 'heroes') } let(:aspect) { user.aspect(:name => 'heroes') }
let(:user2) { Factory(:user) } let(:user2) { Factory(:user) }
let(:aspect2) { user2.aspect(:name => 'stuff') } let(:aspect2) { user2.aspect(:name => 'stuff') }
let(:user3) { Factory(:user) }
let(:aspect3) { user3.aspect(:name => 'stuff') }
describe "validation" do describe "validation" do
describe "of associated person" do describe "of associated person" do
@ -103,6 +101,7 @@ describe User do
end end
it "makes a valid user" do it "makes a valid user" do
@user.should be_valid @user.should be_valid
@user.persisted?.should be_false
User.find_by_username("ohai").should be_nil User.find_by_username("ohai").should be_nil
end end
it 'saves successfully' do it 'saves successfully' do
@ -143,13 +142,13 @@ describe User do
context 'profiles' do context 'profiles' do
it 'should be able to update their profile and send it to their friends' do it 'should be able to update their profile and send it to their friends' do
updated_profile = {:profile => { updated_profile = {
:first_name => 'bob', :first_name => 'bob',
:last_name => 'billytown', :last_name => 'billytown',
:image_url => "http://clown.com"}} :image_url => "http://clown.com"}
user.update_profile(updated_profile).should be true user.update_profile(updated_profile).should be true
user.profile.image_url.should == "http://clown.com" user.reload.profile.image_url.should == "http://clown.com"
end end
end end
@ -167,12 +166,7 @@ describe User do
end end
end end
context 'account removal' do describe 'account removal' do
before do
friend_users(user, aspect, user2, aspect2)
friend_users(user, aspect, user3, aspect3)
end
it 'should unfriend everyone' do it 'should unfriend everyone' do
user.should_receive(:unfriend_everyone) user.should_receive(:unfriend_everyone)
user.destroy user.destroy
@ -184,11 +178,8 @@ describe User do
end end
it 'should remove all aspects' do it 'should remove all aspects' do
aspects = user.aspects aspect
aspects.count.should > 0 lambda {user.destroy}.should change{user.aspects.reload.count}.by(-1)
user.destroy
aspects.reload
aspects.count.should == 0
end end
describe '#remove_person' do describe '#remove_person' do
@ -208,20 +199,18 @@ describe User do
end end
describe '#unfriend_everyone' do describe '#unfriend_everyone' do
before do
user3.delete
end
it 'should send retractions to remote poeple' do it 'should send retractions to remote poeple' do
user2.delete
user.activate_friend(user2.person, aspect)
user.should_receive(:unfriend).once user.should_receive(:unfriend).once
user.destroy user.destroy
end end
it 'should unfriend local people' do it 'should unfriend local people' do
user2.friends.count.should be 1 friend_users(user, aspect, user2, aspect2)
user.destroy lambda {user.destroy}.should change{user2.reload.friends.count}.by(-1)
user2.reload
user2.friends.count.should be 0
end end
end end
end end