Merge branch 'master' of github.com:diaspora/diaspora
This commit is contained in:
commit
f6701f2262
32 changed files with 301 additions and 221 deletions
|
|
@ -17,7 +17,7 @@ class ApplicationController < ActionController::Base
|
||||||
@aspect = nil
|
@aspect = nil
|
||||||
@aspects = current_user.aspects.fields(:name)
|
@aspects = current_user.aspects.fields(:name)
|
||||||
@aspects_dropdown_array = @aspects.collect{|x| [x.to_s, x.id]}
|
@aspects_dropdown_array = @aspects.collect{|x| [x.to_s, x.id]}
|
||||||
@notifications = Notification.for(current_user).all
|
@notification_count = Notification.for(current_user, :unread =>true).all.count
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,13 @@
|
||||||
|
|
||||||
class NotificationsController < ApplicationController
|
class NotificationsController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
respond_to :html
|
||||||
|
|
||||||
def destroy
|
|
||||||
|
def update
|
||||||
note = Notification.find_by_user_id_and_id(current_user.id, params[:id])
|
note = Notification.find_by_user_id_and_id(current_user.id, params[:id])
|
||||||
if note
|
if note
|
||||||
note.delete
|
note.update_attributes(:unread => false)
|
||||||
render :nothing => true
|
render :nothing => true
|
||||||
else
|
else
|
||||||
render :nothing => true, :code => 404
|
render :nothing => true, :code => 404
|
||||||
|
|
@ -16,6 +18,8 @@ class NotificationsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@notifications = Notification.for(current_user)
|
||||||
|
@group_days = @notifications.group_by{|note| note.created_at.strftime("%B %d") }
|
||||||
|
respond_with @notifications
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -19,4 +19,12 @@ module PeopleHelper
|
||||||
I18n.t "people.helper.people_on_pod_are_aware_of"
|
I18n.t "people.helper.people_on_pod_are_aware_of"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def birthday_format(bday)
|
||||||
|
if bday.year == 1000
|
||||||
|
bday.strftime("%B %d")
|
||||||
|
else
|
||||||
|
bday.strftime("%B %d %Y")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,17 @@ class Notification
|
||||||
|
|
||||||
key :object_id, ObjectId
|
key :object_id, ObjectId
|
||||||
key :kind, String
|
key :kind, String
|
||||||
|
key :unread, Boolean, :default => true
|
||||||
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :person
|
belongs_to :person
|
||||||
|
|
||||||
timestamps!
|
timestamps!
|
||||||
|
|
||||||
attr_accessible :object_id, :kind, :user_id, :person_id
|
attr_accessible :object_id, :kind, :user_id, :person_id, :unread
|
||||||
|
|
||||||
def self.for(user, opts={})
|
def self.for(user, opts={})
|
||||||
self.where(opts.merge(:user_id => user.id)).order('created_at desc')
|
self.where(opts.merge!(:user_id => user.id)).order('created_at desc')
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.notify(user, object, person)
|
def self.notify(user, object, person)
|
||||||
|
|
|
||||||
|
|
@ -88,10 +88,11 @@ class Profile
|
||||||
end
|
end
|
||||||
|
|
||||||
def date= params
|
def date= params
|
||||||
if ['year', 'month', 'day'].all? { |key| params[key].present? }
|
params['year'] = '1000' if params['year'].blank?
|
||||||
|
if ['month', 'day'].all? { |key| params[key].present? }
|
||||||
date = Date.new(params['year'].to_i, params['month'].to_i, params['day'].to_i)
|
date = Date.new(params['year'].to_i, params['month'].to_i, params['day'].to_i)
|
||||||
self.birthday = date
|
self.birthday = date
|
||||||
elsif ['year', 'month', 'day'].all? { |key| params[key] == '' }
|
elsif ['month', 'day'].all? { |key| params[key].blank? }
|
||||||
self.birthday = nil
|
self.birthday = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@
|
||||||
= link_for_aspect aspect
|
= link_for_aspect aspect
|
||||||
%li
|
%li
|
||||||
= link_to '+', '#add_aspect_pane', :class => "add_aspect_button", :title => t('aspects.manage.add_a_new_aspect')
|
= link_to '+', '#add_aspect_pane', :class => "add_aspect_button", :title => t('aspects.manage.add_a_new_aspect')
|
||||||
|
= link_to "notifications (#{@notification_count})", notifications_path
|
||||||
|
|
||||||
.fancybox_content
|
.fancybox_content
|
||||||
#add_aspect_pane
|
#add_aspect_pane
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,21 @@
|
||||||
%ul
|
:javascript
|
||||||
|
$('.note a').live('click', function(evt){
|
||||||
|
var note_id = $(this).closest('.note').attr('id');
|
||||||
|
$.ajax({
|
||||||
|
url: 'notifications/' + note_id,
|
||||||
|
type: 'PUT'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
- @notifications.each do |note|
|
%ul.notes
|
||||||
%li
|
- @group_days.each do |day, notes|
|
||||||
%h3
|
%h3
|
||||||
= link_to "#{note.person.name.titleize}", person_path(note.person)
|
%ul
|
||||||
= object_link(note)
|
%li
|
||||||
%span.description=" #{t('ago', :time => time_ago_in_words(note.created_at))}"
|
= day
|
||||||
|
- notes.each do |note|
|
||||||
|
%li.note{:id => note.id}
|
||||||
|
%h4{:class => "#{note.unread ? 'unread' : ''}"}
|
||||||
|
= link_to "#{note.person.name.titleize}", person_path(note.person)
|
||||||
|
= object_link(note)
|
||||||
|
%span.description=" #{t('ago', :time => time_ago_in_words(note.created_at))}"
|
||||||
|
|
|
||||||
|
|
@ -38,15 +38,20 @@
|
||||||
-if (contact && !contact.pending?) || person == current_user.person || @incoming_request
|
-if (contact && !contact.pending?) || person == current_user.person || @incoming_request
|
||||||
%ul#profile_information
|
%ul#profile_information
|
||||||
%li
|
%li
|
||||||
%h3 #{t('.bio')}
|
- unless person.profile.bio.blank?
|
||||||
= markdownify(person.profile.bio, :newlines => true)
|
%h3
|
||||||
|
=t('.bio')
|
||||||
|
= markdownify(person.profile.bio, :newlines => true)
|
||||||
|
|
||||||
%li.span-8.last
|
%li.span-8.last
|
||||||
.span-4
|
.span-4
|
||||||
%h3 #{t('.gender')}
|
- unless person.profile.gender.blank?
|
||||||
= person.profile.gender
|
%h3
|
||||||
|
=t('.gender')
|
||||||
|
= person.profile.gender
|
||||||
|
|
||||||
.span-4.last
|
.span-4.last
|
||||||
%h3 #{t('.born')}
|
- unless person.profile.birthday.blank?
|
||||||
= t('ago', :time => time_ago_in_words(person.profile.birthday)) if @person.profile.birthday
|
%h3
|
||||||
|
=t('.born')
|
||||||
|
= birthday_format(person.profile.birthday)
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
= link_to (image_tag photo.url(:thumb_small)), object_path(photo)
|
= link_to (image_tag photo.url(:thumb_small)), object_path(photo)
|
||||||
|
|
||||||
%h4= t('_comments')
|
%h4= t('_comments')
|
||||||
|
|
||||||
%div{:id => 'photo_stream', :class => 'stream show'}
|
%div{:id => 'photo_stream', :class => 'stream show'}
|
||||||
%li.message{:data=>{:guid=>@parent.id}}
|
%li.message{:data=>{:guid=>@parent.id}}
|
||||||
= render "comments/comments", :post_id => @parent.id, :comment_hashes => @comment_hashes
|
= render "comments/comments", :post_id => @parent.id, :comment_hashes => @comment_hashes
|
||||||
|
|
|
||||||
|
|
@ -34,4 +34,4 @@ def harden_ruby(ruby_string)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
harden_ruby("ruby-1.8.7-p302")
|
harden_ruby("ree-1.8.7-2010.02")
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ def harden_ruby(ruby_string)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
harden_ruby("ruby-1.8.7-p302")
|
harden_ruby("ree-1.8.7-2010.02")
|
||||||
|
|
||||||
include_recipe "centos::image_magick"
|
include_recipe "centos::image_magick"
|
||||||
include_recipe "centos::mongo_db"
|
include_recipe "centos::mongo_db"
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ execute "executable" do
|
||||||
end
|
end
|
||||||
|
|
||||||
execute "resque worker run" do
|
execute "resque worker run" do
|
||||||
command "mkdir -p /service/resque_worker && echo '#!/bin/sh' > /service/resque_worker/run && echo 'cd /usr/local/app/diaspora && RAILS_ENV=production QUEUES=socket_webfinger,receive,receive_salmon, email,http HOME=/usr/local/app/diaspora exec /usr/local/bin/rake resque:work' >> /service/resque_worker/run"
|
command "mkdir -p /service/resque_worker && echo '#!/bin/sh' > /service/resque_worker/run && echo 'cd /usr/local/app/diaspora && RAILS_ENV=production QUEUES=socket_webfinger,receive,receive_salmon,mail,http HOME=/usr/local/app/diaspora exec /usr/local/bin/rake resque:work' >> /service/resque_worker/run"
|
||||||
end
|
end
|
||||||
|
|
||||||
execute "executable" do
|
execute "executable" do
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,7 @@ module Diaspora
|
||||||
|
|
||||||
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||||
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||||
config.time_zone = 'Pacific Time (US & Canada)'
|
# config.time_zone = 'Central Time (US & Canada)'
|
||||||
|
|
||||||
|
|
||||||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||||
|
|
|
||||||
|
|
@ -366,7 +366,7 @@ en:
|
||||||
edit_my_profile: "Edit my profile"
|
edit_my_profile: "Edit my profile"
|
||||||
bio: "bio"
|
bio: "bio"
|
||||||
gender: "gender"
|
gender: "gender"
|
||||||
born: "born"
|
born: "birthday"
|
||||||
in_aspects: "in aspects"
|
in_aspects: "in aspects"
|
||||||
cannot_remove: "Cannot remove %{name} from last aspect. (If you want to disconnect from this person you must remove contact.)"
|
cannot_remove: "Cannot remove %{name} from last aspect. (If you want to disconnect from this person you must remove contact.)"
|
||||||
remove_from: "Remove %{name} from %{aspect}?"
|
remove_from: "Remove %{name} from %{aspect}?"
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ Diaspora::Application.routes.draw do
|
||||||
resources :requests, :only => [:destroy, :create]
|
resources :requests, :only => [:destroy, :create]
|
||||||
resources :services
|
resources :services
|
||||||
|
|
||||||
resources :notifications, :only => [:destroy, :index]
|
resources :notifications
|
||||||
resources :posts, :only => [:show], :path => '/p/'
|
resources :posts, :only => [:show], :path => '/p/'
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,8 @@ header
|
||||||
.right
|
.right
|
||||||
:top 10px
|
:top 10px
|
||||||
:height 45px
|
:height 45px
|
||||||
|
|
||||||
|
ul#notifications,
|
||||||
ul#user_menu
|
ul#user_menu
|
||||||
:overflow hidden
|
:overflow hidden
|
||||||
:white-space nowrap
|
:white-space nowrap
|
||||||
|
|
@ -217,6 +218,9 @@ header
|
||||||
:top 2px
|
:top 2px
|
||||||
:display block
|
:display block
|
||||||
|
|
||||||
|
.unread
|
||||||
|
:background-color #eee
|
||||||
|
|
||||||
.diaspora_header_logo
|
.diaspora_header_logo
|
||||||
:position relative
|
:position relative
|
||||||
:top 4px
|
:top 4px
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ describe AspectsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#create" do
|
describe "#create" do
|
||||||
describe "with valid params" do
|
context "with valid params" do
|
||||||
it "creates an aspect" do
|
it "creates an aspect" do
|
||||||
@user.aspects.count.should == 2
|
@user.aspects.count.should == 2
|
||||||
post :create, "aspect" => {"name" => "new aspect"}
|
post :create, "aspect" => {"name" => "new aspect"}
|
||||||
|
|
@ -95,7 +95,7 @@ describe AspectsController do
|
||||||
response.should redirect_to(aspect_path(Aspect.find_by_name("new aspect")))
|
response.should redirect_to(aspect_path(Aspect.find_by_name("new aspect")))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
describe "with invalid params" do
|
context "with invalid params" do
|
||||||
it "does not create an aspect" do
|
it "does not create an aspect" do
|
||||||
@user.aspects.count.should == 2
|
@user.aspects.count.should == 2
|
||||||
post :create, "aspect" => {"name" => ""}
|
post :create, "aspect" => {"name" => ""}
|
||||||
|
|
|
||||||
|
|
@ -7,24 +7,24 @@ require 'spec_helper'
|
||||||
describe CommentsController do
|
describe CommentsController do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
let!(:user) { make_user }
|
let!(:user1) { make_user }
|
||||||
let!(:aspect) { user.aspects.create(:name => "AWESOME!!") }
|
let!(:aspect1) { user1.aspects.create(:name => "AWESOME!!") }
|
||||||
|
|
||||||
let!(:user2) { make_user }
|
let!(:user2) { make_user }
|
||||||
let!(:aspect2) { user2.aspects.create(:name => "WIN!!") }
|
let!(:aspect2) { user2.aspects.create(:name => "WIN!!") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in :user, user
|
sign_in :user, user1
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#create' do
|
describe '#create' do
|
||||||
let(:comment_hash) {
|
let(:comment_hash) {
|
||||||
{:text =>"facebook, is that you?",
|
{:text =>"facebook, is that you?",
|
||||||
:post_id =>"#{@post.id}"}
|
:post_id =>"#{@post.id}"}
|
||||||
}
|
}
|
||||||
context "on my own post" do
|
context "on my own post" do
|
||||||
before do
|
before do
|
||||||
@post = user.post :status_message, :message => 'GIANTS', :to => aspect.id
|
@post = user1.post :status_message, :message => 'GIANTS', :to => aspect1.id
|
||||||
end
|
end
|
||||||
it 'responds to format js' do
|
it 'responds to format js' do
|
||||||
post :create, comment_hash.merge(:format => 'js')
|
post :create, comment_hash.merge(:format => 'js')
|
||||||
|
|
@ -35,7 +35,7 @@ describe CommentsController do
|
||||||
|
|
||||||
context "on a post from a contact" do
|
context "on a post from a contact" do
|
||||||
before do
|
before do
|
||||||
connect_users(user, aspect, user2, aspect2)
|
connect_users(user1, aspect1, user2, aspect2)
|
||||||
@post = user2.post :status_message, :message => 'GIANTS', :to => aspect2.id
|
@post = user2.post :status_message, :message => 'GIANTS', :to => aspect2.id
|
||||||
end
|
end
|
||||||
it 'comments' do
|
it 'comments' do
|
||||||
|
|
@ -46,10 +46,10 @@ describe CommentsController do
|
||||||
new_user = make_user
|
new_user = make_user
|
||||||
comment_hash[:person_id] = new_user.person.id.to_s
|
comment_hash[:person_id] = new_user.person.id.to_s
|
||||||
post :create, comment_hash
|
post :create, comment_hash
|
||||||
Comment.find_by_text(comment_hash[:text]).person_id.should == user.person.id
|
Comment.find_by_text(comment_hash[:text]).person_id.should == user1.person.id
|
||||||
end
|
end
|
||||||
it "doesn't overwrite id" do
|
it "doesn't overwrite id" do
|
||||||
old_comment = user.comment("hello", :on => @post)
|
old_comment = user1.comment("hello", :on => @post)
|
||||||
comment_hash[:id] = old_comment.id
|
comment_hash[:id] = old_comment.id
|
||||||
post :create, comment_hash
|
post :create, comment_hash
|
||||||
old_comment.reload.text.should == 'hello'
|
old_comment.reload.text.should == 'hello'
|
||||||
|
|
@ -60,7 +60,7 @@ describe CommentsController do
|
||||||
@post = user2.post :status_message, :message => 'GIANTS', :to => aspect2.id
|
@post = user2.post :status_message, :message => 'GIANTS', :to => aspect2.id
|
||||||
end
|
end
|
||||||
it 'posts no comment' do
|
it 'posts no comment' do
|
||||||
user.should_receive(:comment).exactly(0).times
|
user1.should_not_receive(:comment)
|
||||||
post :create, comment_hash
|
post :create, comment_hash
|
||||||
response.code.should == '406'
|
response.code.should == '406'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,14 @@ describe HomeController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#show' do
|
describe '#show' do
|
||||||
it 'should show a login link if no user is not logged in' do
|
it 'shows a login link if no user is not logged in' do
|
||||||
get :show
|
get :show
|
||||||
response.body.should include("login")
|
response.body.should include("login")
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should redirect to aspects index if user is logged in' do
|
it 'redirects to aspects index if user is logged in' do
|
||||||
sign_in @user
|
sign_in @user
|
||||||
get :show
|
get :show
|
||||||
response.should redirect_to aspects_path
|
response.should redirect_to aspects_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -40,15 +40,15 @@ describe HomeController do
|
||||||
end
|
end
|
||||||
it 'logs a unified id in a request' do
|
it 'logs a unified id in a request' do
|
||||||
id = @lines.first.match(/r_id=(\w+)\s/).captures.first
|
id = @lines.first.match(/r_id=(\w+)\s/).captures.first
|
||||||
@lines.each do |line|
|
@lines.each do |line|
|
||||||
line.match(/r_id=(\w+)\s/).captures.first.should == @id
|
line.match(/r_id=(\w+)\s/).captures.first.should == @id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
it 'logs different ids in different requests' do
|
it 'logs different ids in different requests' do
|
||||||
get :show
|
get :show
|
||||||
old_lines = Rails.logger.infos.select do |line|
|
old_lines = Rails.logger.infos.select do |line|
|
||||||
line.match(/r_id=(\w+)\s/).captures.first == @id
|
line.match(/r_id=(\w+)\s/).captures.first == @id
|
||||||
end
|
end
|
||||||
old_lines.length.should == Rails.logger.infos.length/2
|
old_lines.length.should == Rails.logger.infos.length/2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -72,7 +72,7 @@ describe HomeController do
|
||||||
end
|
end
|
||||||
it 'logs layouts' do
|
it 'logs layouts' do
|
||||||
pending 'where is the template=home/show line?'
|
pending 'where is the template=home/show line?'
|
||||||
home_line = @lines.detect{|t|
|
home_line = @lines.detect{|t|
|
||||||
t.include?("template=home/show.html.haml")}
|
t.include?("template=home/show.html.haml")}
|
||||||
home_line.should match /layout=layouts\/application/
|
home_line.should match /layout=layouts\/application/
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ describe InvitationsController do
|
||||||
|
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
let!(:user) {make_user}
|
let!(:user) { make_user }
|
||||||
let!(:aspect){user.aspects.create(:name => "WIN!!")}
|
let!(:aspect) { user.aspects.create(:name => "WIN!!") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
request.env["devise.mapping"] = Devise.mappings[:user]
|
request.env["devise.mapping"] = Devise.mappings[:user]
|
||||||
|
|
@ -26,23 +26,26 @@ describe InvitationsController do
|
||||||
request.env["HTTP_REFERER"]= 'http://test.host/cats/foo'
|
request.env["HTTP_REFERER"]= 'http://test.host/cats/foo'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should call the resque job Jobs::InviteUser' do
|
it 'calls the resque job Jobs::InviteUser' do
|
||||||
Resque.should_receive(:enqueue)
|
Resque.should_receive(:enqueue)
|
||||||
post :create, :user => @invite
|
post :create, :user => @invite
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'can handle a comma seperated list of emails' do
|
it 'handles a comma seperated list of emails' do
|
||||||
Resque.should_receive(:enqueue).twice()
|
Resque.should_receive(:enqueue).twice()
|
||||||
post :create, :user => @invite.merge(:email => "foofoofoofoo@example.com, mbs@gmail.com")
|
post :create, :user => @invite.merge(
|
||||||
|
:email => "foofoofoofoo@example.com, mbs@gmail.com")
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'can handle a comma seperated list of emails with whitespace' do
|
it 'handles a comma seperated list of emails with whitespace' do
|
||||||
Resque.should_receive(:enqueue).twice()
|
Resque.should_receive(:enqueue).twice()
|
||||||
post :create, :user => @invite.merge(:email => "foofoofoofoo@example.com , mbs@gmail.com")
|
post :create, :user => @invite.merge(
|
||||||
|
:email => "foofoofoofoo@example.com , mbs@gmail.com")
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'displays a message that tells you how many invites were sent, and which REJECTED' do
|
it 'displays a message that tells the user how many invites were sent, and which REJECTED' do
|
||||||
post :create, :user => @invite.merge(:email => "mbs@gmail.com, foo@bar.com, foo.com, lala@foo, cool@bar.com")
|
post :create, :user => @invite.merge(
|
||||||
|
:email => "mbs@gmail.com, foo@bar.com, foo.com, lala@foo, cool@bar.com")
|
||||||
flash[:error].should_not be_empty
|
flash[:error].should_not be_empty
|
||||||
flash[:error].should =~ /foo\.com/
|
flash[:error].should =~ /foo\.com/
|
||||||
flash[:error].should =~ /lala@foo/
|
flash[:error].should =~ /lala@foo/
|
||||||
|
|
@ -75,7 +78,7 @@ describe InvitationsController do
|
||||||
end
|
end
|
||||||
context 'success' do
|
context 'success' do
|
||||||
let(:invited) {User.find_by_username(@accept_params[:user][:username])}
|
let(:invited) {User.find_by_username(@accept_params[:user][:username])}
|
||||||
it 'creates user' do
|
it 'creates a user' do
|
||||||
put :update, @accept_params
|
put :update, @accept_params
|
||||||
invited.should_not be_nil
|
invited.should_not be_nil
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -14,22 +14,22 @@ describe NotificationsController do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#destroy' do
|
describe '#update' do
|
||||||
it 'removes a notification' do
|
it 'marks a notification as read' do
|
||||||
note = Notification.create(:user_id => user.id)
|
note = Notification.create(:user_id => user.id)
|
||||||
delete :destroy, :id => note.id
|
put :update, :id => note.id
|
||||||
Notification.count.should == 0
|
Notification.first.unread.should == false
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'only lets you delete your own notifications' do
|
it 'only lets you read your own notifications' do
|
||||||
user2 = make_user
|
user2 = make_user
|
||||||
|
|
||||||
Notification.create(:user_id => user.id)
|
Notification.create(:user_id => user.id)
|
||||||
note = Notification.create(:user_id => user2.id)
|
note = Notification.create(:user_id => user2.id)
|
||||||
|
|
||||||
delete :destroy, :id => note.id
|
put :update, :id => note.id
|
||||||
|
|
||||||
Notification.count.should == 2
|
Notification.find(note.id).unread.should == true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ require 'spec_helper'
|
||||||
describe PeopleController do
|
describe PeopleController do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
let(:user) { Factory(:user) }
|
let(:user) { make_user }
|
||||||
let!(:aspect) { user.aspects.create(:name => "lame-os") }
|
let!(:aspect) { user.aspects.create(:name => "lame-os") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
|
@ -119,19 +119,27 @@ describe PeopleController do
|
||||||
end
|
end
|
||||||
describe '#index' do
|
describe '#index' do
|
||||||
before do
|
before do
|
||||||
@eugene = Factory.create(:person, :profile => {:first_name => "Eugene", :last_name => "w"})
|
@eugene = Factory.create(:person,
|
||||||
@korth = Factory.create(:person, :profile => {:first_name => "Evan", :last_name => "Korth"})
|
:profile => {:first_name => "Eugene",
|
||||||
|
:last_name => "w"})
|
||||||
|
@korth = Factory.create(:person,
|
||||||
|
:profile => {:first_name => "Evan",
|
||||||
|
:last_name => "Korth"})
|
||||||
end
|
end
|
||||||
|
|
||||||
it "assigns hashes" do
|
it "assigns hashes" do
|
||||||
eugene2 = Factory.create(:person, :profile => {:first_name => "Eugene", :last_name => "w"})
|
eugene2 = Factory.create(:person,
|
||||||
|
:profile => {:first_name => "Eugene",
|
||||||
|
:last_name => "w"})
|
||||||
get :index, :q => "Eu"
|
get :index, :q => "Eu"
|
||||||
people = assigns[:hashes].map{|h| h[:person]}
|
people = assigns[:hashes].map{|h| h[:person]}
|
||||||
people.should include @eugene
|
people.should include @eugene
|
||||||
people.should include eugene2
|
people.should include eugene2
|
||||||
end
|
end
|
||||||
it "assigns people" do
|
it "assigns people" do
|
||||||
eugene2 = Factory.create(:person, :profile => {:first_name => "Eugene", :last_name => "w"})
|
eugene2 = Factory.create(:person,
|
||||||
|
:profile => {:first_name => "Eugene",
|
||||||
|
:last_name => "w"})
|
||||||
get :index, :q => "Eu"
|
get :index, :q => "Eu"
|
||||||
assigns[:people].should =~ [@eugene, eugene2]
|
assigns[:people].should =~ [@eugene, eugene2]
|
||||||
end
|
end
|
||||||
|
|
@ -162,7 +170,7 @@ describe PeopleController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#show' do
|
describe '#show' do
|
||||||
it 'should go to the current_user show page' do
|
it 'goes to the current_user show page' do
|
||||||
get :show, :id => user.person.id
|
get :show, :id => user.person.id
|
||||||
response.should be_success
|
response.should be_success
|
||||||
end
|
end
|
||||||
|
|
@ -180,12 +188,12 @@ describe PeopleController do
|
||||||
response.should be_success
|
response.should be_success
|
||||||
end
|
end
|
||||||
|
|
||||||
it "redirects on an invalid id" do
|
it "redirects to #index if the id is invalid" do
|
||||||
get :show, :id => 'delicious'
|
get :show, :id => 'delicious'
|
||||||
response.should redirect_to people_path
|
response.should redirect_to people_path
|
||||||
end
|
end
|
||||||
|
|
||||||
it "redirects on a nonexistent person" do
|
it "redirects to #index if no person is found" do
|
||||||
get :show, :id => user.id
|
get :show, :id => user.id
|
||||||
response.should redirect_to people_path
|
response.should redirect_to people_path
|
||||||
end
|
end
|
||||||
|
|
@ -256,7 +264,8 @@ describe PeopleController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not overwrite the profile diaspora handle' do
|
it 'does not overwrite the profile diaspora handle' do
|
||||||
handle_params = {:id => user.person.id, :profile => {:diaspora_handle => 'abc@a.com'}}
|
handle_params = {:id => user.person.id,
|
||||||
|
:profile => {:diaspora_handle => 'abc@a.com'} }
|
||||||
put :update, handle_params
|
put :update, handle_params
|
||||||
user.person.reload.profile[:diaspora_handle].should_not == 'abc@a.com'
|
user.person.reload.profile[:diaspora_handle].should_not == 'abc@a.com'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,17 +7,17 @@ require 'spec_helper'
|
||||||
describe PhotosController do
|
describe PhotosController do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
let(:user) {make_user}
|
let(:user) {make_user}
|
||||||
let(:user2) {make_user}
|
let(:user2) {make_user}
|
||||||
|
|
||||||
let!(:aspect) {user.aspects.create(:name => 'winners')}
|
let!(:aspect) { user.aspects.create(:name => 'winners') }
|
||||||
let(:aspect2) {user2.aspects.create(:name => 'winners')}
|
let(:aspect2) { user2.aspects.create(:name => 'winners') }
|
||||||
|
|
||||||
let(:filename) {'button.png'}
|
let(:filename) { 'button.png' }
|
||||||
let(:fixture_name) {File.join(File.dirname(__FILE__), '..', 'fixtures', filename)}
|
let(:fixture_name) { File.join(File.dirname(__FILE__), '..', 'fixtures', filename) }
|
||||||
let(:image) {File.open(fixture_name)}
|
let(:image) { File.open(fixture_name) }
|
||||||
let!(:photo){ user.post(:photo, :user_file => image, :to => aspect.id)}
|
let!(:photo) { user.post(:photo, :user_file => image, :to => aspect.id) }
|
||||||
let!(:photo2){ user2.post(:photo, :user_file => image, :to => aspect2.id)}
|
let!(:photo2) { user2.post(:photo, :user_file => image, :to => aspect2.id) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
connect_users(user, aspect, user2, aspect2)
|
connect_users(user, aspect, user2, aspect2)
|
||||||
|
|
@ -27,11 +27,11 @@ describe PhotosController do
|
||||||
describe '#create' do
|
describe '#create' do
|
||||||
before do
|
before do
|
||||||
@controller.stub!(:file_handler).and_return(image)
|
@controller.stub!(:file_handler).and_return(image)
|
||||||
@params = {:photo => {:user_file => image, :aspect_ids => "all"}}
|
@params = {:photo => {:user_file => image, :aspect_ids => "all"} }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'can make a photo' do
|
it 'can make a photo' do
|
||||||
proc{
|
lambda {
|
||||||
post :create, @params
|
post :create, @params
|
||||||
}.should change(Photo, :count).by(1)
|
}.should change(Photo, :count).by(1)
|
||||||
end
|
end
|
||||||
|
|
@ -54,28 +54,28 @@ describe PhotosController do
|
||||||
get :index, :person_id => user2.person.id.to_s
|
get :index, :person_id => user2.person.id.to_s
|
||||||
|
|
||||||
assigns[:person].should == user2.person
|
assigns[:person].should == user2.person
|
||||||
assigns[:posts].should == []
|
assigns[:posts].should be_empty
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#show' do
|
describe '#show' do
|
||||||
it 'assigns the photo based on the photo id' do
|
it 'assigns the photo based on the photo id' do
|
||||||
get :show, :id => photo.id
|
get :show, :id => photo.id
|
||||||
response.code.should == "200"
|
response.status.should == 200
|
||||||
|
|
||||||
assigns[:photo].should == photo
|
assigns[:photo].should == photo
|
||||||
assigns[:ownership].should == true
|
assigns[:ownership].should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#edit' do
|
describe '#edit' do
|
||||||
it 'should let you edit a photo' do
|
it 'lets the user edit a photo' do
|
||||||
get :edit, :id => photo.id
|
get :edit, :id => photo.id
|
||||||
response.code.should == "200"
|
response.status.should == 200
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not let you edit a photo that is not yours' do
|
it 'does not let the user edit a photo that is not his' do
|
||||||
get :edit, :id => photo2.id
|
get :edit, :id => photo2.id
|
||||||
response.should redirect_to(:action => :index, :person_id => user.person.id.to_s)
|
response.should redirect_to(:action => :index, :person_id => user.person.id.to_s)
|
||||||
end
|
end
|
||||||
|
|
@ -83,35 +83,34 @@ describe PhotosController do
|
||||||
|
|
||||||
|
|
||||||
describe '#destroy' do
|
describe '#destroy' do
|
||||||
it 'should let me delete my photos' do
|
it 'allows the user to delete his photos' do
|
||||||
delete :destroy, :id => photo.id
|
delete :destroy, :id => photo.id
|
||||||
Photo.find_by_id(photo.id).should be nil
|
Photo.find_by_id(photo.id).should be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'will not let you destory posts you do not own' do
|
it 'will not let you destory posts you do not own' do
|
||||||
delete :destroy, :id => photo2.id
|
delete :destroy, :id => photo2.id
|
||||||
Photo.find_by_id(photo2.id).should_not be nil
|
Photo.find_by_id(photo2.id).should be_true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#update" do
|
describe "#update" do
|
||||||
it "should update the caption of a photo" do
|
it "updates the caption of a photo" do
|
||||||
put :update, :id => photo.id, :photo => { :caption => "now with lasers!"}
|
put :update, :id => photo.id, :photo => { :caption => "now with lasers!" }
|
||||||
photo.reload.caption.should == "now with lasers!"
|
photo.reload.caption.should == "now with lasers!"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't overwrite random attributes" do
|
it "doesn't overwrite random attributes" do
|
||||||
new_user = Factory.create :user
|
new_user = Factory.create :user
|
||||||
params = { :caption => "now with lasers!", :person_id => new_user.id}
|
params = { :caption => "now with lasers!", :person_id => new_user.id }
|
||||||
put :update, :id => photo.id, :photo => params
|
put :update, :id => photo.id, :photo => params
|
||||||
photo.reload.person_id.should == user.person.id
|
photo.reload.person_id.should == user.person.id
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should redirect if you do not have access to the post' do
|
it 'redirects if you do not have access to the post' do
|
||||||
params = { :caption => "now with lasers!"}
|
params = { :caption => "now with lasers!" }
|
||||||
put :update, :id => photo2.id, :photo => params
|
put :update, :id => photo2.id, :photo => params
|
||||||
response.should redirect_to(:action => :index, :person_id => user.person.id.to_s)
|
response.should redirect_to(:action => :index, :person_id => user.person.id.to_s)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ require 'spec_helper'
|
||||||
describe PublicsController do
|
describe PublicsController do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
let(:user) { make_user }
|
let(:user) { make_user }
|
||||||
let(:person) { Factory(:person) }
|
let(:person) { Factory(:person) }
|
||||||
|
|
||||||
describe '#receive' do
|
describe '#receive' do
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
||||||
require File.join(File.dirname(__FILE__), "..", "spec_helper")
|
require 'spec_helper'
|
||||||
|
|
||||||
describe RegistrationsController do
|
describe RegistrationsController do
|
||||||
include Devise::TestHelpers
|
include Devise::TestHelpers
|
||||||
|
|
@ -11,10 +11,13 @@ describe RegistrationsController do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
request.env["devise.mapping"] = Devise.mappings[:user]
|
request.env["devise.mapping"] = Devise.mappings[:user]
|
||||||
@valid_params = {"user" => {"username" => "jdoe",
|
@valid_params = {:user => {
|
||||||
"email" => "jdoe@example.com",
|
:username => "jdoe",
|
||||||
"password" => "password",
|
:email => "jdoe@example.com",
|
||||||
"password_confirmation" => "password"}}
|
:password => "password",
|
||||||
|
:password_confirmation => "password"
|
||||||
|
}
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#check_registrations_open!' do
|
describe '#check_registrations_open!' do
|
||||||
|
|
@ -24,12 +27,12 @@ describe RegistrationsController do
|
||||||
after do
|
after do
|
||||||
APP_CONFIG[:registrations_closed] = false
|
APP_CONFIG[:registrations_closed] = false
|
||||||
end
|
end
|
||||||
it 'stops a #new request' do
|
it 'redirects #new to the login page' do
|
||||||
get :new
|
get :new
|
||||||
flash[:error].should == I18n.t('registrations.closed')
|
flash[:error].should == I18n.t('registrations.closed')
|
||||||
response.should redirect_to new_user_session_path
|
response.should redirect_to new_user_session_path
|
||||||
end
|
end
|
||||||
it 'stops a #create request' do
|
it 'redirects #create to the login page' do
|
||||||
post :create, @valid_params
|
post :create, @valid_params
|
||||||
flash[:error].should == I18n.t('registrations.closed')
|
flash[:error].should == I18n.t('registrations.closed')
|
||||||
response.should redirect_to new_user_session_path
|
response.should redirect_to new_user_session_path
|
||||||
|
|
@ -43,11 +46,13 @@ describe RegistrationsController do
|
||||||
User.stub!(:build).and_return(user)
|
User.stub!(:build).and_return(user)
|
||||||
end
|
end
|
||||||
it "creates a user" do
|
it "creates a user" do
|
||||||
lambda { get :create, @valid_params }.should change(User, :count).by(1)
|
lambda {
|
||||||
|
get :create, @valid_params
|
||||||
|
}.should change(User, :count).by(1)
|
||||||
end
|
end
|
||||||
it "assigns @user" do
|
it "assigns @user" do
|
||||||
get :create, @valid_params
|
get :create, @valid_params
|
||||||
assigns(:user).should_not be_nil
|
assigns(:user).should be_true
|
||||||
end
|
end
|
||||||
it "sets the flash" do
|
it "sets the flash" do
|
||||||
get :create, @valid_params
|
get :create, @valid_params
|
||||||
|
|
@ -61,7 +66,7 @@ describe RegistrationsController do
|
||||||
context "with invalid parameters" do
|
context "with invalid parameters" do
|
||||||
before do
|
before do
|
||||||
@invalid_params = @valid_params
|
@invalid_params = @valid_params
|
||||||
@invalid_params["user"]["password_confirmation"] = "baddword"
|
@invalid_params[:user][:password_confirmation] = "baddword"
|
||||||
end
|
end
|
||||||
it "does not create a user" do
|
it "does not create a user" do
|
||||||
lambda { get :create, @invalid_params }.should_not change(User, :count)
|
lambda { get :create, @invalid_params }.should_not change(User, :count)
|
||||||
|
|
|
||||||
|
|
@ -23,24 +23,28 @@ describe RequestsController do
|
||||||
describe '#destroy' do
|
describe '#destroy' do
|
||||||
before do
|
before do
|
||||||
@other_user.send_contact_request_to(@user.person, @other_user.aspects.first)
|
@other_user.send_contact_request_to(@user.person, @other_user.aspects.first)
|
||||||
@user.reload # so it can find its pending requests.
|
|
||||||
@friend_request = Request.to(@user.person).first
|
@friend_request = Request.to(@user.person).first
|
||||||
end
|
end
|
||||||
describe 'when accepting a contact request' do
|
describe 'when accepting a contact request' do
|
||||||
it "succeeds" do
|
it "succeeds" do
|
||||||
xhr :delete, :destroy, "accept" => "true", "aspect_id" => @user.aspects.first.id.to_s, "id" => @friend_request.id.to_s
|
xhr :delete, :destroy,
|
||||||
|
:accept => "true",
|
||||||
|
:aspect_id => @user.aspects.first.id.to_s,
|
||||||
|
:id => @friend_request.id.to_s
|
||||||
response.should redirect_to(aspect_path(@user.aspects.first))
|
response.should redirect_to(aspect_path(@user.aspects.first))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
describe 'when ignoring a contact request' do
|
describe 'when ignoring a contact request' do
|
||||||
it "succeeds" do
|
it "succeeds" do
|
||||||
xhr :delete, :destroy, "id" => @friend_request.id.to_s
|
xhr :delete, :destroy,
|
||||||
|
:id => @friend_request.id.to_s
|
||||||
response.should be_success
|
response.should be_success
|
||||||
end
|
end
|
||||||
it "removes the request object" do
|
it "removes the request object" do
|
||||||
lambda {
|
lambda {
|
||||||
xhr :delete, :destroy, "id" => @friend_request.id.to_s
|
xhr :delete, :destroy,
|
||||||
}.should change(Request, 'count').by(-1)
|
:id => @friend_request.id.to_s
|
||||||
|
}.should change(Request, :count).by(-1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -48,8 +52,10 @@ describe RequestsController do
|
||||||
describe '#create' do
|
describe '#create' do
|
||||||
context 'valid new request' do
|
context 'valid new request' do
|
||||||
before do
|
before do
|
||||||
@params = {:request => {:to => @other_user.diaspora_handle,
|
@params = {:request => {
|
||||||
:into => @user.aspects[0].id}}
|
:to => @other_user.diaspora_handle,
|
||||||
|
:into => @user.aspects[0].id
|
||||||
|
}}
|
||||||
end
|
end
|
||||||
it 'creates a contact' do
|
it 'creates a contact' do
|
||||||
@user.contact_for(@other_user).should be_nil
|
@user.contact_for(@other_user).should be_nil
|
||||||
|
|
@ -63,21 +69,19 @@ describe RequestsController do
|
||||||
it 'does not persist a Request' do
|
it 'does not persist a Request' do
|
||||||
lambda {
|
lambda {
|
||||||
post :create, @params
|
post :create, @params
|
||||||
}.should_not change(Request,:count)
|
}.should_not change(Request, :count)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
it 'autoaccepts and when sending a request to someone who sent me a request' do
|
it 'autoaccepts and when sending a request to someone who sent me a request' do
|
||||||
@other_user.send_contact_request_to(@user.person, @other_user.aspects[0])
|
@other_user.send_contact_request_to(@user.person, @other_user.aspects[0])
|
||||||
Request.to(@user).count.should == 1
|
|
||||||
@user.contact_for(@other_user.person).should be_nil
|
|
||||||
|
|
||||||
post(:create, :request => {
|
post(:create, :request => {
|
||||||
:to => @other_user.diaspora_handle,
|
:to => @other_user.diaspora_handle,
|
||||||
:into => @user.aspects[0].id}
|
:into => @user.aspects[0].id}
|
||||||
)
|
)
|
||||||
Request.to(@user).count.should == 0
|
Request.to(@user).first.should be_nil
|
||||||
@user.contact_for(@other_user.person).should_not be_nil
|
@user.contact_for(@other_user.person).should be_true
|
||||||
@user.aspects[0].contacts.all(:person_id => @other_user.person.id).should_not be_nil
|
@user.aspects[0].contacts.all(:person_id => @other_user.person.id).should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
it "redirects when requesting to be contacts with yourself" do
|
it "redirects when requesting to be contacts with yourself" do
|
||||||
|
|
|
||||||
|
|
@ -6,22 +6,24 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe ServicesController do
|
describe ServicesController do
|
||||||
render_views
|
render_views
|
||||||
let(:user) { make_user }
|
let(:user) { make_user }
|
||||||
let!(:aspect) { user.aspects.create(:name => "lame-os") }
|
let!(:aspect) { user.aspects.create(:name => "lame-os") }
|
||||||
|
|
||||||
|
|
||||||
let(:mock_access_token) { Object.new }
|
let(:mock_access_token) { Object.new }
|
||||||
|
|
||||||
let(:omniauth_auth) {{ 'provider' => 'twitter', 'uid' => '2',
|
let(:omniauth_auth) {
|
||||||
'user_info' => { 'nickname' => 'grimmin' },
|
{ 'provider' => 'twitter',
|
||||||
'credentials' => { 'token' => 'tokin', 'secret' =>"not_so_much" }
|
'uid' => '2',
|
||||||
}}
|
'user_info' => { 'nickname' => 'grimmin' },
|
||||||
|
'credentials' => { 'token' => 'tokin', 'secret' =>"not_so_much" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in :user, user
|
sign_in :user, user
|
||||||
@controller.stub!(:current_user).and_return(user)
|
@controller.stub!(:current_user).and_return(user)
|
||||||
mock_access_token.stub!(:token).and_return("12345")
|
mock_access_token.stub!(:token => "12345", :secret => "56789")
|
||||||
mock_access_token.stub!(:secret).and_return("56789")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#index' do
|
describe '#index' do
|
||||||
|
|
@ -39,17 +41,19 @@ describe ServicesController do
|
||||||
describe '#create' do
|
describe '#create' do
|
||||||
it 'creates a new OmniauthService' do
|
it 'creates a new OmniauthService' do
|
||||||
request.env['omniauth.auth'] = omniauth_auth
|
request.env['omniauth.auth'] = omniauth_auth
|
||||||
lambda{post :create}.should change(user.services, :count).by(1)
|
lambda{
|
||||||
|
post :create
|
||||||
|
}.should change(user.services, :count).by(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should redirect to getting started if the user still getting started' do
|
it 'redirects to getting started if the user is getting started' do
|
||||||
user.getting_started = true
|
user.getting_started = true
|
||||||
request.env['omniauth.auth'] = omniauth_auth
|
request.env['omniauth.auth'] = omniauth_auth
|
||||||
post :create
|
post :create
|
||||||
response.should redirect_to getting_started_path(:step => 3)
|
response.should redirect_to getting_started_path(:step => 3)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should redirect to services url' do
|
it 'redirects to services url' do
|
||||||
user.getting_started = false
|
user.getting_started = false
|
||||||
request.env['omniauth.auth'] = omniauth_auth
|
request.env['omniauth.auth'] = omniauth_auth
|
||||||
post :create
|
post :create
|
||||||
|
|
@ -66,9 +70,14 @@ describe ServicesController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#destroy' do
|
describe '#destroy' do
|
||||||
let!(:service1) {a = Factory(:service); user.services << a; a}
|
before do
|
||||||
it 'should destroy a service of a users with the id' do
|
@service1 = Factory.create(:service)
|
||||||
lambda{delete :destroy, :id => service1.id.to_s}.should change(user.services, :count).by(-1)
|
user.services << @service1
|
||||||
|
end
|
||||||
|
it 'destroys a service selected by id' do
|
||||||
|
lambda{
|
||||||
|
delete :destroy, :id => @service1.id
|
||||||
|
}.should change(user.services, :count).by(-1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,6 @@ describe SocketsController do
|
||||||
@controller = SocketsController.new
|
@controller = SocketsController.new
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should unstub the websockets' do
|
|
||||||
Diaspora::WebSocket.initialize_channels
|
|
||||||
@controller.class.should == SocketsController
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'actionhash' do
|
describe 'actionhash' do
|
||||||
before do
|
before do
|
||||||
@aspect = @user.aspects.create(:name => "losers")
|
@aspect = @user.aspects.create(:name => "losers")
|
||||||
|
|
@ -29,13 +24,13 @@ describe SocketsController do
|
||||||
@fixture_name = File.dirname(__FILE__) + '/../fixtures/button.png'
|
@fixture_name = File.dirname(__FILE__) + '/../fixtures/button.png'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should actionhash posts' do
|
it 'actionhashes posts' do
|
||||||
json = @controller.action_hash(@user.id, @message)
|
json = @controller.action_hash(@user.id, @message)
|
||||||
json.include?(@message.message).should be_true
|
json.include?(@message.message).should be_true
|
||||||
json.include?('status_message').should be_true
|
json.include?('status_message').should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should actionhash retractions' do
|
it 'actionhashes retractions' do
|
||||||
retraction = Retraction.for @message
|
retraction = Retraction.for @message
|
||||||
json = @controller.action_hash(@user.id, retraction)
|
json = @controller.action_hash(@user.id, retraction)
|
||||||
json.include?('retraction').should be_true
|
json.include?('retraction').should be_true
|
||||||
|
|
|
||||||
|
|
@ -7,17 +7,17 @@ require 'spec_helper'
|
||||||
describe StatusMessagesController do
|
describe StatusMessagesController do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
let!(:user) { make_user }
|
let!(:user1) { make_user }
|
||||||
let!(:aspect) { user.aspects.create(:name => "AWESOME!!") }
|
let!(:aspect1) { user1.aspects.create(:name => "AWESOME!!") }
|
||||||
|
|
||||||
let!(:user2) { make_user }
|
let!(:user2) { make_user }
|
||||||
let!(:aspect2) { user2.aspects.create(:name => "WIN!!") }
|
let!(:aspect2) { user2.aspects.create(:name => "WIN!!") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
connect_users(user, aspect, user2, aspect2)
|
connect_users(user1, aspect1, user2, aspect2)
|
||||||
request.env["HTTP_REFERER"] = ""
|
request.env["HTTP_REFERER"] = ""
|
||||||
sign_in :user, user
|
sign_in :user, user1
|
||||||
@controller.stub!(:current_user).and_return(user)
|
@controller.stub!(:current_user).and_return(user1)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#show' do
|
describe '#show' do
|
||||||
|
|
@ -26,30 +26,33 @@ describe StatusMessagesController do
|
||||||
@url="http://www.youtube.com/watch?v=#{@video_id}&a=GxdCwVVULXdvEBKmx_f5ywvZ0zZHHHDU&list=ML&playnext=1"
|
@url="http://www.youtube.com/watch?v=#{@video_id}&a=GxdCwVVULXdvEBKmx_f5ywvZ0zZHHHDU&list=ML&playnext=1"
|
||||||
end
|
end
|
||||||
it 'renders posts with youtube urls' do
|
it 'renders posts with youtube urls' do
|
||||||
message = user.build_post :status_message, :message => @url, :to => aspect.id
|
message = user1.build_post :status_message, :message => @url, :to => aspect1.id
|
||||||
message[:youtube_titles]= {@video_id => "title"}
|
message[:youtube_titles]= {@video_id => "title"}
|
||||||
message.save!
|
message.save!
|
||||||
user.add_to_streams(message, aspect.id)
|
user1.add_to_streams(message, aspect1.id)
|
||||||
user.dispatch_post message, :to => aspect.id
|
user1.dispatch_post message, :to => aspect1.id
|
||||||
|
|
||||||
get :show, :id => message.id
|
get :show, :id => message.id
|
||||||
response.body.should match /Youtube: title/
|
response.body.should match /Youtube: title/
|
||||||
end
|
end
|
||||||
it 'renders posts with comments with youtube urls' do
|
it 'renders posts with comments with youtube urls' do
|
||||||
message = user.post :status_message, :message => "Respond to this with a video!", :to => aspect.id
|
message = user1.post :status_message, :message => "Respond to this with a video!", :to => aspect1.id
|
||||||
@comment = user.comment "none", :on => message
|
@comment = user1.comment "none", :on => message
|
||||||
@comment.text = @url
|
@comment.text = @url
|
||||||
@comment[:youtube_titles][@video_id] = "title"
|
@comment[:youtube_titles][@video_id] = "title"
|
||||||
@comment.save!
|
@comment.save!
|
||||||
|
|
||||||
get :show, :id => message.id
|
get :show, :id => message.id
|
||||||
response.body.should match /Youtube: title/
|
response.body.should match /Youtube: title/
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
describe '#create' do
|
describe '#create' do
|
||||||
let(:status_message_hash) {
|
let(:status_message_hash) {
|
||||||
{:status_message =>{
|
{ :status_message => {
|
||||||
:public =>"true",
|
:public =>"true",
|
||||||
:message =>"facebook, is that you?",
|
:message =>"facebook, is that you?",
|
||||||
:aspect_ids =>"#{aspect.id}"}}
|
:aspect_ids =>"#{aspect1.id}" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
it 'responds to js requests' do
|
it 'responds to js requests' do
|
||||||
post :create, status_message_hash.merge(:format => 'js')
|
post :create, status_message_hash.merge(:format => 'js')
|
||||||
|
|
@ -57,16 +60,18 @@ describe StatusMessagesController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't overwrite person_id" do
|
it "doesn't overwrite person_id" do
|
||||||
new_user = make_user
|
status_message_hash[:status_message][:person_id] = user2.person.id
|
||||||
status_message_hash[:status_message][:person_id] = new_user.person.id
|
|
||||||
post :create, status_message_hash
|
post :create, status_message_hash
|
||||||
StatusMessage.find_by_message(status_message_hash[:status_message][:message]).person_id.should == user.person.id
|
new_message = StatusMessage.find_by_message(status_message_hash[:status_message][:message])
|
||||||
|
new_message.person_id.should == user1.person.id
|
||||||
end
|
end
|
||||||
|
|
||||||
it "doesn't overwrite id" do
|
it "doesn't overwrite id" do
|
||||||
old_status_message = user.post(:status_message, :message => "hello", :to => aspect.id)
|
old_status_message = user1.post(:status_message, :message => "hello", :to => aspect1.id)
|
||||||
status_message_hash[:status_message][:id] = old_status_message.id
|
status_message_hash[:status_message][:id] = old_status_message.id
|
||||||
lambda {post :create, status_message_hash}.should raise_error /failed save/
|
lambda {
|
||||||
|
post :create, status_message_hash
|
||||||
|
}.should raise_error /failed save/
|
||||||
old_status_message.reload.message.should == 'hello'
|
old_status_message.reload.message.should == 'hello'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -74,8 +79,8 @@ describe StatusMessagesController do
|
||||||
fixture_filename = 'button.png'
|
fixture_filename = 'button.png'
|
||||||
fixture_name = File.join(File.dirname(__FILE__), '..', 'fixtures', fixture_filename)
|
fixture_name = File.join(File.dirname(__FILE__), '..', 'fixtures', fixture_filename)
|
||||||
|
|
||||||
photo1 = user.build_post(:photo, :user_file=> File.open(fixture_name), :to => aspect.id)
|
photo1 = user1.build_post(:photo, :user_file=> File.open(fixture_name), :to => aspect1.id)
|
||||||
photo2 = user.build_post(:photo, :user_file=> File.open(fixture_name), :to => aspect.id)
|
photo2 = user1.build_post(:photo, :user_file=> File.open(fixture_name), :to => aspect1.id)
|
||||||
|
|
||||||
photo1.save!
|
photo1.save!
|
||||||
photo2.save!
|
photo2.save!
|
||||||
|
|
@ -83,28 +88,27 @@ describe StatusMessagesController do
|
||||||
hash = status_message_hash
|
hash = status_message_hash
|
||||||
hash[:photos] = [photo1.id.to_s, photo2.id.to_s]
|
hash[:photos] = [photo1.id.to_s, photo2.id.to_s]
|
||||||
|
|
||||||
user.should_receive(:dispatch_post).exactly(3).times
|
user1.should_receive(:dispatch_post).exactly(3).times
|
||||||
post :create, hash
|
post :create, hash
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
describe '#destroy' do
|
describe '#destroy' do
|
||||||
let!(:message) {user.post(:status_message, :message => "hey", :to => aspect.id)}
|
let!(:message) {user1.post(:status_message, :message => "hey", :to => aspect1.id)}
|
||||||
let!(:message2) {user2.post(:status_message, :message => "hey", :to => aspect2.id)}
|
let!(:message2) {user2.post(:status_message, :message => "hey", :to => aspect2.id)}
|
||||||
|
|
||||||
it 'should let me delete my photos' do
|
it 'let a user delete his photos' do
|
||||||
delete :destroy, :id => message.id
|
delete :destroy, :id => message.id
|
||||||
StatusMessage.find_by_id(message.id).should be_nil
|
StatusMessage.find_by_id(message.id).should be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'will not let you destroy posts visible to you' do
|
it 'will not let you destroy posts visible to you' do
|
||||||
delete :destroy, :id => message2.id
|
delete :destroy, :id => message2.id
|
||||||
StatusMessage.find_by_id(message2.id).should_not be_nil
|
StatusMessage.find_by_id(message2.id).should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'will not let you destory posts you do not own' do
|
it 'will not let you destory posts you do not own' do
|
||||||
delete :destroy, :id => message2.id
|
delete :destroy, :id => message2.id
|
||||||
StatusMessage.find_by_id(message2.id).should_not be_nil
|
StatusMessage.find_by_id(message2.id).should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,18 +7,18 @@ require 'spec_helper'
|
||||||
describe UsersController do
|
describe UsersController do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
let(:user) { make_user }
|
let(:user) { make_user }
|
||||||
let!(:aspect) { user.aspects.create(:name => "lame-os") }
|
let!(:aspect) { user.aspects.create(:name => "lame-os") }
|
||||||
|
|
||||||
let!(:old_password) { user.encrypted_password }
|
let!(:old_password) { user.encrypted_password }
|
||||||
let!(:old_language) { user.language }
|
let!(:old_language) { user.language }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in :user, user
|
sign_in :user, user
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#export' do
|
describe '#export' do
|
||||||
it 'should return an xml file' do
|
it 'returns an xml file' do
|
||||||
get :export
|
get :export
|
||||||
response.header["Content-Type"].should include "application/xml"
|
response.header["Content-Type"].should include "application/xml"
|
||||||
end
|
end
|
||||||
|
|
@ -26,36 +26,50 @@ describe UsersController do
|
||||||
|
|
||||||
describe '#update' do
|
describe '#update' do
|
||||||
it "doesn't overwrite random attributes" do
|
it "doesn't overwrite random attributes" do
|
||||||
params = {:diaspora_handle => "notreal@stuff.com"}
|
params = { :id => user.id,
|
||||||
proc{ put 'update', :id => user.id, "user" => params }.should_not change(user, :diaspora_handle)
|
:user => { :diaspora_handle => "notreal@stuff.com" } }
|
||||||
|
lambda {
|
||||||
|
put :update, params
|
||||||
|
}.should_not change(user, :diaspora_handle)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'should allow the user to update their password' do
|
context 'password updates' do
|
||||||
it 'should change a users password ' do
|
it 'allows a user to change his password' do
|
||||||
put("update", :id => user.id, "user"=> {"password" => "foobaz", 'password_confirmation' => "foobaz"})
|
put(:update, :id => user.id, :user =>
|
||||||
|
{ :password => "foobaz",
|
||||||
|
:password_confirmation => "foobaz" }
|
||||||
|
)
|
||||||
user.reload
|
user.reload
|
||||||
user.encrypted_password.should_not == old_password
|
user.encrypted_password.should_not == old_password
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not change a password if they do not match' do
|
it 'requires a matching password confirmation' do
|
||||||
put("update", :id => user.id, "user"=> {"password" => "foobarz", 'password_confirmation' => "not_the_same"})
|
put(:update, :id => user.id, :user =>
|
||||||
|
{ :password => "foobarz",
|
||||||
|
:password_confirmation => "not_the_same"}
|
||||||
|
)
|
||||||
user.reload
|
user.reload
|
||||||
user.encrypted_password.should == old_password
|
user.encrypted_password.should == old_password
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not update if the password fields are left blank' do
|
it 'does not update if the password fields are left blank' do
|
||||||
put("update", :id => user.id, "user"=> {"password" => "", 'password_confirmation' => ""})
|
put(:update, :id => user.id, :user =>
|
||||||
|
{ :password => "",
|
||||||
|
:password_confirmation => ""}
|
||||||
|
)
|
||||||
user.reload
|
user.reload
|
||||||
user.encrypted_password.should == old_password
|
user.encrypted_password.should == old_password
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'language' do
|
describe 'language' do
|
||||||
it 'should allow user to change his language' do
|
it 'allow the user to change his language' do
|
||||||
user.language = 'en'
|
old_language = 'en'
|
||||||
|
user.language = old_language
|
||||||
user.save
|
user.save
|
||||||
old_language = user.language
|
put(:update, :id => user.id, :user =>
|
||||||
put("update", :id => user.id, "user" => {"language" => "fr"})
|
{ :language => "fr"}
|
||||||
|
)
|
||||||
user.reload
|
user.reload
|
||||||
user.language.should_not == old_language
|
user.language.should_not == old_language
|
||||||
end
|
end
|
||||||
|
|
@ -64,8 +78,8 @@ describe UsersController do
|
||||||
|
|
||||||
describe '#edit' do
|
describe '#edit' do
|
||||||
it "returns a 200" do
|
it "returns a 200" do
|
||||||
get 'edit', :id => user.id
|
get 'edit', :id => user.id
|
||||||
response.code.should == "200"
|
response.status.should == 200
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -12,29 +12,30 @@ def r_str
|
||||||
end
|
end
|
||||||
|
|
||||||
Factory.define :profile do |p|
|
Factory.define :profile do |p|
|
||||||
p.sequence(:first_name){|n| "Robert#{n}#{r_str}"}
|
p.sequence(:first_name) { |n| "Robert#{n}#{r_str}" }
|
||||||
p.sequence(:last_name){|n| "Grimm#{n}#{r_str}"}
|
p.sequence(:last_name) { |n| "Grimm#{n}#{r_str}" }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
Factory.define :person do |p|
|
Factory.define :person do |p|
|
||||||
p.sequence(:diaspora_handle) {|n| "bob-person-#{n}#{r_str}@aol.com"}
|
p.sequence(:diaspora_handle) { |n| "bob-person-#{n}#{r_str}@aol.com" }
|
||||||
p.sequence(:url) {|n| "http://google-#{n}#{r_str}.com/"}
|
p.sequence(:url) { |n| "http://google-#{n}#{r_str}.com/" }
|
||||||
p.profile Factory.create(:profile, :first_name => "eugene", :last_name => "weinstien")
|
p.profile Factory.create(:profile, :first_name => "eugene", :last_name => "weinstien")
|
||||||
|
|
||||||
p.serialized_public_key OpenSSL::PKey::RSA.generate(1024).public_key.export
|
p.serialized_public_key OpenSSL::PKey::RSA.generate(1024).public_key.export
|
||||||
end
|
end
|
||||||
|
|
||||||
Factory.define :user do |u|
|
Factory.define :user do |u|
|
||||||
u.sequence(:username) {|n| "bob#{n}#{r_str}"}
|
u.sequence(:username) { |n| "bob#{n}#{r_str}" }
|
||||||
u.sequence(:email) {|n| "bob#{n}#{r_str}@pivotallabs.com"}
|
u.sequence(:email) { |n| "bob#{n}#{r_str}@pivotallabs.com" }
|
||||||
u.password "bluepin7"
|
u.password "bluepin7"
|
||||||
u.password_confirmation "bluepin7"
|
u.password_confirmation { |u| u.password }
|
||||||
u.serialized_private_key OpenSSL::PKey::RSA.generate(1024).export
|
u.serialized_private_key OpenSSL::PKey::RSA.generate(1024).export
|
||||||
u.after_build do |user|
|
u.after_build do |user|
|
||||||
user.person = Factory.build(:person, :profile => Factory.create(:profile), :owner_id => user._id,
|
user.person = Factory.build(:person, :profile => Factory.create(:profile),
|
||||||
:serialized_public_key => user.encryption_key.public_key.export,
|
:owner_id => user._id,
|
||||||
:diaspora_handle => "#{user.username}@#{APP_CONFIG[:pod_url].gsub(/(https?:|www\.)\/\//, '').chop!}")
|
:serialized_public_key => user.encryption_key.public_key.export,
|
||||||
|
:diaspora_handle => "#{user.username}@#{APP_CONFIG[:pod_url].gsub(/(https?:|www\.)\/\//, '').chop!}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -47,7 +48,7 @@ Factory.define :aspect do |aspect|
|
||||||
end
|
end
|
||||||
|
|
||||||
Factory.define :status_message do |m|
|
Factory.define :status_message do |m|
|
||||||
m.sequence(:message) {|n| "jimmy's #{n} whales"}
|
m.sequence(:message) { |n| "jimmy's #{n} whales" }
|
||||||
m.person
|
m.person
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'making sure the spec runner works' do
|
describe 'making sure the spec runner works' do
|
||||||
it 'should factory create a user with a person saved' do
|
it 'factoy creates a user with a person saved' do
|
||||||
user = make_user
|
user = make_user
|
||||||
loaded_user = User.first(:id => user.id)
|
loaded_user = User.first(:id => user.id)
|
||||||
loaded_user.person.owner_id.should == user.id
|
loaded_user.person.owner_id.should == user.id
|
||||||
|
|
@ -16,30 +16,31 @@ describe 'making sure the spec runner works' do
|
||||||
User.count.should == 0
|
User.count.should == 0
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns a user on fixed_user' do
|
describe '#make_user' do
|
||||||
new_user = make_user
|
it 'returns a user on' do
|
||||||
new_user.is_a?(User).should be_true
|
new_user = make_user
|
||||||
User.count.should == 1
|
new_user.is_a?(User).should be_true
|
||||||
|
User.count.should == 1
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns a different user the second time' do
|
||||||
|
new_user = make_user
|
||||||
|
second_user = make_user
|
||||||
|
|
||||||
|
User.count.should == 2
|
||||||
|
new_user.id.should_not == second_user.id
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns a different user on the second fixed_user' do
|
|
||||||
new_user = make_user
|
|
||||||
second_user = make_user
|
|
||||||
|
|
||||||
User.count.should == 2
|
|
||||||
new_user.id.should_not == second_user.id
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'factories' do
|
describe 'factories' do
|
||||||
describe 'build' do
|
describe 'build' do
|
||||||
it 'does not save a built user' do
|
it 'does not save a built user' do
|
||||||
Factory.build(:user).persisted?.should be_false
|
Factory.build(:user).should_not be_persisted
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not save a built person' do
|
it 'does not save a built person' do
|
||||||
Factory.build(:person).persisted?.should be_false
|
Factory.build(:person).should_not be_persisted
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -58,7 +59,7 @@ describe 'making sure the spec runner works' do
|
||||||
contact.should_not be_nil
|
contact.should_not be_nil
|
||||||
@user1.contacts.include?(contact).should be_true
|
@user1.contacts.include?(contact).should be_true
|
||||||
@aspect1.contacts.include?(contact).should be_true
|
@aspect1.contacts.include?(contact).should be_true
|
||||||
contact.aspects.include?( @aspect1 ).should be true
|
contact.aspects.include?(@aspect1).should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'connects the second user to the first' do
|
it 'connects the second user to the first' do
|
||||||
|
|
@ -66,7 +67,7 @@ describe 'making sure the spec runner works' do
|
||||||
contact.should_not be_nil
|
contact.should_not be_nil
|
||||||
@user2.contacts.include?(contact).should be_true
|
@user2.contacts.include?(contact).should be_true
|
||||||
@aspect2.contacts.include?(contact).should be_true
|
@aspect2.contacts.include?(contact).should be_true
|
||||||
contact.aspects.include?( @aspect2 ).should be true
|
contact.aspects.include?(@aspect2).should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'allows posting after running' do
|
it 'allows posting after running' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue