use aspect dropdowns everywhere; updated rake to 0.9.0
This commit is contained in:
parent
1e3971da3d
commit
16351227f7
18 changed files with 38 additions and 205 deletions
34
Gemfile.lock
34
Gemfile.lock
|
|
@ -68,7 +68,6 @@ GEM
|
||||||
Platform (>= 0.4.0)
|
Platform (>= 0.4.0)
|
||||||
open4
|
open4
|
||||||
Platform (0.4.0)
|
Platform (0.4.0)
|
||||||
SystemTimer (1.2.1)
|
|
||||||
abstract (1.0.0)
|
abstract (1.0.0)
|
||||||
actionmailer (3.0.3)
|
actionmailer (3.0.3)
|
||||||
actionpack (= 3.0.3)
|
actionpack (= 3.0.3)
|
||||||
|
|
@ -97,6 +96,7 @@ GEM
|
||||||
activesupport (= 3.0.3)
|
activesupport (= 3.0.3)
|
||||||
activesupport (3.0.3)
|
activesupport (3.0.3)
|
||||||
addressable (2.2.2)
|
addressable (2.2.2)
|
||||||
|
archive-tar-minitar (0.5.2)
|
||||||
arel (2.0.9)
|
arel (2.0.9)
|
||||||
aws (2.3.32)
|
aws (2.3.32)
|
||||||
activesupport
|
activesupport
|
||||||
|
|
@ -123,7 +123,6 @@ GEM
|
||||||
selenium-webdriver (>= 0.0.3)
|
selenium-webdriver (>= 0.0.3)
|
||||||
carrierwave (0.5.2)
|
carrierwave (0.5.2)
|
||||||
activesupport (~> 3.0)
|
activesupport (~> 3.0)
|
||||||
cgi_multipart_eof_fix (2.5.0)
|
|
||||||
chalofa_ruby-progressbar (0.0.9.1)
|
chalofa_ruby-progressbar (0.0.9.1)
|
||||||
chef (0.9.12)
|
chef (0.9.12)
|
||||||
bunny (>= 0.6.0)
|
bunny (>= 0.6.0)
|
||||||
|
|
@ -182,7 +181,6 @@ GEM
|
||||||
faraday_middleware (0.3.2)
|
faraday_middleware (0.3.2)
|
||||||
faraday (~> 0.5.4)
|
faraday (~> 0.5.4)
|
||||||
fastercsv (1.5.4)
|
fastercsv (1.5.4)
|
||||||
fastthread (1.0.7)
|
|
||||||
ffi (0.6.3)
|
ffi (0.6.3)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
fixture_builder (0.2.2)
|
fixture_builder (0.2.2)
|
||||||
|
|
@ -201,7 +199,6 @@ GEM
|
||||||
chalofa_ruby-progressbar (~> 0.0.9)
|
chalofa_ruby-progressbar (~> 0.0.9)
|
||||||
rspec (~> 2.0)
|
rspec (~> 2.0)
|
||||||
rspec-instafail (~> 0.1.4)
|
rspec-instafail (~> 0.1.4)
|
||||||
gem_plugin (0.2.3)
|
|
||||||
gherkin (2.3.8)
|
gherkin (2.3.8)
|
||||||
json (>= 1.4.6)
|
json (>= 1.4.6)
|
||||||
haml (3.0.25)
|
haml (3.0.25)
|
||||||
|
|
@ -223,7 +220,8 @@ GEM
|
||||||
launchy (0.4.0)
|
launchy (0.4.0)
|
||||||
configuration (>= 0.0.5)
|
configuration (>= 0.0.5)
|
||||||
rake (>= 0.8.1)
|
rake (>= 0.8.1)
|
||||||
linecache (0.43)
|
linecache19 (0.5.12)
|
||||||
|
ruby_core_source (>= 0.1.4)
|
||||||
mail (2.2.19)
|
mail (2.2.19)
|
||||||
activesupport (>= 2.3.6)
|
activesupport (>= 2.3.6)
|
||||||
i18n (>= 0.4.0)
|
i18n (>= 0.4.0)
|
||||||
|
|
@ -238,11 +236,6 @@ GEM
|
||||||
mixlib-config (1.1.2)
|
mixlib-config (1.1.2)
|
||||||
mixlib-log (1.3.0)
|
mixlib-log (1.3.0)
|
||||||
moneta (0.6.0)
|
moneta (0.6.0)
|
||||||
mongrel (1.1.5)
|
|
||||||
cgi_multipart_eof_fix (>= 2.4)
|
|
||||||
daemons (>= 1.0.3)
|
|
||||||
fastthread (>= 1.0.1)
|
|
||||||
gem_plugin (>= 0.2.3)
|
|
||||||
multi_json (0.0.5)
|
multi_json (0.0.5)
|
||||||
multi_xml (0.2.2)
|
multi_xml (0.2.2)
|
||||||
multipart-post (1.1.1)
|
multipart-post (1.1.1)
|
||||||
|
|
@ -321,7 +314,7 @@ GEM
|
||||||
activesupport (= 3.0.3)
|
activesupport (= 3.0.3)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (~> 0.14.4)
|
thor (~> 0.14.4)
|
||||||
rake (0.8.7)
|
rake (0.9.0)
|
||||||
rcov (0.9.9)
|
rcov (0.9.9)
|
||||||
redis (2.2.0)
|
redis (2.2.0)
|
||||||
redis-namespace (0.8.0)
|
redis-namespace (0.8.0)
|
||||||
|
|
@ -347,15 +340,20 @@ GEM
|
||||||
activesupport (~> 3.0)
|
activesupport (~> 3.0)
|
||||||
railties (~> 3.0)
|
railties (~> 3.0)
|
||||||
rspec (~> 2.6.0)
|
rspec (~> 2.6.0)
|
||||||
ruby-debug (0.10.4)
|
ruby-debug-base19 (0.11.25)
|
||||||
columnize (>= 0.1)
|
columnize (>= 0.3.1)
|
||||||
ruby-debug-base (~> 0.10.4.0)
|
linecache19 (>= 0.5.11)
|
||||||
ruby-debug-base (0.10.4)
|
ruby_core_source (>= 0.1.4)
|
||||||
linecache (>= 0.3)
|
ruby-debug19 (0.11.6)
|
||||||
|
columnize (>= 0.3.1)
|
||||||
|
linecache19 (>= 0.5.11)
|
||||||
|
ruby-debug-base19 (>= 0.11.19)
|
||||||
ruby-hmac (0.4.0)
|
ruby-hmac (0.4.0)
|
||||||
ruby-openid (2.1.8)
|
ruby-openid (2.1.8)
|
||||||
ruby-openid-apps-discovery (1.2.0)
|
ruby-openid-apps-discovery (1.2.0)
|
||||||
ruby-openid (>= 2.1.7)
|
ruby-openid (>= 2.1.7)
|
||||||
|
ruby_core_source (0.1.5)
|
||||||
|
archive-tar-minitar (>= 0.5.2)
|
||||||
rubyntlm (0.1.1)
|
rubyntlm (0.1.1)
|
||||||
rubyzip (0.9.4)
|
rubyzip (0.9.4)
|
||||||
selenium-client (1.2.18)
|
selenium-client (1.2.18)
|
||||||
|
|
@ -402,7 +400,6 @@ PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
SystemTimer (= 1.2.1)
|
|
||||||
acts-as-taggable-on!
|
acts-as-taggable-on!
|
||||||
addressable (= 2.2.2)
|
addressable (= 2.2.2)
|
||||||
aws (= 2.3.32)
|
aws (= 2.3.32)
|
||||||
|
|
@ -433,7 +430,6 @@ DEPENDENCIES
|
||||||
json (= 1.4.6)
|
json (= 1.4.6)
|
||||||
launchy
|
launchy
|
||||||
mini_magick (= 3.2)
|
mini_magick (= 3.2)
|
||||||
mongrel
|
|
||||||
mysql2 (= 0.2.6)
|
mysql2 (= 0.2.6)
|
||||||
nokogiri
|
nokogiri
|
||||||
ohai (= 0.5.8)
|
ohai (= 0.5.8)
|
||||||
|
|
@ -446,7 +442,7 @@ DEPENDENCIES
|
||||||
rspec (>= 2.0.0)
|
rspec (>= 2.0.0)
|
||||||
rspec-instafail (>= 0.1.7)
|
rspec-instafail (>= 0.1.7)
|
||||||
rspec-rails (>= 2.0.0)
|
rspec-rails (>= 2.0.0)
|
||||||
ruby-debug
|
ruby-debug19
|
||||||
selenium-webdriver (= 0.1.3)
|
selenium-webdriver (= 0.1.3)
|
||||||
sod!
|
sod!
|
||||||
thin (= 1.2.11)
|
thin (= 1.2.11)
|
||||||
|
|
|
||||||
7
Rakefile
7
Rakefile
|
|
@ -9,4 +9,11 @@ require File.expand_path('../config/application', __FILE__)
|
||||||
require 'rake'
|
require 'rake'
|
||||||
require 'resque/tasks'
|
require 'resque/tasks'
|
||||||
|
|
||||||
|
# for rake 0.9.0
|
||||||
|
module Diaspora
|
||||||
|
class Application
|
||||||
|
include Rake::DSL
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
Diaspora::Application.load_tasks
|
Diaspora::Application.load_tasks
|
||||||
|
|
|
||||||
|
|
@ -5,37 +5,6 @@
|
||||||
class ContactsController < ApplicationController
|
class ContactsController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
|
||||||
def new
|
|
||||||
@person = Person.find(params[:person_id])
|
|
||||||
@aspects_with_person = []
|
|
||||||
@aspects_without_person = current_user.aspects
|
|
||||||
@contact = Contact.new
|
|
||||||
render :layout => false
|
|
||||||
end
|
|
||||||
|
|
||||||
def edit
|
|
||||||
@contact = current_user.contacts.unscoped.find(params[:id])
|
|
||||||
@person = @contact.person
|
|
||||||
|
|
||||||
@all_aspects ||= current_user.aspects
|
|
||||||
@aspects_with_person = @contact.aspects || []
|
|
||||||
|
|
||||||
@aspects_without_person = @all_aspects - @aspects_with_person
|
|
||||||
|
|
||||||
render :layout => false
|
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
|
||||||
contact = current_user.contacts.find(params[:id])
|
|
||||||
|
|
||||||
if current_user.disconnect(contact)
|
|
||||||
flash[:notice] = I18n.t('contacts.destroy.success', :name => contact.person.name)
|
|
||||||
else
|
|
||||||
flash[:error] = I18n.t('contacts.destroy.failure', :name => contact.person.name)
|
|
||||||
end
|
|
||||||
redirect_to contact.person
|
|
||||||
end
|
|
||||||
|
|
||||||
def sharing
|
def sharing
|
||||||
@contacts = current_user.contacts.sharing.includes(:aspect_memberships)
|
@contacts = current_user.contacts.sharing.includes(:aspect_memberships)
|
||||||
render :layout => false
|
render :layout => false
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// 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.
|
||||||
|
|
||||||
$('ul.dropdown_list[data-person_id=<%= @person.id %>] .newItem').before("<%= escape_javascript( render('contacts/aspect_dropdown_list_item', :aspect => @aspect, :person => @person, :contact => @contact)) %>");
|
$('ul.dropdown_list[data-person_id=<%= @person.id %>] .newItem').before("<%= escape_javascript( render('aspect_memberships/aspect_dropdown_list_item', :aspect => @aspect, :person => @person, :contact => @contact)) %>");
|
||||||
|
|
||||||
ContactEdit.updateNumber("<%= @person.id %>");
|
ContactEdit.updateNumber("<%= @person.id %>");
|
||||||
$.facebox.close();
|
$.facebox.close();
|
||||||
|
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
|
||||||
-# licensed under the Affero General Public License version 3 or later. See
|
|
||||||
-# the COPYRIGHT file.
|
|
||||||
|
|
||||||
.aspect_list#aspects_list{:data=> {:contact_id=> (contact ? contact.id : nil)}}
|
|
||||||
%ul
|
|
||||||
- for aspect in aspects_with_person
|
|
||||||
= render :partial => 'aspects/aspect_list_item',
|
|
||||||
:locals => {:aspect => aspect, :person => person,
|
|
||||||
:contact => contact}
|
|
||||||
|
|
||||||
- for aspect in aspects_without_person
|
|
||||||
= render :partial => 'aspects/aspect_list_item',
|
|
||||||
:locals => {:aspect => aspect, :person => person,
|
|
||||||
:contact => contact}
|
|
||||||
.add_aspect
|
|
||||||
= form_for(Aspect.new, :remote => true) do |aspect|
|
|
||||||
= aspect.error_messages
|
|
||||||
= aspect.hidden_field :person_id, :value => person.id if person
|
|
||||||
= aspect.hidden_field :contact_id, :value => contact.id if contact
|
|
||||||
= aspect.hidden_field :share_with, :value => true
|
|
||||||
%p
|
|
||||||
= aspect.text_field :name, :style => "display:inline;"
|
|
||||||
%p.checkbox_select
|
|
||||||
= aspect.label :contacts_visible, t('aspects.edit.make_aspect_list_visible')
|
|
||||||
= aspect.check_box :contacts_visible, :checked => true, :default => true
|
|
||||||
.right
|
|
||||||
= aspect.submit t('contacts.share_with_pane.add_new_aspect'), :class => 'button'
|
|
||||||
|
|
||||||
-unless friend_finder ||= false
|
|
||||||
.done
|
|
||||||
.right
|
|
||||||
= link_to t('aspects.aspect_contacts.done_editing'), "#", :class => "button", :onClick => '$.facebox.close();'
|
|
||||||
- if contact.persisted?
|
|
||||||
= link_to t('people.profile_sidebar.remove_contact'), contact, :confirm => t('are_you_sure'), :method => :delete
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
|
||||||
-# licensed under the Affero General Public License version 3 or later. See
|
|
||||||
-# the COPYRIGHT file.
|
|
||||||
.share_with
|
|
||||||
#facebox_header
|
|
||||||
= person_image_link(person, :size => :thumb_small)
|
|
||||||
%h4
|
|
||||||
= t('.share_with', :name => person.name)
|
|
||||||
|
|
||||||
.description
|
|
||||||
= t('.following', :name => person.first_name)
|
|
||||||
|
|
||||||
= render :partial => 'contacts/share_with_list',
|
|
||||||
:locals => {:person => person, :contact => contact,
|
|
||||||
:aspects_with_person => aspects_with_person,
|
|
||||||
:aspects_without_person => aspects_without_person}
|
|
||||||
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
|
||||||
-# licensed under the Affero General Public License version 3 or later. See
|
|
||||||
-# the COPYRIGHT file.
|
|
||||||
|
|
||||||
= render :partial => 'share_with_pane',
|
|
||||||
:locals => {:person => @person,
|
|
||||||
:contact => @contact,
|
|
||||||
:aspects_with_person => @aspects_with_person,
|
|
||||||
:aspects_without_person => @aspects_without_person}
|
|
||||||
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
|
||||||
-# licensed under the Affero General Public License version 3 or later. See
|
|
||||||
-# the COPYRIGHT file.
|
|
||||||
|
|
||||||
= render :partial => 'share_with_pane',
|
|
||||||
:locals => {:person => @person,
|
|
||||||
:contact => @contact,
|
|
||||||
:aspects_with_person => @aspects_with_person,
|
|
||||||
:aspects_without_person => @aspects_without_person}
|
|
||||||
|
|
||||||
|
|
@ -2,9 +2,6 @@
|
||||||
-# 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.
|
||||||
|
|
||||||
/- content_for :head do
|
|
||||||
/ = include_javascripts :aspects
|
|
||||||
|
|
||||||
#aspect_edit_pane
|
#aspect_edit_pane
|
||||||
#facebox_header
|
#facebox_header
|
||||||
.right
|
.right
|
||||||
|
|
@ -26,7 +23,7 @@
|
||||||
= contact.person.diaspora_handle
|
= contact.person.diaspora_handle
|
||||||
|
|
||||||
.right
|
.right
|
||||||
= render 'aspect_dropdown', :contact => contact, :person => contact.person, :hang => 'right'
|
= render 'aspect_memberships/aspect_dropdown', :contact => contact, :person => contact.person, :hang => 'right'
|
||||||
|
|
||||||
%br
|
%br
|
||||||
%div{:style => "text-align:right;"}
|
%div{:style => "text-align:right;"}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
.stream_element{:data=>{:guid => note.id}, :class => "#{note.unread ? 'unread' : ''}"}
|
.stream_element{:data=>{:guid => note.id}, :class => "#{note.unread ? 'unread' : ''}"}
|
||||||
- if note.type == "Notifications::StartedSharing" && contact = current_user.contact_for(note.target)
|
- if note.type == "Notifications::StartedSharing" && contact = current_user.contact_for(note.target)
|
||||||
.right
|
.right
|
||||||
= render 'contacts/aspect_dropdown', :contact => contact, :person => note.target, :hang => 'left'
|
= render 'aspect_memberships/aspect_dropdown', :contact => contact, :person => note.target, :hang => 'left'
|
||||||
|
|
||||||
%span.from
|
%span.from
|
||||||
= notification_people_link(note)
|
= notification_people_link(note)
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
- if person != current_user.person
|
- if person != current_user.person
|
||||||
%hr{:style=>"width:300px;"}
|
%hr{:style=>"width:300px;"}
|
||||||
%br
|
%br
|
||||||
= render 'contacts/aspect_dropdown', :contact => @contact, :person => @person, :hang => 'left'
|
= render 'aspect_memberships/aspect_dropdown', :contact => @contact, :person => @person, :hang => 'left'
|
||||||
%br
|
%br
|
||||||
%br
|
%br
|
||||||
-if contact.sharing? || person == current_user.person
|
-if contact.sharing? || person == current_user.person
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
- unless person == current_user.person
|
- unless person == current_user.person
|
||||||
- contact = current_user.contacts.find_by_person_id(person.id)
|
- contact = current_user.contacts.find_by_person_id(person.id)
|
||||||
- contact ||= Contact.new(:person => person)
|
- contact ||= Contact.new(:person => person)
|
||||||
= render 'contacts/aspect_dropdown', :contact => contact, :person => person, :hang => 'left'
|
= render 'aspect_memberships/aspect_dropdown', :contact => contact, :person => person, :hang => 'left'
|
||||||
-else
|
-else
|
||||||
= t('people.person.thats_you')
|
= t('people.person.thats_you')
|
||||||
|
|
|
||||||
|
|
@ -30,14 +30,8 @@
|
||||||
= friend.name
|
= friend.name
|
||||||
|
|
||||||
- unless friend.person.nil?
|
- unless friend.person.nil?
|
||||||
/ should be dropdown
|
|
||||||
|
|
||||||
%li{:id => "options_" + friend.uid, :class => "share_with hidden", :style => "height:auto"}
|
%li{:id => "options_" + friend.uid, :class => "share_with hidden", :style => "height:auto"}
|
||||||
- contact = friend.contact
|
- contact = friend.contact
|
||||||
- contact ||= Contact.new
|
- contact ||= Contact.new(:person => friend.person)
|
||||||
= render :partial => 'contacts/share_with_list',
|
= render 'aspect_memberships/aspect_dropdown', :contact => contact, :person => friend.person, :hang => 'left'
|
||||||
:locals => {:person => friend.person,
|
|
||||||
:contact => contact,
|
|
||||||
:aspects_with_person => [],
|
|
||||||
:aspects_without_person => current_user.aspects,
|
|
||||||
:friend_finder => true}
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
- contact ||= Contact.new(:person => person)
|
- contact ||= Contact.new(:person => person)
|
||||||
- unless person == current_user.person
|
- unless person == current_user.person
|
||||||
.right
|
.right
|
||||||
= render 'contacts/aspect_dropdown', :contact => contact, :person => person, :hang => 'left'
|
= render 'aspect_memberships/aspect_dropdown', :contact => contact, :person => person, :hang => 'left'
|
||||||
|
|
||||||
.content
|
.content
|
||||||
%span.from
|
%span.from
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,14 @@ en:
|
||||||
success: "Successfully removed person from aspect"
|
success: "Successfully removed person from aspect"
|
||||||
failure: "Failed to remove person from aspect"
|
failure: "Failed to remove person from aspect"
|
||||||
no_membership: "Could not find the selected person in that aspect"
|
no_membership: "Could not find the selected person in that aspect"
|
||||||
|
aspect_dropdown:
|
||||||
|
add_to_aspect: "Add to aspect"
|
||||||
|
toggle:
|
||||||
|
zero: "Add to aspect"
|
||||||
|
one: "In %{count} aspect"
|
||||||
|
few: "In %{count} aspects"
|
||||||
|
many: "In %{count} aspects"
|
||||||
|
other: "In %{count} aspects"
|
||||||
|
|
||||||
bookmarklet:
|
bookmarklet:
|
||||||
post_success: "Posted! Closing!"
|
post_success: "Posted! Closing!"
|
||||||
|
|
@ -171,23 +179,8 @@ en:
|
||||||
few: "%{count} contacts"
|
few: "%{count} contacts"
|
||||||
many: "%{count} contacts"
|
many: "%{count} contacts"
|
||||||
other: "%{count} contacts"
|
other: "%{count} contacts"
|
||||||
destroy:
|
|
||||||
success: "Successfully disconnected from %{name}"
|
|
||||||
failure: "Failed to disconnect from %{name}"
|
|
||||||
share_with_pane:
|
|
||||||
share_with: "Start sharing with %{name}"
|
|
||||||
following: "By placing %{name} in an aspect, you'll start following and sending posts to them."
|
|
||||||
add_new_aspect: "add to new aspect"
|
|
||||||
create:
|
create:
|
||||||
failure: "Failed to create contact"
|
failure: "Failed to create contact"
|
||||||
aspect_dropdown:
|
|
||||||
add_to_aspect: "Add to aspect"
|
|
||||||
toggle:
|
|
||||||
zero: "Add to aspect"
|
|
||||||
one: "In %{count} aspect"
|
|
||||||
few: "In %{count} aspects"
|
|
||||||
many: "In %{count} aspects"
|
|
||||||
other: "In %{count} aspects"
|
|
||||||
sharing:
|
sharing:
|
||||||
people_sharing: "People sharing with you:"
|
people_sharing: "People sharing with you:"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,61 +6,10 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe ContactsController do
|
describe ContactsController do
|
||||||
before do
|
before do
|
||||||
@aspect = alice.aspects.first
|
|
||||||
@contact = alice.contact_for(bob.person)
|
|
||||||
|
|
||||||
sign_in :user, alice
|
sign_in :user, alice
|
||||||
@controller.stub(:current_user).and_return(alice)
|
@controller.stub(:current_user).and_return(alice)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#new' do
|
|
||||||
it 'assigns a person' do
|
|
||||||
get :new, :person_id => bob.person.id
|
|
||||||
assigns[:person].should == bob.person
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'assigns aspects without person' do
|
|
||||||
get :new, :person_id => bob.person.id
|
|
||||||
assigns[:aspects_without_person].should =~ alice.aspects
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe '#edit' do
|
|
||||||
it 'assigns a contact' do
|
|
||||||
get :edit, :id => @contact.id
|
|
||||||
assigns[:contact].should == @contact
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'assigns a person' do
|
|
||||||
get :edit, :id => @contact.id
|
|
||||||
assigns[:person].should == @contact.person
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe '#destroy' do
|
|
||||||
it 'disconnects from the person' do
|
|
||||||
alice.should_receive(:disconnect).with(@contact)
|
|
||||||
delete :destroy, :id => @contact.id
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'flases success if the contact is not destroyed' do
|
|
||||||
alice.stub!(:disconnect).and_return(true)
|
|
||||||
delete :destroy, :id => @contact.id
|
|
||||||
flash[:notice].should_not be_empty
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'flases failure if the contact is not destroyed' do
|
|
||||||
alice.stub!(:disconnect).and_return(false)
|
|
||||||
delete :destroy, :id => @contact.id
|
|
||||||
flash[:error].should_not be_empty
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'redirects back to the person page' do
|
|
||||||
delete :destroy, :id => @contact.id
|
|
||||||
response.should redirect_to(@contact.person)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe '#sharing' do
|
describe '#sharing' do
|
||||||
it "succeeds" do
|
it "succeeds" do
|
||||||
get :sharing
|
get :sharing
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue