Merging
This commit is contained in:
commit
56eeae464e
19 changed files with 189 additions and 167 deletions
26
Gemfile.lock
26
Gemfile.lock
|
|
@ -43,10 +43,11 @@ GIT
|
|||
|
||||
GIT
|
||||
remote: git://github.com/rsofaer/carrierwave.git
|
||||
revision: 00347b93a4232ed0edd3e30a8730b5ffde635d17
|
||||
revision: c3dfbdda2fa227af91fe383bb126f59b991a318f
|
||||
branch: master
|
||||
specs:
|
||||
carrierwave (0.4.4)
|
||||
carrierwave (0.5.0)
|
||||
activesupport (~> 3.0)
|
||||
|
||||
GIT
|
||||
remote: git://github.com/rsofaer/redfinger.git
|
||||
|
|
@ -97,7 +98,6 @@ GEM
|
|||
activesupport (= 3.0.1)
|
||||
activesupport (3.0.1)
|
||||
addressable (2.2.2)
|
||||
archive-tar-minitar (0.5.2)
|
||||
arel (1.0.1)
|
||||
activesupport (~> 3.0.0)
|
||||
aws (2.3.22)
|
||||
|
|
@ -164,8 +164,7 @@ GEM
|
|||
i18n (0.4.1)
|
||||
json (1.4.6)
|
||||
json_pure (1.4.6)
|
||||
linecache19 (0.5.11)
|
||||
ruby_core_source (>= 0.1.4)
|
||||
linecache (0.43)
|
||||
mail (2.2.7)
|
||||
activesupport (>= 2.3.6)
|
||||
mime-types
|
||||
|
|
@ -227,16 +226,11 @@ GEM
|
|||
rspec-expectations (~> 2.0.1)
|
||||
rspec-rails (2.0.1)
|
||||
rspec (~> 2.0.0)
|
||||
ruby-debug-base19 (0.11.24)
|
||||
columnize (>= 0.3.1)
|
||||
linecache19 (>= 0.5.11)
|
||||
ruby_core_source (>= 0.1.4)
|
||||
ruby-debug19 (0.11.6)
|
||||
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)
|
||||
ruby-debug (0.10.3)
|
||||
columnize (>= 0.1)
|
||||
ruby-debug-base (~> 0.10.3.0)
|
||||
ruby-debug-base (0.10.3)
|
||||
linecache (>= 0.3)
|
||||
rubyzip (0.9.4)
|
||||
selenium-webdriver (0.0.29)
|
||||
childprocess (>= 0.0.7)
|
||||
|
|
@ -294,7 +288,7 @@ DEPENDENCIES
|
|||
roxml!
|
||||
rspec (>= 2.0.0)
|
||||
rspec-rails (>= 2.0.0)
|
||||
ruby-debug19
|
||||
ruby-debug
|
||||
sprinkle!
|
||||
thin
|
||||
webmock
|
||||
|
|
|
|||
|
|
@ -73,8 +73,7 @@ class AspectsController < ApplicationController
|
|||
def update
|
||||
@aspect = current_user.aspect_by_id(params[:id])
|
||||
|
||||
data = clean_hash(params[:aspect])
|
||||
@aspect.update_attributes( data )
|
||||
@aspect.update_attributes( params[:aspect] )
|
||||
flash[:notice] = I18n.t 'aspects.update.success',:name => @aspect.name
|
||||
respond_with @aspect
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class Aspect
|
|||
|
||||
validates_presence_of :name
|
||||
validates_uniqueness_of :name, :scope => :user_id
|
||||
attr_accessible :name
|
||||
|
||||
timestamps!
|
||||
|
||||
|
|
|
|||
|
|
@ -92,8 +92,10 @@ class User
|
|||
|
||||
######### Aspects ######################
|
||||
def aspect(opts = {})
|
||||
opts[:user] = self
|
||||
Aspect.create(opts)
|
||||
aspect = Aspect.new(opts)
|
||||
aspect.user = self
|
||||
aspect.save
|
||||
aspect
|
||||
end
|
||||
|
||||
def drop_aspect(aspect)
|
||||
|
|
|
|||
|
|
@ -8,10 +8,14 @@
|
|||
$("#add_album_button").fancybox();
|
||||
});
|
||||
|
||||
.span-4.append-1.last
|
||||
= render "shared/aspect_friends"
|
||||
%h2
|
||||
= @aspect
|
||||
.friend_pictures.horizontal
|
||||
= owner_image_link
|
||||
- for friend in @friends
|
||||
= person_image_link(friend)
|
||||
|
||||
.span-15.last
|
||||
.span-24.last
|
||||
%h3
|
||||
= @aspect
|
||||
Albums
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
%p
|
||||
Hello #{@resource.email}!
|
||||
%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|
|
||||
- if @resource.invite_messages[inv.id.to_s]
|
||||
= "#{inv.real_name}:"
|
||||
|
|
|
|||
|
|
@ -44,17 +44,19 @@
|
|||
}
|
||||
|
||||
function processComment(post_id, html){
|
||||
post = $('#' + post_id)[0]
|
||||
post = $("*[data-guid='"+post_id+"']'");
|
||||
$(' .comment_set li:last', post ).before(
|
||||
$(html).fadeIn("fast", function(){})
|
||||
);
|
||||
toggler = $('.show_post_comments', post)
|
||||
|
||||
toggler.html(
|
||||
toggler.html().replace(/\d+/,$('.comment_set', post)[0].childElementCount -1));
|
||||
if(toggler.length > 0){
|
||||
toggler.html(
|
||||
toggler.html().replace(/\d+/,$('.comment_set', post)[0].childElementCount -1));
|
||||
|
||||
if( !$(".comments", post).is(':visible') ){
|
||||
toggler.click();
|
||||
if( !$(".comments", post).is(':visible') ){
|
||||
toggler.click();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,57 +2,58 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
:javascript
|
||||
$(document).keydown(function(e){
|
||||
switch(e.keyCode) {
|
||||
case 37:
|
||||
if(!$("textarea").hasClass("hasfocus")){//prevent redirect if textarea has focus
|
||||
window.location.replace( "#{url_to_prev(@photo,@album)}" );
|
||||
- content_for :head do
|
||||
:javascript
|
||||
$(document).keydown(function(e){
|
||||
switch(e.keyCode) {
|
||||
case 37:
|
||||
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
|
||||
$(".edit-desc").click(function(){
|
||||
$(".edit_photo").toggle();
|
||||
});
|
||||
$(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");
|
||||
});
|
||||
|
||||
//Add a description with ajax request
|
||||
$("#photo_submit").click(function(evenet){
|
||||
event.preventDefault();
|
||||
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();
|
||||
//show form to add description
|
||||
$(".edit-desc").click(function(){
|
||||
$(".edit_photo").toggle();
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: method,
|
||||
url: url,
|
||||
data: data,
|
||||
success: function(response){
|
||||
$("#add-description").remove();
|
||||
}
|
||||
});
|
||||
//Add a description with ajax request
|
||||
$("#photo_submit").click(function(evenet){
|
||||
event.preventDefault();
|
||||
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({
|
||||
type: method,
|
||||
url: url,
|
||||
data: data,
|
||||
success: function(response){
|
||||
$("#add-description").remove();
|
||||
}
|
||||
});
|
||||
|
||||
});//end document ready
|
||||
});
|
||||
|
||||
});//end document ready
|
||||
|
||||
%h2
|
||||
= @aspect
|
||||
|
|
@ -64,6 +65,12 @@
|
|||
%h3
|
||||
= 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
|
||||
%div{:data=>{:guid=>@photo.id}}
|
||||
#show_photo
|
||||
|
|
@ -72,8 +79,6 @@
|
|||
.edit_pane
|
||||
.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 'edit', '#', :class => "make_profile_photo"
|
||||
= linked_scaled_photo @photo, @album
|
||||
-else
|
||||
= linked_scaled_photo @photo, @album
|
||||
|
|
@ -100,13 +105,6 @@
|
|||
= link_to t('.delete_photo'), @photo, :confirm => t('.are_you_sure'), :method => :delete, :class => 'button'
|
||||
|
||||
.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
|
||||
%li.message{:id => @photo.id}
|
||||
%li.message{:data=>{:guid=>@photo.id}}
|
||||
= render "comments/comments", :post => @photo
|
||||
|
|
|
|||
|
|
@ -26,5 +26,5 @@
|
|||
|
||||
.span-9.last
|
||||
#stream.show
|
||||
%li.message{:id => @status_message.id}
|
||||
%li.message{:data=>{:guid=>@status_message.id}}
|
||||
= render "comments/comments", :post => @status_message
|
||||
|
|
|
|||
27
ci.sh
27
ci.sh
|
|
@ -4,18 +4,19 @@ echo "**************************************************************************
|
|||
echo "* ruby 1.8.7-p249 build *" &&
|
||||
echo "*************************************************************************************************" &&
|
||||
echo "" &&
|
||||
rm Gemfile.lock &&
|
||||
rm -f Gemfile.lock &&
|
||||
source /usr/local/rvm/scripts/rvm &&
|
||||
rvm use ruby-1.8.7-p249 &&
|
||||
rvm use ruby-1.8.7-p249@diaspora &&
|
||||
bundle install &&
|
||||
bundle exec rake ci &&
|
||||
echo "" &&
|
||||
echo "*************************************************************************************************" &&
|
||||
echo "* ruby 1.9.2-p0 build *" &&
|
||||
echo "*************************************************************************************************" &&
|
||||
echo "" &&
|
||||
rm Gemfile.lock &&
|
||||
source /usr/local/rvm/scripts/rvm &&
|
||||
rvm use ruby-1.9.2-p0 &&
|
||||
bundle install &&
|
||||
bundle exec rake ci
|
||||
bundle exec rake cruise
|
||||
# bundle exec rake cruise &&
|
||||
# echo "" &&
|
||||
# echo "*************************************************************************************************" &&
|
||||
# echo "* ruby 1.9.2-p0 build *" &&
|
||||
# echo "*************************************************************************************************" &&
|
||||
# echo "" &&
|
||||
# rm -f Gemfile.lock &&
|
||||
# source /usr/local/rvm/scripts/rvm &&
|
||||
# rvm use ruby-1.9.2-p0@diaspora &&
|
||||
# bundle install &&
|
||||
# bundle exec rake cruise
|
||||
|
|
|
|||
5
cruise_config.rb
Normal file
5
cruise_config.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
require 'fileutils'
|
||||
|
||||
Project.configure do |project|
|
||||
project.build_command = './ci.sh'
|
||||
end
|
||||
28
lib/cruise/build.rb
Normal file
28
lib/cruise/build.rb
Normal 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
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
namespace :ci do
|
||||
namespace :cruise do
|
||||
desc "Run all specs and features"
|
||||
task :ci => :environment do
|
||||
task :cruise => :environment do
|
||||
system('/etc/init.d/xvfb start')
|
||||
system('export DISPLAY=:99.0 && bundle exec rake')
|
||||
exit_status = $?.exitstatus
|
||||
|
|
@ -8,4 +8,4 @@ namespace :ci do
|
|||
raise "tests failed!" unless exit_status == 0
|
||||
end
|
||||
end
|
||||
task :ci => "ci:ci"
|
||||
task :cruise => "cruise:cruise"
|
||||
|
|
@ -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) {
|
||||
$(this).closest("form").submit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
body
|
||||
:padding 2em
|
||||
:margin 0
|
||||
:background-color rgba(252,252,252,1)
|
||||
a
|
||||
:color #107FC9
|
||||
:text
|
||||
|
|
@ -58,9 +59,7 @@ h3
|
|||
|
||||
#flash_notice
|
||||
:background
|
||||
:color rgba(127,255,36,0.85)
|
||||
:border
|
||||
:bottom solid 1px #6C6
|
||||
:color rgba(127,255,36,0.6)
|
||||
:text
|
||||
:shadow 0 1px #6C6
|
||||
|
||||
|
|
@ -180,7 +179,7 @@ header
|
|||
|
||||
#global_search
|
||||
:margin
|
||||
:left 425px
|
||||
:left 432px
|
||||
|
||||
#stream
|
||||
:margin 0
|
||||
|
|
@ -845,7 +844,7 @@ h1.big_text
|
|||
:font
|
||||
:weight bold
|
||||
:background
|
||||
:color #fff
|
||||
:color rgba(252,252,252,1)
|
||||
|
||||
:color #444
|
||||
&:hover
|
||||
|
|
@ -1015,8 +1014,8 @@ ul#settings_nav
|
|||
:left 20px
|
||||
|
||||
img
|
||||
:width 20px
|
||||
:height 20px
|
||||
:width 30px
|
||||
:height 30px
|
||||
:margin-right -4px
|
||||
|
||||
#thumbnails
|
||||
|
|
@ -1070,7 +1069,7 @@ input[type="search"]
|
|||
|
||||
header
|
||||
input[type="search"]
|
||||
:width 200px
|
||||
:width 192px
|
||||
|
||||
.fancybox_content
|
||||
:display none
|
||||
|
|
|
|||
|
|
@ -18,29 +18,27 @@ describe Aspect do
|
|||
let(:aspect3) {user3.aspect(:name => "lala")}
|
||||
|
||||
describe 'creation' do
|
||||
let(:aspect){user.aspect(:name => 'losers')}
|
||||
it 'should have a name' do
|
||||
aspect = user.aspect(:name => 'losers')
|
||||
aspect.name.should == "losers"
|
||||
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.people.size.should == 2
|
||||
aspect.people.size.should == 0
|
||||
end
|
||||
|
||||
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?(user2.person).should be true
|
||||
aspect.people.size.should == 1
|
||||
end
|
||||
|
||||
it 'should be able to have users and people' do
|
||||
aspect = user.aspect(:name => 'losers', :people => [user2.person, friend_2])
|
||||
aspect.people.include?(user.person).should be false
|
||||
aspect.people.include?(user2.person).should be true
|
||||
aspect.people.include?(friend_2).should be true
|
||||
aspect.people.size.should == 2
|
||||
aspect.people << user2.person
|
||||
aspect.people << friend_2
|
||||
aspect.save.should be_true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -10,18 +10,22 @@ describe Comment do
|
|||
|
||||
let(:user2) {Factory.create(:user)}
|
||||
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
|
||||
status.reload.comments.first.text.should == "Yeah, it was great"
|
||||
describe 'User#comment' do
|
||||
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
|
||||
|
||||
it "should be able to comment on a person's status" do
|
||||
user2.comment "sup dog", :on => status
|
||||
status.reload.comments.first.text.should == "sup dog"
|
||||
user2.comment "sup dog", :on => @status
|
||||
@status.reload.comments.first.text.should == "sup dog"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -42,34 +46,32 @@ describe Comment do
|
|||
@person_status = Factory.build(:status_message, :person => @person)
|
||||
|
||||
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
|
||||
user.reload
|
||||
end
|
||||
|
||||
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")
|
||||
|
||||
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.post_creator_signature = comment.sign_with_key(user.encryption_key)
|
||||
|
||||
xml = user.salmon(comment).xml_for(user2)
|
||||
|
||||
user3.person.delete
|
||||
user3.delete
|
||||
|
||||
|
||||
user_status.reload
|
||||
user_status.comments.should == []
|
||||
user.receive_salmon(xml)
|
||||
user_status.reload
|
||||
user_status.comments.include?(comment).should be true
|
||||
@user_status.reload
|
||||
@user_status.comments.should == []
|
||||
user2.receive_salmon(xml)
|
||||
@user_status.reload
|
||||
@user_status.comments.include?(comment).should be true
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
User::QUEUE.should_receive(:add_post_request).twice
|
||||
user.comment "yo", :on => user_status
|
||||
user.comment "yo", :on => @user_status
|
||||
end
|
||||
|
||||
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.receive comment.to_diaspora_xml, @person
|
||||
end
|
||||
|
||||
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.receive comment.to_diaspora_xml, user2.person
|
||||
end
|
||||
|
|
@ -108,13 +110,13 @@ describe Comment do
|
|||
end
|
||||
|
||||
it 'should not clear the aspect post array on receiving a comment' do
|
||||
aspect.post_ids.include?(user_status.id).should be true
|
||||
comment = Comment.new(:person_id => @person.id, :text => "balls", :post => user_status)
|
||||
aspect.post_ids.include?(@user_status.id).should be true
|
||||
comment = Comment.new(:person_id => @person.id, :text => "balls", :post => @user_status)
|
||||
|
||||
user.receive comment.to_diaspora_xml, @person
|
||||
|
||||
aspect.reload
|
||||
aspect.post_ids.include?(user_status.id).should be true
|
||||
aspect.post_ids.include?(@user_status.id).should be true
|
||||
end
|
||||
end
|
||||
describe 'serialization' do
|
||||
|
|
@ -27,7 +27,7 @@ describe User do
|
|||
status_message.destroy
|
||||
|
||||
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
|
||||
|
||||
it 'should not create new aspects on message receive' do
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ describe User do
|
|||
let(:aspect) { user.aspect(:name => 'heroes') }
|
||||
let(:user2) { Factory(:user) }
|
||||
let(:aspect2) { user2.aspect(:name => 'stuff') }
|
||||
let(:user3) { Factory(:user) }
|
||||
let(:aspect3) { user3.aspect(:name => 'stuff') }
|
||||
|
||||
describe "validation" do
|
||||
describe "of associated person" do
|
||||
|
|
@ -103,6 +101,7 @@ describe User do
|
|||
end
|
||||
it "makes a valid user" do
|
||||
@user.should be_valid
|
||||
@user.persisted?.should be_false
|
||||
User.find_by_username("ohai").should be_nil
|
||||
end
|
||||
it 'saves successfully' do
|
||||
|
|
@ -143,13 +142,13 @@ describe User do
|
|||
|
||||
context 'profiles' do
|
||||
it 'should be able to update their profile and send it to their friends' do
|
||||
updated_profile = {:profile => {
|
||||
updated_profile = {
|
||||
:first_name => 'bob',
|
||||
:last_name => 'billytown',
|
||||
:image_url => "http://clown.com"}}
|
||||
:image_url => "http://clown.com"}
|
||||
|
||||
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
|
||||
|
||||
|
|
@ -167,12 +166,7 @@ describe User do
|
|||
end
|
||||
end
|
||||
|
||||
context 'account removal' do
|
||||
before do
|
||||
friend_users(user, aspect, user2, aspect2)
|
||||
friend_users(user, aspect, user3, aspect3)
|
||||
end
|
||||
|
||||
describe 'account removal' do
|
||||
it 'should unfriend everyone' do
|
||||
user.should_receive(:unfriend_everyone)
|
||||
user.destroy
|
||||
|
|
@ -184,11 +178,8 @@ describe User do
|
|||
end
|
||||
|
||||
it 'should remove all aspects' do
|
||||
aspects = user.aspects
|
||||
aspects.count.should > 0
|
||||
user.destroy
|
||||
aspects.reload
|
||||
aspects.count.should == 0
|
||||
aspect
|
||||
lambda {user.destroy}.should change{user.aspects.reload.count}.by(-1)
|
||||
end
|
||||
|
||||
describe '#remove_person' do
|
||||
|
|
@ -208,20 +199,18 @@ describe User do
|
|||
end
|
||||
|
||||
describe '#unfriend_everyone' do
|
||||
before do
|
||||
user3.delete
|
||||
end
|
||||
|
||||
it 'should send retractions to remote poeple' do
|
||||
user2.delete
|
||||
user.activate_friend(user2.person, aspect)
|
||||
|
||||
user.should_receive(:unfriend).once
|
||||
user.destroy
|
||||
end
|
||||
|
||||
it 'should unfriend local people' do
|
||||
user2.friends.count.should be 1
|
||||
user.destroy
|
||||
user2.reload
|
||||
user2.friends.count.should be 0
|
||||
friend_users(user, aspect, user2, aspect2)
|
||||
lambda {user.destroy}.should change{user2.reload.friends.count}.by(-1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue