remove unused files/methods

This commit is contained in:
danielgrippi 2012-01-11 02:26:12 -08:00
parent 0e5bb81d66
commit bee8aa8bcd
44 changed files with 14 additions and 599 deletions

View file

@ -30,11 +30,9 @@ class ApplicationController < ActionController::Base
# we need to do this for vanna controller. these should really be controller
# helper methods instead
def set_header_data
if user_signed_in?
if request.format.html? && !params[:only_posts]
@notification_count = Notification.for(current_user, :unread =>true).count
@unread_message_count = ConversationVisibility.sum(:unread, :conditions => "person_id = #{current_user.person.id}")
end
if user_signed_in? && request.format.html? && !params[:only_posts]
@notification_count = Notification.for(current_user, :unread =>true).count
@unread_message_count = ConversationVisibility.sum(:unread, :conditions => "person_id = #{current_user.person.id}")
end
end
@ -142,12 +140,7 @@ class ApplicationController < ActionController::Base
def default_stream_action(stream_klass)
@stream = stream(stream_klass)
if params[:only_posts]
render :partial => 'shared/stream', :locals => {:posts => @stream.stream_posts}
else
render 'aspects/index'
end
render 'aspects/index'
end
def max_time

View file

@ -14,20 +14,13 @@ class AspectsController < ApplicationController
:json
def index
@backbone = true
stream_klass = Stream::Aspect
aspect_ids = (session[:a_ids] ? session[:a_ids] : [])
@stream = Stream::Aspect.new(current_user, aspect_ids,
:max_time => params[:max_time].to_i)
respond_with do |format|
format.html do
if params[:only_posts]
render :partial => 'shared/stream', :locals => {:posts => @stream.stream_posts}
else
render 'aspects/index'
end
end
format.html { render 'aspects/index' }
format.json{ render_for_api :backbone, :json => @stream.stream_posts, :root => :posts }
end
end

View file

@ -9,7 +9,6 @@ class CommentStreamController < ApplicationController
respond_to :html, :json
def index
@backbone = true
stream_klass = Stream::Comments
respond_with do |format|

View file

@ -6,7 +6,7 @@ class HomeController < ApplicationController
def show
if current_user
redirect_to multi_path
redirect_to multi_path if current_user
elsif is_mobile_device?
redirect_to user_session_path
else
@ -16,11 +16,7 @@ class HomeController < ApplicationController
end
def toggle_mobile
if session[:mobile_view]
session[:mobile_view] = false
else
session[:mobile_view] = true
end
session[:mobile_view] = !session[:mobile_view]
redirect_to :back
end
end

View file

@ -9,7 +9,6 @@ class LikeStreamController < ApplicationController
respond_to :html, :json
def index
@backbone = true
stream_klass = Stream::Likes
respond_with do |format|

View file

@ -9,7 +9,6 @@ class MentionsController < ApplicationController
respond_to :html, :json
def index
@backbone = true
stream_klass = Stream::Mention
respond_with do |format|

View file

@ -9,7 +9,6 @@ class MultisController < ApplicationController
respond_to :html, :json
def index
@backbone = true
stream_klass = Stream::Multi
respond_with do |format|

View file

@ -84,8 +84,6 @@ class PeopleController < ApplicationController
end
def show
@backbone = true
@person = Person.find_from_id_or_username(params)
if remote_profile_with_no_user_session?
@ -125,15 +123,9 @@ class PeopleController < ApplicationController
end
end
if params[:only_posts]
respond_to do |format|
format.html{ render :partial => 'shared/stream', :locals => {:posts => @stream.stream_posts} }
end
else
respond_to do |format|
format.all { respond_with @person, :locals => {:post_type => :all} }
format.json{ render_for_api :backbone, :json => @stream.stream_posts, :root => :posts }
end
respond_to do |format|
format.all { respond_with @person, :locals => {:post_type => :all} }
format.json{ render_for_api :backbone, :json => @stream.stream_posts, :root => :posts }
end
end

View file

@ -10,7 +10,6 @@ class TagFollowingsController < ApplicationController
respond_to :html, :json
def index
@backbone = true
stream_klass = Stream::FollowedTag
respond_with do |format|
@ -23,7 +22,7 @@ class TagFollowingsController < ApplicationController
# POST /tag_followings.xml
def create
name_normalized = ActsAsTaggableOn::Tag.normalize(params['name'])
if name_normalized.nil? || name_normalized.empty?
flash[:error] = I18n.t('tag_followings.create.none')
else

View file

@ -33,17 +33,9 @@ class TagsController < ApplicationController
end
def show
@backbone = true
@stream = Stream::Tag.new(current_user, params[:name], :max_time => max_time, :page => params[:page])
respond_with do |format|
format.html do
if params[:only_posts]
render :partial => 'shared/stream', :locals => {:posts => @stream.stream_posts}
return
end
end
format.json{ render_for_api :backbone, :json => @stream.stream_posts, :root => :posts }
end
end

View file

@ -3,7 +3,6 @@
# the COPYRIGHT file.
module ApplicationHelper
def how_long_ago(obj)
timeago(obj.created_at)
end
@ -17,29 +16,6 @@ module ApplicationHelper
"javascript:(function(){f='#{AppConfig[:pod_url]}bookmarklet?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&notes='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=1&';a=function(){if(!window.open(f+'noui=1&jump=doclose','diasporav1','location=yes,links=no,scrollbars=no,toolbar=no,width=620,height=250'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()"
end
def object_fields(object)
object.attributes.keys
end
def type_partial(post)
class_name = post.class.name.to_s.underscore
"#{class_name.pluralize}/#{class_name}"
end
def hard_link(string, path)
link_to string, path, :rel => 'external'
end
def post_yield_tag(post)
(':' + post.id.to_s).to_sym
end
def info_text(text)
image_tag 'icons/monotone_question.png', :class => 'what_is_this', :title => text
end
def get_javascript_strings_for(language)
defaults = I18n.t('javascripts', :locale => DEFAULT_LANGUAGE)

View file

@ -9,25 +9,6 @@ module AspectGlobalHelper
end
end
def aspect_badges(aspects, opts={})
str = ''
aspects.each do |aspect|
str << aspect_badge(aspect, opts)
end
str.html_safe
end
def aspect_badge(aspect, opts={})
str = "<span class='aspect_badge single'>"
link = opts.delete(:link)
if !link
str << link_to(aspect.name, "#", 'data-guid' => aspect.id).html_safe
else
str << link_for_aspect(aspect).html_safe
end
str << "</span>"
end
def aspect_links(aspects, opts={})
str = ""
aspects.each do |aspect|
@ -79,7 +60,7 @@ LISTITEM
def dropdown_may_create_new_aspect
@aspect == :profile || @aspect == :tag || @aspect == :search || @aspect == :notification || params[:action] == "getting_started"
end
def aspect_options_for_select(aspects)
options = {}
aspects.each do |aspect|

View file

@ -1,49 +0,0 @@
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
module CommentsHelper
GSUB_THIS = "FIUSDHVIUSHDVIUBAIUHAPOIUXJM"
def comment_toggle(post, commenting_disabled=false)
if post.comments.size <= 3
link_to "#{t('stream_helper.hide_comments')}", post_comments_path(post.id), :class => "toggle_post_comments"
elsif ! user_signed_in?
link_to "#{t('stream_helper.show_comments', :count => post.comments.size - 3)}", post_path(post.id, :all_comments => '1'), :class => "toggle_post_comments"
else
link_to "#{t('stream_helper.show_comments', :count => post.comments.size - 3)}", post_comments_path(post.id), :class => "toggle_post_comments"
end
end
# This method memoizes the new comment form in order to avoid the overhead of rendering it on every post.
# @param [Integer] post_id The id of the post that this form should post to.
# @param [User] current_user
# @return [String] The HTML for the new comment form.
def new_comment_form(post_id, current_user)
@form ||= controller.render_to_string(
:partial => 'comments/new_comment', :locals => {:post_id => GSUB_THIS, :current_user => current_user})
@form.gsub(GSUB_THIS, post_id.to_s).html_safe
end
def comment_form_wrapper_class(post)
if post.comments.empty? && request && request.format != 'mobile'
'hidden'
else
nil
end
end
def commenting_disabled?(post)
return true unless user_signed_in?
if defined?(@commenting_disabled)
@commenting_disabled
elsif defined?(@stream)
!@stream.can_comment?(post)
else
false
end
end
def all_comments?
!! params['all_comments']
end
end

View file

@ -3,21 +3,6 @@
# the COPYRIGHT file.
module GettingStartedHelper
# @return [Boolean] The user has connected at least one service
def has_connected_services?
AppConfig[:configured_services].blank? || current_user.services.size > 0
end
# @return [Boolean] The user has at least 3 contacts
def has_few_contacts?
current_user.contacts.receiving.size > 2
end
# @return [Boolean] The user has followed at least 3 tags
def has_few_followed_tags?
current_user.followed_tags.size > 2
end
# @return [Boolean] The user has connected to cubbi.es
def has_connected_cubbies?
current_user.authorizations.size > 0

View file

@ -17,10 +17,6 @@ module LayoutHelper
current_user ? current_user.name : t("application.helper.diaspora_alpha")
end
def show_title?
@show_title
end
def stylesheet(*args)
content_for(:head) { stylesheet_link_tag(*args) }
end
@ -28,12 +24,4 @@ module LayoutHelper
def javascript(*args)
content_for(:head) { javascript_include_tag(*args) }
end
def new_notification_text(count)
t('notifications.helper.new_notifications', :count => count)
end
def new_message_text(count)
t('conversations.helper.new_messages', :count => count)
end
end

View file

@ -1,29 +0,0 @@
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
module LikesHelper
def likes_list(likes)
links = likes.collect { |like| link_to "#{h(like.author.name.titlecase)}", local_or_remote_person_path(like.author) }
links.join(", ").html_safe
end
def like_action(target, current_user=current_user)
if target.instance_of?(Comment)
if current_user.liked?(target)
link_to t('shared.stream_element.unlike'), comment_like_path(target, current_user.like_for(target)), :method => :delete, :class => 'unlike', :remote => true
else
link_to t('shared.stream_element.like'), comment_likes_path(target, :positive => 'true'), :method => :post, :class => 'like', :remote => true
end
else
if current_user.liked?(target)
link_to t('shared.stream_element.unlike'), post_like_path(target, current_user.like_for(target)), :method => :delete, :class => 'unlike', :remote => true
else
link_to t('shared.stream_element.like'), post_likes_path(target, :positive => 'true'), :method => :post, :class => 'like', :remote => true
end
end
end
end

View file

@ -5,7 +5,7 @@ module NotificationsHelper
include PeopleHelper
include UsersHelper
include ApplicationHelper
def object_link(note, actors)
target_type = note.popup_translation_key
actors_count = note.actors.count
@ -32,13 +32,6 @@ module NotificationsHelper
t("#{target_type}", opts).html_safe
end
def new_notification_link(count)
if count > 0
link_to new_notification_text(count), notifications_path
end
end
def notification_people_link(note, people=nil)
actors =people || note.actors
number_of_actors = actors.count

View file

@ -1,7 +0,0 @@
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
module PhotosHelper
end

View file

@ -1,35 +0,0 @@
module ResharesHelper
def reshare_error_message(reshare)
if @reshare.errors[:root_guid].present?
escape_javascript(@reshare.errors[:root_guid].first)
else
escape_javascript(t('reshares.create.failure'))
end
end
def resharable?(post)
if reshare?(post)
# Reshare post is resharable if you're not the original author nor the resharer
post.root.present? && post.root.author_id != current_user.person.id && post.author_id != current_user.person.id
else
post.author_id != current_user.person.id && post.public?
end
end
def reshare_link(post)
if reshare?(post)
return unless post.root
link_to t("reshares.reshare.reshare_original"),
reshares_path(:root_guid => post.root.guid),
:method => :post,
:remote => true,
:confirm => t('reshares.reshare.reshare_confirmation', :author => post.root.author.name)
else
link_to t('shared.reshare.reshare'),
reshares_path(:root_guid => post.guid),
:method => :post,
:remote => true,
:confirm => t('reshares.reshare.reshare_confirmation', :author => post.author.name)
end
end
end

View file

@ -1,6 +0,0 @@
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
module StatusMessagesHelper
end

View file

@ -1,27 +0,0 @@
module StreamElementHelper
def block_user_control(author)
if user_signed_in? && current_user.person.id != author.id
link_to image_tag('icons/ignoreuser.png'), blocks_path(:block => {:person_id => author.id}),
:class => 'block_user control_icon',
:confirm => t('.ignore_user_description'),
:title => t('.ignore_user', :name => author.first_name),
:method => :post
end
end
def delete_or_hide_button(post)
if user_signed_in? && current_user.owns?(post)
link_to image_tag('deletelabel.png'), post_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete control_icon remove_post", :title => t('delete')
else
link_to image_tag('deletelabel.png'), share_visibility_path(:id => "42", :post_id => post.id), :method => :put, :remote => true, :class => "delete remove_post control_icon vis_hide", :title => t('.hide_and_mute')
end
end
def nsfw_sheild(post)
if post.respond_to?(:nsfw?) && post.nsfw?
content_tag(:div, :class => 'shield') do
I18n.translate('shared.stream_element.nsfw', :link => link_to(I18n.translate('shared.stream_element.show'), '#')).html_safe
end
end
end
end

View file

@ -39,14 +39,6 @@ module StreamHelper
end
end
def time_for_sort(post)
post.created_at
end
def comments_expanded
false
end
def reshare?(post)
post.instance_of?(Reshare)
end

View file

@ -1,2 +0,0 @@
module TagFollowingsHelper
end

View file

@ -8,7 +8,6 @@ if( $("#no_contacts").is(':visible') ) {
$("#no_contacts").fadeOut(200);
}
$(".badges").prepend("<%= escape_javascript( aspect_badge(@aspect).html_safe ) %>");
element.parent().html("<%= escape_javascript(render('aspect_memberships/add_to_aspect', :aspect_id => @aspect.id, :person_id => @person.id)) %>");
if($('#aspects_list').length == 1) {

View file

@ -10,13 +10,7 @@
#gs-shim{:title => popover_with_close_html("3. #{t('.stay_updated')}"), 'data-content' => t('.stay_updated_explanation')}
#main_stream.stream{:data => {:guids => stream.aspect_ids.join(','), :time_for_scroll => (@backbone ? '' : time_for_scroll(stream.ajax_stream?, stream))}}
- if !@backbone && !stream.ajax_stream? && stream.stream_posts.length > 0
= render 'shared/stream', :posts => stream.stream_posts
- if !@backbone
#pagination
=link_to(t('more'), next_page_path(:ajax_stream => stream.ajax_stream?), :class => 'paginate')
#main_stream.stream{:data => {:guids => stream.aspect_ids.join(',')}}
- if current_user.contacts.size < 2
= render 'aspects/no_contacts_message'

View file

@ -55,7 +55,6 @@
= render 'aspects/aspect_stream', :stream => @stream
.span-5.rightBar.last
/= render 'aspects/selected_contacts', :stream => @stream
#selected_aspect_contacts.section
.title.no_icon
%h5.stream_title

View file

@ -1,3 +0,0 @@
$('#aspect_stream_container').html("<%= escape_javascript(render('aspects/aspect_stream', :stream => @stream)) %>");
$('#selected_aspect_contacts').html("<%= escape_javascript(render('aspects/selected_contacts', :people => @stream.people.sample(20), :count => @stream.people.size)) %>");
$('#aspect_stream_container a[rel*=facebox]').facebox();

View file

@ -1,28 +0,0 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
%li.comment.posted{:id => comment.guid, :class => ("hidden" if(defined? hidden))}
- if current_user && (current_user.owns?(comment) || current_user.owns?(post))
.right.controls
= link_to image_tag('deletelabel.png'), post_comment_path(comment.commentable_id, comment), :class => "delete comment_delete", :title => t('delete')
= person_image_link(comment.author, :size => :thumb_small)
.content
%span.from
= person_link(comment.author, :class => "hovercardable")
%span{:class => [direction_for(comment.text), 'collapsible']}
= markdownify(comment, :oembed => true)
.comment_info
%time.timeago{:datetime => comment.created_at}
= comment.created_at ? timeago(comment.created_at) : timeago(Time.now)
.likes
.likes_container
= render "likes/likes_container", :target_id => comment.id, :likes_count => comment.likes_count, :target_type => "Comment"
- unless commenting_disabled?(post)
%span.like_action
= like_action(comment, current_user)

View file

@ -1,18 +0,0 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
.comment_stream
- unless comments_expanded || all_comments?
%ul.show_comments{:class => ("hidden" if post.comments.size <= 3)}
%li
= comment_toggle( post)
%ul.comments{:class => ('loaded' if post.comments.size <= 3)}
-if post.comments.size > 3 && !comments_expanded && ! all_comments?
= render :partial => 'comments/comment', :collection => post.comments.including_author.last(3), :locals => {:post => post}
-else
= render :partial => 'comments/comment', :collection => post.comments.including_author, :locals => {:post => post}
- unless commenting_disabled?(post)
.new_comment_form_wrapper{:class => comment_form_wrapper_class(post)}
= new_comment_form(post.id, current_user)

View file

@ -1,12 +0,0 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
= form_tag( post_comments_path(post_id), :id => "new_comment_on_#{post_id}", :class => 'new_comment', :remote => true) do
= person_image_tag(current_user)
%p
= label_tag "comment_text_on_#{post_id}", t('.comment')
= text_area_tag :text, nil, :rows => 2, :class => "comment_box",:id => "comment_text_on_#{post_id}"
.submit_button
= submit_tag t('.comment'), :id => "comment_submit_#{post_id}", :class => "comment_submit button creation", :disable_with => t('.commenting')

View file

@ -1,5 +0,0 @@
App.stream.collection.get(<%= @comment.post.id %>);
ContentUpdater.addCommentToPost("<%= @comment.post.guid %>",
"<%= @comment.guid%>",
"<%= escape_javascript(render(:partial => 'comments/comment', :locals => { :comment => @comment, :person => current_user.person, :post => @comment.post}))%>");

View file

@ -1 +0,0 @@
= render :partial => 'comments/comment', :collection => @comments, :locals => {:post => @post}

View file

@ -32,10 +32,6 @@
= render 'photos/index', :photos => @posts
- else
#main_stream.stream
- if !@backbone
= render 'shared/stream', :posts => @stream.stream_posts
#pagination
=link_to(t('more'), next_page_path, :class => 'paginate')
- else
#main_stream

View file

@ -1,26 +0,0 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
.reshare
- if post
= person_image_link(post.author, :size => :thumb_small)
.content
.post_initial_info
%span.from
= person_link(post.author, :class => "hovercardable")
%span.details
%span.timeago
= link_to(how_long_ago(post), post_path(post))
= t("reshares.reshare.reshare", :count => post.reshares_count)
- if post.activity_streams?
= link_to image_tag(post.image_url, 'data-small-photo' => post.image_url, 'data-full-photo' => post.image_url, :class => 'stream-photo'), post.object_url, :class => "stream-photo-link"
- else
= render 'status_messages/status_message', :post => post, :photos => post.photos
- else
= t('.deleted')

View file

@ -1,24 +0,0 @@
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
- begin
- if photos.size > 0
.photo_attachments
.big_stream_photo
= link_to (image_tag photos.first.url(:scaled_full), :class => "stream-photo", 'data-small-photo' => photos.first.url(:thumb_medium), 'data-full-photo' => photos.first.url), photo_path(photos.first), :class => "stream-photo-link"
- if photos.size > 1
- if photos.size >= 8
- for photo in photos[1..8]
= link_to (image_tag photo.url(:thumb_small), :class => 'stream-photo thumb_small', 'data-small-photo' => photo.url(:thumb_medium), 'data-full-photo' => photo.url), photo_path(photo), :class => 'stream-photo-link'
- else
- for photo in photos[1..photos.size]
= link_to (image_tag photo.url(:thumb_small), :class => 'stream-photo thumb_small', 'data-small-photo' => photo.url(:thumb_medium), 'data-full-photo' => photo.url), photo_path(photo), :class => 'stream-photo-link'
- rescue
- nil
%div{:class => [direction_for(post.text), 'collapsible']}
!= markdownify(post)
- if post.o_embed_cache_id.present?
= o_embed_html(post.o_embed_cache)

View file

@ -67,11 +67,4 @@
%hr
#main_stream.stream
- if !@backbone
- if @stream.stream_posts.length > 0
= render 'shared/stream', :posts => @stream.stream_posts
#pagination
=link_to(t('more'), next_page_path, :class => 'paginate')
- else
= t('.nobody_talking', :tag => @stream.display_tag_name)

View file

@ -36,11 +36,6 @@ describe AspectsController do
end
describe "#index" do
it 'renders just the stream with the infinite scroll param set' do
get :index, :only_posts => true
response.should render_template('shared/_stream')
end
it 'assigns an Stream::Aspect' do
get :index
assigns(:stream).class.should == Stream::Aspect

View file

@ -1,26 +0,0 @@
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
describe CommentsController do
describe '#index' do
before do
sign_in :user, alice
end
it 'generates a jasmine fixture', :fixture => true do
aspect_to_post = bob.aspects.where(:name => "generic").first
message = bob.post(:status_message, :text => "hey", :to => aspect_to_post.id)
2.times do
alice.comment("hey", :post => message)
end
get :index, :post_id => message.id
save_fixture(response.body, "ajax_comments_on_post")
end
end
end

View file

@ -10,7 +10,6 @@ describe ApplicationHelper do
@person = Factory.create(:person)
end
describe "#contacts_link" do
before do
def current_user

View file

@ -1,23 +0,0 @@
require 'spec_helper'
describe CommentsHelper do
describe '.new_comment_form' do
before do
@user = alice
@aspect = @user.aspects.first
@post = @user.post(:status_message, :text => "hi", :to => @aspect.id)
end
it 'renders a new comment form' do
new_comment_form(@post.id, @user).should ==
@controller.render_to_string(:partial => 'comments/new_comment',
:locals => {:post_id => @post.id, :current_user => @user})
end
it 'renders it fast the second time' do
new_comment_form(@post.id, @user)
time = Benchmark.realtime{
new_comment_form(@post.id, @user)
}
(time*1000).should < 1
end
end
end

View file

@ -12,56 +12,6 @@ describe GettingStartedHelper do
@current_user
end
describe "#has_connected_services?" do
before do
AppConfig[:configured_services] = ['fake_service']
end
it 'returns true if the current user has connected at least one service' do
@current_user.services << Factory.build(:service)
has_connected_services?.should be_true
end
it 'returns true if the current user has zero connected services and the server has no services configured' do
AppConfig[:configured_services] = []
@current_user.services.delete_all
has_connected_services?.should be_true
end
it 'returns false if the current user has not connected any service' do
@current_user.services.delete_all
has_connected_services?.should be_false
end
end
describe "#has_few_contacts?" do
it 'returns true if the current_user has more than 2 contacts' do
3.times do |n|
@current_user.contacts << Contact.new(:person => Factory(:person), :receiving => true)
end
has_few_contacts?.should be_true
end
it 'returns false if the current_user has less than 2 contacts (inclusive)' do
@current_user.contacts.destroy_all
has_few_contacts?.should be_false
end
end
describe "has_few_followed_tags?" do
it 'returns true if the current_user has more than 2 contacts' do
3.times do |n|
@current_user.followed_tags << ActsAsTaggableOn::Tag.new(:name => "poodles_#{n}")
end
has_few_followed_tags?.should be_true
end
it 'returns false if the current_user has less than 2 contacts (inclusive)' do
@current_user.followed_tags.delete_all
has_few_followed_tags?.should be_false
end
end
describe "#has_connected_cubbies?" do
it 'returns true if the current user has connected cubbies to their account' do
@current_user.authorizations << Factory(:oauth_authorization)

View file

@ -1,8 +0,0 @@
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
#require 'spec_helper'
describe PhotosHelper do
end

View file

@ -1,50 +0,0 @@
require 'spec_helper'
describe ResharesHelper do
include StreamHelper
describe 'reshare_link' do
it 'does not display a reshare for a post that does not exist' do
reshare = Factory.build(:reshare, :root => nil)
lambda {
reshare_link(reshare)
}.should_not raise_error
end
describe 'for a typical post' do
before :each do
aspect = alice.aspects.first
@post = alice.build_post :status_message, :text => "ohai", :to => aspect.id, :public => true
@post.save!
alice.add_to_streams(@post, [aspect])
alice.dispatch_post @post, :to => aspect.id
end
describe 'which has not been reshared' do
before :each do
@post.reshares_count.should == 0
end
it 'has "Reshare" as the English text' do
reshare_link(@post).should =~ %r{>Reshare</a>}
end
end
describe 'which has been reshared' do
before :each do
@reshare = Factory.create(:reshare, :root => @post)
@post.reload
@post.reshares_count.should == 1
end
it 'has "Reshare" as the English text' do
reshare_link(@post).should =~ %r{>Reshare</a>}
end
it 'its reshare has "Reshare original" as the English text' do
reshare_link(@reshare).should =~ %r{>Reshare original</a>}
end
end
end
end
end

View file

@ -9,13 +9,6 @@ describe StreamHelper do
@post = Factory(:status_message)
end
describe "#time_for_sort" do
it "returns post.created_at" do
stub!(:controller).and_return(mock())
time_for_sort(@post).should == @post.created_at
end
end
describe '#next_page_path' do
it 'works for apps page' do
stub!(:controller).and_return(AppsController.new)